Brewmoth is a project to convert a Raspberry Pi into a general tool to assist with home-brewing, but can also be used more generally for temperature logging and control.
The original motivation was to use create a DYI fermentation chamber using peltier modules, but the code can be used more generally than that. For example, you can use it to make a temperature logger that interfaces with brewfather or to control a standard keezer set-up with InkBird and resistive heater, but with added temperature logging.
This is beyond the scope of this README, but here are some resources. There are two options:
- Edit the SD card on your normal computer to add your Wi-Fi details. Here is an example guide on how to do this.
- Alternatively you can connect a USB hub with a keyboard and mouse, and an HDMI monitor to add the Wi-Fi details as normal
Once the Wi-Fi details can be added you can use ssh
to connect to the raspberry pi.
More information can be found here.
- Create the directory but change
username
to your own username:sudo mkdir /brewmoth sudo chown username:username /brewmoth
- Install the following:
sudo rpi-update sudo apt update sudo apt upgrade sudo apt install python3 python3-pip nginx libatlas-base-dev libopenjp2-7 pigpio sudo apt update sudo apt autoremove sudo pip3 install virtualenv sudo systemctl enable pigpiod sudo service pigpiod start
- Copy repository to
/brewmoth
- Create a virtual environment with following requirements
cd /brewmoth virtualenv brewvenv source /brewmoth/brewvenv/bin/activate pip3 install uwsgi flask flask_cors systemd requests pigpio gpiozero matplotlib deactivate
- Type
ls /sys/bus/w1/devices/
to get the serial numbers of any installed 1-wire type temperature sensors. These will be a long string starting with some numbers, not anything that starts withw1
- Copy
example-config.json
and set the properties like so:- First, change the name as required.
- Second, edit the "Temperature sensors" section so there is at least one sensor of type "Main".
The serial portion is where you add the string identified with the above command.
The name of each sensor is completely up to you.
If you want to have the moth update brewfather, add an entry like this:
"Brewfather": True
- If using Nginx, link to configuration file, test the configuration works and restart nginx:
If not using nginx, you'll need to set up another service to connect to the unix socket that brewmoth is listening on.
sudo ln -s /brewmoth/brewmoth_server/brewmoth.nginx /etc/nginx/sites-enabled/brewmoth sudo nginx -t sudo service nginx restart
You also can add the brewmoth directory to PATH to allow the above commands to be called from anywhere in the shell
- Call
sudo nano ~/.profile
to start editing the.profile
file - Add the following line
PATH=~/opt/bin:$PATH
to the end of the file. - Exit with
ctrl+x
, selecty
and accept.
To troubleshoot, it's best to start brewmoth using the command-line. First, you need to turn on the virtual environment:
source /brewmoth/brewvenv/bin/activate
You can then start the brewmoth using the command:
python /brewmoth/wsgi.py
Once you know everything is great, you can configure it the brewmoth service.
To configure it as a service, stop any running brewmoth instance that you may have started through the command-line, and then activate the service file:
sudo ln -s /brewmoth/brewmoth_server/brewmoth.service /etc/systemd/system/brewmoth.service
sudo systemctl daemon-reload
sudo systemctl enable brewmoth
sudo service brewmoth restart
If you want to enable temperature control you need to enable the thermostat service:
sudo ln -s /brewmoth/brewmoth_server/brewmoth-thermostat.service /etc/systemd/system/brewmoth-thermostat.service
sudo systemctl daemon-reload
sudo systemctl enable brewmoth-thermostat
sudo service brewmoth-thermostat restart
You can now use normal linux service commands like the ones below:
sudo service brewmoth stop
sudo service brewmoth start
sudo service brewmoth restart
sudo service brewmoth status
To see the logs of the brewmoth service do sudo service brewmoth status
for the latest lines or
sudo journalctl -u brewmoth.service
for the full history.
Once brewmoth has been started through the command-line or as a service, you can use the following commands from the brewmoth directory:
./temps
./track-temps
./fans
./peltiers
You can run any of the above commands with -h
after to get more information on how and why to use them.
Note, for track-temps
you might need to first activate the virtual environment (see above).