Gravity in the cloud

How to connect your Tilt hydrometer to the cloud control panel using Raspberry Pi and Python.

Raspberry Pi

When beer is fermenting, you should monitor its gravity and temperature daily. It is easy to forget to do so, and impossible if you are away.

After some googling, I found several solutions for automated gravity monitoring. One of them, with very clever concept, called Tilt. Tilt is floating in your beer and is measuring its own tilt angle. This angle depends on liquid’s density, and therefore can measure gravity of the fermenting beer.

Tilt comes with a mobile app, that connects to it and can post data to any web service. The problem is that you need to be not far from Tilt to be able to do so. There is also a Raspberry Pi program that works with Tilt.

I’m already using Raspberry Pi to monitor cellar temperature, and a cloud control panel service If Tilt can talk to Raspberry Pi, it should be possible connect cloud4rpi to it. Tilt is using a wireless protocol, so you’ll need Raspberry Pi with a wireless chip (Rasbperry Pi 3 or Zero W).

Luckily, there is a GitHub repo for Tilt software with some samples. Looking at you can see that Tilt looks to others as BLE iBeacon, with “Color” coded in UUID, and temperature and gravity are in major and minor bytes.

Their sample code is for Node.js, and I have a Python control program based on cloud4rpi template

So I need to get Tilt data in Python. After some googling, I found — Python iBeacon scanner. This is a program, not a library, so I modified it to return a dictionary instead of string. And I also wrote Tilt-specific module to get color, temperature and gravity of the first Tilt found (I have only one), and a simple test program to check if it can see my Tilt:

Running it on my rpi-brewery:

It works! Now I can plug it to my control program. I already have a python program connected to, but let me show how to do so from the scratch.

First, sign in to, then create a new device:

You will be given a device token and installation instructions. For Raspberry Pi follow instructions here — make sure your system is up-to-date:

sudo apt update && sudo apt upgrade

Install prerequisites:

sudo apt install git python python-pip

Install cloud4rpi python packages:

sudo pip install cloud4rpi

then get a sample python app for Raspberry Pi (into control folder):

git clone []( control

cd control

modify — specify your device token in the line


Remove unnecessary entries from device variable declarations, leave only CPUTemp to test device connection:

now do a test run:

sudo python

If everything is ok, your device page will be immediately updated:

Now we need to modify to read and report Tilt’s color, temperature and gravity. Result looks like this:

Now run it manually to see if it works:

sudo python

If everything is good, you will see your variables online:

To run at system startup, install it as a service. Cloud4rpi provides an install script to do so. I’ve included it into my repo. To install as a service, run

sudo bash

Now you can start|stop|restart this service by running command

sudo systemctl start cloud4rpi.service

Service keeps its previous state on power up, so if it was running, it will be running after reboot or power loss.

This is it, now I have my Tilt parameters being sent to the cloud, so I can set up a nice cloud control panel for it. Go to and create new control panel, add widget and select /Gravity and Beer Temp as data source. Now I can monitor what’s going on even if i’m away from home:

Yes, it is 40C, but I just put Tilt into a glass of hot water to test graphs, don’t worry.

The code I copied and wrote is available here It is far from perfect, it works only with a single Tilt, it doesn’t care about “Color” of the device, whatever it means, and I’m not a Python guy at all, so fixes, suggestions or forks are welcome!

More projects for Raspberry Pi

Smart Coffee Machine Pump Controlled by Raspberry Pi & HC-SR04 Ultrasonic Sensor

How to refill your coffee machine's water tank automatically using Cloud4RPi and an ultrasonic sensor.

Made using Raspberry Pi

Humidity in the Cloud

The modern way to measure the most important parameters for human comfort: temperature and humidity.

Made using Raspberry Pi

DIY hydroponics system powered by UniPi

How to create a DIY hydroponics system at home and use Cloud4RPi for remote control and monitoring.

Made using Raspberry Pi

Get started today for free

Connect your device