A digital hydrometer. The main use case is measuring the amount of sugar in liquids during the process of beer and wine making.
Sugarboat floats on top of the liquid being measured. Because of its shifted center of mass, it will float at an angle. This tilt angle (see image below) is larger for denser liquids and smaller for less dense liquids. We can then estimate the density of a solution from this angle.
As is usual in the beer and wine making processes, we can additionally correlate the estimated density of a solution with the amount of sugar present in it.
The estimated density and sugar content are exposed - along with the temperature, relative humidity, current battery voltage and more - through Bluetooth Low Energy (BLE) services. This repository contains examples of how to read these values under clients/
.
- nRF52840 system-on-a-chip
- Reads sensors, estimates the sugar content and exposes their values via Bluetooth Low Energy (BLE) services
- SHT30 temperature & humidity sensor
- MPU6050 accelerometer + gyroscope estimates the tilt angle
- Li-Ion 18650 battery
- Battery life of over a year on a single charge
- Built-in TP4056-based charging circuit
- USB-C for battery charging and programming
- UF2 support using a forked Adafruit_nRF52_Bootloader allows for direct programming via the USB-C port. This bootloader needs to be flashed to the blank nRF52 chip once using a J-Link or compatible SWD programmer
A preform PET tube (or "petling") is used to enclose the electronics and provide sugarboat with the buoyancy it needs. The printed circuit board is designed to fit tightly into a tube with the inner diameter of around 33 mm and inner height of 123 mm. The board is slightly wider than 33 mm - some light sanding needs to be done to ensure a nice, snuggly fit. I bought my containers from this eBay offering.
Directory | Description |
---|---|
kicad/ |
Electronics - schematic, PCB layout, bill of materials and fabrication files |
code/ |
Firmware - a PlatformIO project using the Arduino framework |
clients/web/ |
A web interface for calibrating, configuring and reading sugarboat's sensors |
clients/arduino/ |
A barebones Arduino sketch showing how to read sugarboat's tilt angle, temperature & battery voltage using a Bluetooth Low Energy client |
clients/esphome/ |
An ESPHome client that integrates with Home Assistant |
This client is a web page that connects to sugarboat using the Web Bluetooth API. It lets you calibrate, configure and read the sensor values right from your web browser, wirelessly.
The web client's source code is in clients/web/
.
TODO.
To support programming via the built-in USB-C port (via UF2), sugarboat requires a bootloader to be flashed to the chip. This is a one-time operation.
I have forked the Adafruit nRF52 Bootloader and added support to sugarboat. To build and flash the bootloader:
$ git clone git@github.com:rbaron/Adafruit_nRF52_Bootloader.git
$ cd Adafruit_nRF52_Bootloader/
$ make BOARD=sugarboat all
$ make BOARD=sugarboat erase
# Look for the build target that contains the merged bootloader + Nordic's SoftDevice and flash it.
# It will be something like _build/build-sugarboat/sugarboat_bootloader-X.X.X-XXX-XXXXXXXXX_s140_6.1.1.hex:
$ nrfjprog --program _build/build-sugarboat/sugarboat_bootloader-0.4.0-149-g5ffac2e_s140_6.1.1.hex -f nrf52 --reset
Note that you will need a SWD programmer to complete this operation. A good choice for hobbyists is a J-Link EDU Mini. If you buy one, consider getting it from Adafruit.