[ad_1]
Have you ever ever needed to estimate the quantity of sugar within the water through the strategy of brewing beer? Raphael Baron shared about his journey in making a digital hydrometer that may obtain that!
Background
A hydrometer is a tool used to find out the relative density of a liquid answer. It floats on prime of it and we will inform one thing concerning the liquid’s density by investigating precisely the way it floats.
Most analog hydrometers float vertically like this.
At relaxation, they displace their very own weight of the liquid it’s in — that’s the Archimedes’ precept from highschool. The catch is that this: whereas this weight is fixed, the _volume_ of displaced liquid will depend on its density. Intuitively, a bigger quantity of a much less dense liquid have to be displaced to cancel out the burden of the hydrometer. This makes the hydrometer sink additional into the liquid. We are able to correlate how a lot it sinks with the density of the liquid.
Now, think about we preserve elevating the middle of mass of that analog hydrometer. What ought to occur? Because it seems, we will get it to drift at an angle — and the angle relies upon each on the situation of the middle of mass and the density of the liquid.
If we then assemble a tool that purposefully floats on this trend, we will correlate this tilt angle with the liquid’s density. I guess you recognize the place that is going. If we slap an accelerometer and gyroscope on this child, we’re in a reasonably good place: we will measure this tilt angle after which estimate the liquid’s density. That is precisely what the digital hydrometer does.
Sugarboard with waterproof enclosure
How does it work?
When measuring liquid, sugarboat will float on prime of the liquid. This may trigger it to shift its heart of mass and float at an angle. This tilt angle (see picture under) is bigger for denser liquids and smaller for much less dense liquids. We are able to then estimate the density of an answer from this angle.
As is common within the beer and wine making processes, we will moreover correlate the estimated density of an answer with the quantity of sugar current in it.
Tech Specs
- nRF52840 SoC
- Reads sensors, estimate the sugar content material and exposes their values through Bluetooth Low Vitality (BLE) service
- SHT30 temperature & humidity sensor
- MPU6050 accelerometer + gyroscope estimates the lean angle
- Li-Ion 18650 battery
- Battery lifetime of over a 12 months on a single cost
- Constructed-in TP4056-primarily based charging circuit
- USB-C for battery charging and programming
- UF2 assist utilizing a forked Adafruit_nRF52_Bootloader permits for direct programming through the USB-C port. This bootloader must be flashed to the clean nRF52 chip as soon as utilizing a J-Hyperlink or appropriate SWD programmer.
Calibration
On this planet of beer making, the amount of curiosity usually is the quantity of sugar that may get processed into alcohol through the fermentation. The density of the pre-fermentation is often taken to be brought on primarily by sugar. So, the sensor must be calibrated by measuring the angle towards a collection of options with completely different, recognized sugar concentrations. This may give an inventory of (angle, sugar%) pairs. We then match a polynomial mannequin over it to interpolate in-between values:
The method is guide — add some sugar, write down the measured angle. Repeat. We are able to measure the relative density at every step with a store-bought analog hydrometer, however most individuals will desire a refractometer for this. Refractometers measure the refraction angle of an answer and correlate it with, on this case, the focus of sugar in it. These ones within the image above output the worth in two scales: Brix (1 diploma = 1 g sugar/100 g answer) and SG (rel. density, or particular gravity). By the tip of this course of, you’ll have the coefficients of a second-degree polynomial that most closely fits the pairs of measured (angle, diploma Brix) and simply add them to sugarboat utilizing the online shopper and it is good to go.
Net shopper
This shopper is an online web page that connects to sugarboat utilizing the Net Bluetooth API. It permits you to calibrate, configure and skim the sensor values proper out of your internet browser, wirelessly.
Interactive 3D mannequin
Baron then exported the 3D mannequin of the PCB board from Kicad design software program. Having an accelerometer and gyro means a 3D mannequin could be made further interactive. The orientation could be obtained from sugarboat’s BLE service and pipe it, along with the 3D mannequin, into Threejs. No wires, proper within the browser. The end result seems to be nice!
Dwelling Assistant integration
Baron additionally put collectively an ESPhome shopper, which is an superior solution to get sugarboat’s information into Dwelling Assistant. Right here’s a screenshot of the house assistant occasion:
For extra details about this mission, all of the design information and code are open supply and accessible on GitHub.
[ad_2]
