Carpe Diem:12 December, 2024

Installing CraftBeerPi

This post may contain affiliate links. Please see our disclaimer for more info.

I’ve been homebrewing for a few years now. One excellent quality control in my brew process that I’ve found is maintaining a proper fermentation temps. I use a mini fridge for my fermentation chamber – it works great. I received this mini fridge a few years ago, but it was broken. The control unit was dead, but the compressor worked just fine. I rewired the fridge to use an Inkbird temp controller as the brains. This worked great for years, however it lacks a couple nice features – intelligence and accessibility. I wanted to be able to control my fermentation chamber and monitor it remotely. I did some digging and found CraftBeerPi (CBP) – a brewing and fermentation controller. So far I’ve been pretty pleased.

Why Craftbrewpi?

There are a variety of homebrew solutions out there for a Raspberry Pi or other devices. I ultimately picked CraftBeerPi because it had all the features I wanted including:

  • Works on headless setup
  • Low overhead (runs perfectly on a pi zero w)
  • Has designated fermentation controls
  • Is extensible with add-ons
  • Decent setup documentation and troubleshooting
  • Open source

That’s not to say it comes without any problems – the primary developer of CraftBeerPi hasn’t spent much time updating v3 lately. Luckily there is enough community support out there to still get things up and running. Apparently the developer is working on v4, but there isn’t anything out there except a video demo or two. Manuel has made some great software – I hope he finds the time again to rejoin his work!

CraftBeerPi 2.2 vs 3

Version 3 is still technically a beta, but it’s the version of choice by many of the community. 2.2 works, but it has its issues as well. I could never get it running properly due to install issues with versions of Raspbian. I eventually switched to v3 and haven’t turned back. V3 has nice additional features, runs well enough, and has decent support from the community, so from my perspective, no reason not to use v3.

Hardware Needed

This guide is aimed at using a Raspberry Pi to run CraftBeerPi, but it could be run on a variety of devices. For my setup, I use the following:

  • Raspberry Pi Zero – this is an amazon link, though you can likely find it cheaper elsewhere during a sale (think Pi day! March 14th)
  • Zero Starter Kit
  • Power Adapter (I use an iPhone one I had extra) – just about any AC to USB adapter will work. Aim for at least 1 amp, though I’m using a 750ma one without issue for CraftBeerPi. See this article for an analysis on power consumption.

Installing Raspbian

  1. Download the Raspbian Lite image (you can download a desktop version, but it’s not necessary for this) to install on your pi. Some folks use the NOOBS installer, but I prefer my old fashioned image install
  2. Download Etcher – this is used to write the image properly to an SD card
  3. Flash the SD card with the Raspbian image within Etcher – v easy, follow the steps in app.

Depending on if you are running headless setup (no monitor/keyboard hooked up), you’ll want to follow some additional steps so the pi can automatically connect to WiFi and be accessible via SSH. If you are using your pi with a keyboard/monitor, skip the headless setup.

Headless Setup

I googled and found many helpful links. The steps are:

  1. After flashing your SD card, unplug and replug it into your computer. You should see a volume named ‘boot’. This is a fat32 formatted volume so just about any OS can read/write on it.
  2. Create a file named ‘ssh‘ with no extension and no contents in the file. Save this file in ‘boot’ (no folders needed)
  3. Create a separate file named ‘wpa_supplicant.conf‘. This file will contain wifi info and credentials so the pi knows how to connect to your network. I’ve included an example of what this file looks like below, but see this page on directions on how to set up the file properly. I highly recommend not storing your wifi credentials in plain text, use the wifi hashing program wpa_passphrase that comes with Raspbian – see here for details.
  4. After you’ve saved these two files to boot, pop the SD card into your Raspberry Pi and power up! It’ll take a few minutes to get the first boot setup. Once it’s done, you’ll be able to SSH into your pi with the default credentials: user is ‘pi’ and password is ‘raspberry’. Change your password at a later time – DO NOT use the default password if exposing your pi outside of your local network.

