Package: brewblox-tilt
BrewBlox Service for the Tilt HydrometerTheTilt hydrometeris a wireless hydrometer and thermometer used to gather live readings of specific gravity and temperature when brewing beer.BrewBloxis a modular brewery control system design to work with the BrewPi controller.This brewBlox service integrates the Tilt hydrometer into BrewBlox.UsageInstall scriptTo automatically install a new Tilt, you can use theinstall_tilt.pyscript.
This will create the ./tilt directory, and edit yourdocker-compose.ymlfile.In your BrewBlox directory, run the following commands:curl-Ohttps://raw.githubusercontent.com/j616/brewblox-tilt/develop/install_tilt.py
python3./install_tilt.pyOr: Deploy the Tilt service on the BrewBlox stackYou need to add the service and set the eventbus port in yourdocker-compose.ymlfile.tilt:image:j616s/brewblox-tilt:latestrestart:unless-stoppedprivileged:truenetwork_mode:hostvolumes:-./tilt:/shareFinally, you'll have to bring up the new service usingbrewblox-ctlupRunning on a remote machineOn the remote machine in the directory you wish to install the service, create adocker-compose.ymlfile like this with the relevant IP address for the brewblox host.version:'3.7'services:tilt:command:--mqtt-host=<brewblox_hostname/IP>image:j616s/brewblox-tilt:latestnetwork_mode:hostprivileged:truerestart:unless-stoppedvolumes:['./tilt:/share']If you host brewblox on a different port (e.g. if you run brewblox on a NAS), you'll also want to add--mqtt-port=<port>to the command with the relevant port (https).Create the directory for the tilt calibrationmkdirtiltStart the service with the following commanddocker-composeup-dAdd to your graphsOnce the Tilt service receives data from your Tilt(s), it should be available as graph metrics in BrewBlox.CalibrationCalibration is optional. While the Tilt provides a good indication of fermentation progress without calibration, it's values can be less accurate than a traditional hydrometer. With calibration its accuracy is approximately that of a traditional hydrometer. If you wish to use your Tilt for anything beyond simple tracking of fermentation progress (e.g. stepping temperatures at a given SG value) it is recommended you calibrate your Tilt.To calibrate your Tilt, you first need to create a folder for the calibration files to be stored in. The recommended folder is./tiltin the BrewBlox directory. You can use other directories but you should change the volume parameter for the Tilt service in your docker compose file accordingly. You can create thetiltdirectory by running the following command in the BrewBlox directory:-mkdirtiltNOTE:It is recommended you create thetiltfolder before launching the Tilt service for the first time. Failure to do so will result in the docker service creating the folder as root. If this happens, usechownto change the user and group ownership of thetiltfolder to match the rest of the BrewBlox directory.If you wish to calibrate your Specific Gravity readings, create a file calledSGCal.csvin thetiltdirectory with lines of the form:-<colour>, <uncalibrated_value>, <calibrated_value>The uncalibrated values are the raw values from the Tilt. The calibrated values are those from a known good hydrometer or calculated when creating your calibration solution. Calibration solutions can be made by adding sugar/DME to water a little at a time to increase the SG of the solution. You can take readings using a hydrometer and the Tilt app as you go. You can include calibration values for multiple colours of Tilt in the calibration file. A typical calibration file would look something like this:-black, 1.000, 1.001
black, 1.001, 1.002
black, 1.002, 1.003
black, 1.003, 1.004
red, 1.000, 1.010
red, 1.001, 1.011
red, 1.002, 1.012
red, 1.003, 1.013
red, 1.004, 1.014You will need multiple calibration points. We recommend at least 6 distributed evenly across your typical gravity range for each Tilt. For example, if you usually brew with a starting gravity of 1.050, you may choose to calibrate at the values 1.000, 1.010, 1.020, 1.030, 1.040, 1.050, and 1.060. The more calibration points you have, the more accurate the calibrated values the service creates will be. Strange calibrated values from the service are an indication you have used too few or poorly distributed calibration values.Calibration values for temperature are placed in a file calledtempCal.csvin thetiltdirectory and have the same structure. Temperature values in the calibration file MUST be in Fahrenheit. The tempCal file can also contain calibration values for multiple Tilts. Again, it should contain at least 6 points distributed evenly across your typical range. A typical tempCal file would look like this:-black,39,40
black,46,48
black,54,55
black,60,62
black,68,70
black,75,76Calibrated values will be logged in BrewBlox separately to uncalibrated values. If you don't provide calibration values for a given colour of Tilt, only uncalibrated values will be logged. You don't need to calibrate both temperature and SG. If you only want to provide calibration values for SG, that works fine. Calibrated temp values would not be generated in this case but calibrate SG values would.It is also recommended that you re-calibrate SG whenever you change your battery. Different batteries and different placements of the sled inside the Tilt can affect the calibration.LimitationsAs the Tilt does not talk directly to the BrewPi controller, you cannot use your Tilt to control the temperature of your system. This service currently only allows you to log values from the Tilt. To control your BrewPi/BrewBlox setup you will need a BrewPi temperature sensor.DevelopmentTo get started:Install deps & pyenvsudoaptupdate-y
sudoaptinstall-y\libglib2.0-dev\libatlas3-base\python3-bluez\make\build-essential\libssl-dev\zlib1g-dev\libbz2-dev\libreadline-dev\libsqlite3-dev\wget\curl\llvm\libncurses5-dev\libncursesw5-dev\xz-utils\tk-dev\libffi-dev\liblzma-dev\python-openssl\gitInstall pyenvcurlhttps://pyenv.run|bashInstall Python 3.7pyenvinstall3.7.7After installing, it may suggest to add initialization code to~/.bashrc. Do that.Install Poetrypip3install--userpoetryConfigure and install the environment used for this project.Run in the root of the cloned brewblox-tilt directorypyenvlocal3.7.7
poetryinstallDuring development, you need to have your environment activated. When it is activated, your terminal prompt is prefixed with (.venv).Visual Studio code with suggested settings does this automatically whenever you open a .py file. If you prefer using a different editor, you can do it manually by running:poetryshellYou can build a docker container for x86 using the following:brewblox-devlocalbuildOr for ARM using the following:brewblox-devlocalbuild--archarmYou can then run this container using the following:dockerrun--net=host--privileged-v~/brewblox/tilt:/sharej616s/brewblox-tilt:local