Standard Setup

  1. For non-headless setup, plug the SD into the Raspberry Pi and power up. It’ll run through some initial first boot setup then prompt for a login. Use the default credentials: user is ‘pi’ and password is ‘raspberry’. Change your password at a later time – DO NOT use the default password if exposing your pi outside of your local network.
  2. Use this page to set up wifi.  I highly recommend not storing your wifi credentials in plain text, use the hashing program that comes with Raspbian – see here for details.
  3. Use the Raspbian config tool sudo raspi-config to tweak any other options you may want enabled (such as ssh access)

Installing CraftBeerPi

UPDATE 2020-12-29: Someone recommended this forked repository to install CBP3. This repo contains an updated installer and some other tweaks so following the instructions on the repo should be a worry free install. I have not personally used this repo; if you want to stick to the traditional albeit messy setup, follow the guide below!

Now that we are up and running with Raspbian, next is installing the software needed to run CBP. As mentioned before, CBP does not come without its problems. The biggest pain point is installing. Since the repo hasn’t been actively maintained, the install process is outdated. Not all of the required dependencies are properly installed – luckily it’s pretty easy to do manually to get things up and running.

First Login into the Pi! Time to start installing
  1. First run sudo apt-get update and sudo apt-get upgrade get the latest packages and updates (this can take a LONG time on slower CPUs).
  2. Next install git by running sudo apt-get install git
  3. Next clone the CBP repo by following the below steps per the readme. Depending on your setup, this can take 5-10 min. Enter the following commands:
    1. git clone https://github.com/Manuel83/craftbeerpi3
      1. NOTE: Make sure to use craftbeerpi3 no craftbeerpi
    2. cd craftbeerpi3
    3. sudo ./install.sh
    4. Then install from the menu. No need to have it run apt-get update and apt-get upgrade again but it can’t hurt.
    5. Additionally, if you are prompted for installing one-wire support, select yes if you plan to do so (most CBP setups use this)
  4. Now comes the fun part! Depending on how much is outdated when you are trying to install, not all the dependencies are installed properly with the CBP installation. Instead of running CBP from the install.sh script, try running sudo ./run.py. This will attempt to start CBP, but you’ll be able to quickly see the error trace on the console (vs having to dig in a file). At the bottom of the error trace, you’ll see something along the lines of ImportError: No module named xx. The ‘xx’ is the component we need to install.
  5. In order to install the missing components, we need to install pip first. Pip is the python package manager. Run sudo apt-get install python-pip to get it installed.
  6.  The steps from here are iterative as follows:
    1. sudo ./run.py – see what component is missing
    2. sudo pip install xx where ‘xx’ is the missing component from step 1 above
Manually installing missing modules

Here’s the code below that I needed to run to get CBP working early September 2019.

UPDATE March 2020: Thanks to the commenter Paul Grimes and Dominick pointing out a few script typos and that the gitdb PyPI package that CBP3 requires was updated early March 2020, and now is only compatible with Python 3.4 or greater. To get gitdb to install, you need to specify the version – added below.

sudo apt-get install python-pip -y #thanks dominik!
sudo pip install flask
sudo pip install flask_socketio
sudo pip install flask_classy
sudo pip install PyYAML # use when module 'yaml' can't be found
sudo pip install GitPython # use when module 'git' can't be found
sudo pip install requests
sudo pip install gitdb2==2.0.5 #thanks Paul!
CraftBeerPi is running!

Once you see the line INIT DB after running run.py, CBP is running. SUCESSS! We want CBP to run as a daemon (on it’s own), so terminate run.py by pressing ctrl-z. Then run install.sh again and start CBP from here. You can also set CBP to autostart at boot from here.

Once CBP is all set up, access it via port 5000:

  • Locally (on your pi) – 127.0.0.1:5000
  • Remotely (from a different computer) – use the Raspberry Pi IP address. e.g. 192.168.0.137:5000

Next, follow the hardware setup instructions on CBP to start getting your hands dirty. Also take a look at the add-on plugins available – there are a bunch of them. Install them from within CraftBeerPi. Here are the ones I use:

  1. Brewer’s Friend – sends updates to BF such as fermentation temps for graphing
  2. IFTTT Notifications – sends notifications to IFTTT
  3. GPIOCompressor – tweaks the cooling setup of fermentation to not turn the compressor on/off in quick succession potentially damaging the compressor

49 Comments

  1. Shawn Reply

    I walked this along and made headway but now have this :

    from flask.ext import wtf
    ImportError: No module named ext.

    When I try to install flask.ext I get an error that says Could not find a version that satisfies the requirements….

    Any ideas?

    1. Alex Post author Reply

      Shawn – so sorry for the delayed response. I didn’t see this comment come in! Are you still working through this?

      Have you tried running the below to install other the flask libraries?

      sudo pip install flask_socketio
      sudo pip install flask_classy

    2. Brooks Pettit Reply

      I had the same problem today. I realized that I had cloned the git repository for craftbeerpi instead of craftbeerpi3!

      According to everything I read on stack overflow, accessing flask extensions via flask.ext is completely depreciated. You’d have to update the import lines in the python 2.7 source code to the new usage.

      When I ran the instillation instructions for craftbeerpi3 instead, I had it up and running in no time!

  2. Jeffery Schneider Reply

    Alex thank you so much for these instructions! I was having a heck of a time getting CBP to work then stumbled on your instructions and everything worked perfectly. Right now all I have is a Tilt Hydrometer, but found excellent instructions for that as well… someday maybe I’ll go electric ¯\_(ツ)_/¯

    1. Alex Post author Reply

      Awesome! I’m glad they helped. I had a bit of a challenge my first time getting things running so was hoping this would save some time and effort for some additional folks.

      I’ve debated a full electric brewing setup. It’s neat from a technical standpoint, but part of the joy of homebrewing for me is the cooking aspect. Having an automated electrical system takes that a away a little. But who know!

  3. Nacho Reply

    Hi i have a problem with “flask.ext”, no module named ext.
    From what I read, recommending using Windows 10. Do you have any other solution?

    1. Alex Post author Reply

      Hi! Not sure what you mean by Windows 10; CBP runs on linux. No Win10 involvement except perhaps when you format your SD Card. Regarding flask… Have you tried running the below to install other the flask libraries?

      sudo pip install flask_socketio
      sudo pip install flask_classy

    2. Brooks Pettit Reply

      Did you make sure to clone the git repository for craftbeerpi3? I had this problem when I accidentally cloned the repository for craftbeerpi, which uses a depreciated way of accessing flask extensions.

  4. Paul Grimes Reply

    The gitdb PyPI package that CraftBeerPi3 requires was updated last weekend, and now is only compatible with Python 3.4 or greater.

    To get gitdb to install, you need to do:
    pip install gitdb2 == 2.0.5

    Just thought that this should be mentioned here, as it’ll start catching people out soon

  5. LUIS RICARDO PEDROSO Reply

    I have a problem!
    Quando tento executar com o comando sudo ./run.py aparece ImportError: No module named git
    Seguindo seus passos devo instalar através sudo pip install git, porém a seguinte mensagem aparece:
    Could not install packkages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/git/

    1. Alex Post author Reply

      Hi! To clarify, you use sudo apt-get install git to clone the CBP repository. When CBP is installed and you’re trying to install the missing modules, use sudo pip install GitPython when you receive the error ‘ImportError appears: No module named git’. Hope this helps!

  6. dominik Reply

    hey

    the python install blcok..

    sudo apt-get install python-pip -y #add -y to prevent the question which leads to problems when you copy paste the full block
    sudo pip install flask
    sudo pip install flask_socketio # the , at the end leads to an error
    sudo pip install flask_classy
    sudo pip install PyYAML
    sudo pip install GitPython
    sudo pip install requests
    sudo pip install gitdb2==2.0.5 #remove the spaces in front and after ==

    1. Alex Post author Reply

      Many thanks for this! Admittedly, I did not trying running all the lines of code verbatim and missed some items – nice catches.

  7. Mateus Junqueira Reply

    Hello. When I tried to do the entire step by step, my terminal did not accept the commands “sudo ./run.py” and “sudo pip install gitdb2 == 2.0.5”. Does not recognize ==

    1. Alex Post author Reply

      Hi – there was a typo on sudo pip install gitdb2==2.0.5, there should be no spaces surrounding the ‘==’. Fixed now. For the sudo ./run.py not working, have you switched to the CBP3 directory? cd craftbeerpi3. Make sure you are using CBP3 vs CBP. Hope this helps.

  8. Håkan Behrendtz Reply

    Hi Alex.
    I stumbled on to your guide while trying to figure out why the CraftBeerPi 3 would not start.
    I had been working on it for a good 8 hours trying different solutions.
    Once I followed your instructions it just started working.
    Thank you ever so much for your efforts.

    Sincerely Håkan B

    1. Alex Post author Reply

      Thanks for this! To clarify, if manually installing GitPython==2.1.15, fewer manual installs are needed? I’ll need to give this a shot.

  9. Martin Reply

    Thanks Alex for this perfect tutorial. I get it working on my RaspberryPi. Looking forwared to use it on my brewing system :o). Please can I ask you if there is any possibility to control servo in CraftBeerPi? I am using heater with termostat which can be set to specific value by turning the control button round. So I plan to print a servo holder which would be connected to this control button and which would be controlled by the CraftBeerPi. Any help will be appreciated. Thanks and happy brew day :o)

    1. Alex Post author Reply

      I’m glad you found it helpful!! I don’t have any personal experience with controlling a servo, but depending on the inputs that it takes, it could easily be controlled with CBP and the raspberry pi. Using the GPIO pins on the pi, they can emit low voltage to control things. For example, I’m using these to control relays that turns on a refrigerator compressor for my fermentation chamber. It’ll take some tinkering, but anything is really possible with the right setup.

      Another option is having a different device control the servo (e.g. arduino) and then have CBP talk to that device. Check out the CBP plugin library to see if anyone has done this already. Or if you want to get your hands dirty with some code, you can write the plug-in yourself!

      Sorry it’s not an easy answer, but hope this helps! Happy brewing!

      1. Martin Reply

        Hello Alex. Thanks for your answer. I am going to check the plugins but till now I did not find such. I was thinking about the same option as you mentioned – control the servo with ATTINY and communicate with CBP. The problem when directly control by CBP is that servo is driven by sending different lenght of signal. I found python script which can control the servo but not sure how to implement in CBP. I would be not able to code the plugin in python as I do not have any experience with python. I would be able to do it with Arduino only. So maybe I will completely switch to Arduino as it will be easier for me. I will search plugins first and then I will decide. Thanks a lot Alex for your helpful tutorial and comment to my question and have a good brew day :o)

      2. Martin Reply

        Hello Alex,
        just want to share my current approach with the CraftBeerPi and servo control. I have succeed with your recomandation and I used ATMEG328p for servo movement control but based on the inputs of the Raspberry Pi. So when the CraftBeerPi send ON/OFF for actuator as High/Low on same GPIO, then it is triggered by the ATMEG chip and send correct signal to servo motor. It works just fine. So thanks for pointing this out in your answer.
        By the way is there same possibility in CBP2 to setup that it automatically turn on the agitator when actuator is also ON ? I was thinking only about option to connect both on the same GPIO control, but this is not what I would like to achieve. Because sometimes I would like to only start the agitator (stirring) but without the actuator (heating element). So I would need separate control but when turned on automatic control during the recepi I would like to achieve both start together. Would you have some recomandations for it?
        One more thanks for your help and have a good brew day :o)

        1. Alex Post author Reply

          Glad to hear you got it working!! Apologies for my delayed response; working full time and watching kids full time during this pandemic is a challenge! I’m pretty sure you can add multiple things to turn on when CBP detects that the temp is too low (heater needs to be on). However I don’t have first hand knowledge with this – I’ve only used CBP for fermentation control. Sorry I don’t have a better answer!

  10. jake baggs Reply

    Huge thanks. Software is running now.!
    i have a RB4 running on a 10.1″ touchscreen. now i can add the Craftbeerpi expansion board to the RBP.
    New brewery build starts in a couple days!

  11. Jamie Cadman Reply

    Hi Alex, bit of a novice here.
    Firstly thanks to your helpfull info i managed to get past te requirments.txt and nor cbp3 running, but no one wire option, if this because i dont have the sensor connected yet? any help would be very much apricated

    1. Alex Post author Reply

      Hi Jamie – glad the guide helped! For the one-wire – did you ever get the prompt to install this when installing CBP initially? If not, try re-installing CBP or manually enabling one-wire support by running the raspi-config configurator – interface options -> 1-wire support. Additional details here: raspi-config docs

  12. Ram Geva Reply

    Hi
    Thanks for the guide it is great.
    Everything was working fine, added a plugin that needed restart of the system.
    After restart the CBPI didn’t came up and when trying to run manually I get the following:
    raise ImportError(“‘gitdb’ could not be found in your PYTHONPATH”)
    ImportError: ‘gitdb’ could not be found in your PYTHONPATH
    What could be the issue?
    Thanks

    1. Alex Post author Reply

      Hi Ram – sorry I missed this comment! If you’re still having this issue, you could try reinstalling gitdb. run sudo pip install gitdb2==2.0.5. If that doesn’t work, you might need to force reinstall. Let me know!

  13. Konstantin Jekimov Reply

    pleas help me ALex, i run fine craftbeerpi3 via web, but i cant run it in Kios mode,
    i i run raspberry zero with raspberry desktop version
    i have done already this fot startup, but it will not starting up..
    Install Chromium Browser

    sudo apt-get install chromium
    Change startup Config

    sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
    Change the file that it looks like this

    @lxpanel –profile LXDE
    @pcmanfm –desktop –profile LXDE
    @xset s off
    @xset -dpms
    @xset s noblank
    @sed -i ‘s/”exited_cleanly”: false/”exited_cleanly”: true/’ ~/.config/chromium/Default/Preferences
    @chromium –noerrdialogs –kiosk http://localhost:5000 –incognito

    1. Alex Post author Reply

      Hi – Sorry I’m not really familiar with kiosk mode. If CBP is working fine, running from any type of modern browser should work. Sorry I can’t be of more help.

  14. konstantinus Reply

    pleas help, i cant install flask_socketio

    Downloading https://files.pythonhosted.org/packages/c4/29/efdb97d117b0f6538b046b576e33c1cbd59b4d1c2959cf8d0f8089a8f1b4/python_engineio-4.0.0-py2.py3-none-any.whl (50kB)
    100% |████████████████████████████████| 51kB 1.1MB/s
    Collecting bidict>=0.21.0 (from python-socketio>=5.0.2->flask-socketio)
    Could not find a version that satisfies the requirement bidict>=0.21.0 (from python-socketio>=5.0.2->flask-socketio) (from versions: 0.1.5, 0.2.1, 0.3.0, 0.3.1, 0.9.0rc0, 0.9.0.post1, 0.10.0, 0.10.0.post1, 0.11.0, 0.12.0.post1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.15.0.dev0, 0.15.0.dev1, 0.15.0rc1, 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4)
    No matching distribution found for bidict>=0.21.0 (from python-socketio>=5.0.2->flask-socketio)

  15. Marcin Baranski Reply

    Hi im have a problem please help.
    raceback (most recent call last):
    File “./run.py”, line 3, in
    from modules import socketio, app, cbpi
    File “/home/pi/craftbeerpi3/modules/__init__.py”, line 50
    print “INIT DB”
    ^
    SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(“INIT DB”)?

  16. Jeremy Nunn Reply

    i keep getting thie error
    Could not find a version that satisfies the requirement bidict>=0.21.0 (from python-socketio>=5.0.2->flask_socketio) (from versions: 0.1.5, 0.2.1, 0.3.0, 0.3.1, 0.9.0rc0, 0.9.0.post1, 0.10.0, 0.10.0.post1, 0.11.0, 0.12.0.post1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.15.0.dev0, 0.15.0.dev1, 0.15.0rc1, 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4)
    No matching distribution found for bidict>=0.21.0 (from python-socketio>=5.0.2->flask_socketio)

  17. Frank Joosten Reply

    pi@raspberrypi:~/craftbeerpi3 $ sudo python run.py
    Traceback (most recent call last):
    File “run.py”, line 3, in
    from modules import socketio, app, cbpi
    File “/home/pi/craftbeerpi3/modules/__init__.py”, line 32, in
    from modules.addon.endpoints import initPlugins
    File “/home/pi/craftbeerpi3/modules/addon/__init__.py”, line 1, in
    import endpoints
    File “/home/pi/craftbeerpi3/modules/addon/endpoints.py”, line 9, in
    from git import Repo
    File “/usr/local/lib/python2.7/dist-packages/git/__init__.py”, line 38, in
    from git.config import GitConfigParser # @NoMove @IgnorePep8
    File “/usr/local/lib/python2.7/dist-packages/git/config.py”, line 16, in
    from git.compat import (
    File “/usr/local/lib/python2.7/dist-packages/git/compat.py”, line 16, in
    from gitdb.utils.compat import (
    ImportError: No module named compat
    pi@raspberrypi:~/craftbeerpi3 $

    For this: the requirements.txt changed in home craftbeerpi3

    GitPython==3.0.7

    and executed: sudo pip install -r requirements.txt

    Next error:

    Traceback (most recent call last):
    File “run.py”, line 3, in
    from modules import socketio, app, cbpi
    File “/home/pi/craftbeerpi3/modules/__init__.py”, line 32, in
    from modules.addon.endpoints import initPlugins
    File “/home/pi/craftbeerpi3/modules/addon/__init__.py”, line 1, in
    import endpoints
    File “/home/pi/craftbeerpi3/modules/addon/endpoints.py”, line 9, in
    from git import Repo
    File “/usr/local/lib/python2.7/dist-packages/git/__init__.py”, line 40, in
    from git.config import GitConfigParser # @NoMove @IgnorePep8
    File “/usr/local/lib/python2.7/dist-packages/git/config.py”, line 28, in
    import configparser as cp
    ImportError: No module named configparser
    pi@raspberrypi:~/craftbeerpi3 $

    Now file config.py changed:
    sudo vi /usr/local/lib/python2.7/dist-packages/git/config.py

    in stead of: import configparser as cp

    try:
    import configparser as cp
    except:
    from six.moves import configparser as cp

    And now it works perfectly.

  18. for nothing Reply

    Because many point to this page for installation help, I wanted to add my fix to my problem getting cbpi3 up and running on my Raspberry Pi 2B, as of today (2021-04-13).

    As of version 21, pip is no long supporting Python2. If, for some reason, you are running above pip==20.3.4, pip is likely running on Python3 instead of Python2, which is the version required to run the installer (or update packages through pip) as described on this page. Because of this, I could not get a cbpi3 server properly installed (I think this was also preventing me from setting up cbpi2, which I had previously had working).

    In addition to setting the default version of Python, as listed here:
    https://raspberry-valley.azurewebsites.net/Python-Default-Version/

    I also had to manually uninstall pip and force the reinstall to v20.3.4. Sorry, I can’t recall the exact commands I had to use, but
    pip –version
    should indicated pip version as well as the Python version you are running.

    Hope this helps save someone else a lost brew day!

  19. Gogogo Reply

    If you install Raspbian lite it works fine.
    Then you first have to install git: sudo apt-install git
    and continue with the standard installation:
    Open a terminal window on Raspberry Pi and type:

    git clone https://github.com/Manuel83/craftbeerpi3

    This will download (clone) the software to your local Raspberry Pi.

    Type cd craftbeerpi3 to navigate into the craftbeerpi folder.

    Type sudo ./install.sh

    Hope this helps

    1. Gogogo Reply

      before installing works you also need:
      sudo python2 get-pip.py
      and as mentioned in the article:
      sudo pip install GitPython
      sudo pip install gitdb2==2.0.5

  20. Luis Reply

    Olá tudo m?
    Sou novato por aqui, gostaria de saber se existe alguma atualização o se tem instrução para o craftbeer pi 4.

    Obrigado

Leave a Reply

Your email address will not be published.