HOWTO - Make a BrewPi Fermentation Controller For Cheap

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Status
Not open for further replies.
What make/model relay board are you using?
And did you go through the Device Manager to assign its channels to the proper digital IO pins, Chamber and functions?

Cheers!
 
What make/model relay board are you using?
And did you go through the Device Manager to assign its channels to the proper digital IO pins, Chamber and functions?

Cheers!
Hello! Thank you very much for your response! I'm using the following relay board. https://www.amazon.com/gp/product/B0057OC6D8/?tag=skimlinks_replacement-20
I thought that I gone into the Maintenance Panel within the BrewPi web application and tried to set up this correctly following the instructions given by FuzzyWuzzy below

  • Under DETECTED DEVICES you will see quite a few devices, find the one on Arduino Pin 5(Act2) and one on Arduino Pin 6(Act 1), these are your relay switches.
  • Set them to Chamber 1, and Chamber Device for their assigned values. You also need to set the Pin Type to inverted if you followed my wiring diagram and used the left and middle pins of the Relay output. Also make sure to hit apply for each device after you have set them up properly. After you do this for both of them and they show up as installed they should be listed as Switch Actuators.
    BrewPi-DeviceConfig6.png
    BrewPi-DeviceConfig7.png
    .


However, I think something might be wrong at this stage since, after clicking the "apply" button the relays did not sow up as "Actuators" I think they showed up as "digital pin" or something like that.

Also, I'm concerned that there may be a software compatibility issue since I don't think the software on from the brewpi site(https://wiki.brewpi.com/getting-started/raspberry-pi-docker-install) supports the Arduino Uno microcontroller any longer.

Finally, I have a bit of a foolish question. Right now I have my build connected by USB and am only using the USB for power. Do I need to power the board using a DC adapter instead?

Thanks again for any help that you can offer.
IMG_3720.JPG
IMG_3719.JPG
IMG_3717.JPG
 
Last edited:
Here's the Device Configuration from one of my full-blown BrewPi systems (3 probes, cool/heat/fan relays and a door sensor).
You can see that the only devices that actually "talk back" are the probes - none of the other devices actually have any way to identify themselves as they are simply controlled with single digital IO pin states.

Make sure all installed devices have all fields selected as shown...

bp_devices.jjpg.jpg

As for powering the Arduino, all of my BrewPi Unos have dedicated 9V 1A wall-warts or equivalent powering through the barrel socket. While it's possible to power them via the USB receptacle it's not as reliable a solution for all configurations. In my case the Unos for three of my BrewPi systems are remote units connected via Bluetooth - no host USB available - so a wall-wart was needed anyway, might as well make it the more reliable solution...

Cheers!
 
Thanks again for the help and the information. I configured all my devices as you showed. I have two temperature probes. So I configured one as chamber1;Beer1; Beer temp. The other probe I configured as chamber1;chamber device;chamber temp. Finally I configured pin A5(act 2) and A6 (Act 1) as you have. Of course I don't have the other devices that you have. Of course I also assigned devices slots as 0,1,2 and 3 respectively. I clicked "apply". I then set the the brewpi software to "beer constant temp" mode. However, although the beer temp was set lower than my room temperature (both probes out on my desk) the status of the controller just sat at "Idle" so the algorithm apparently was not attempting to actuate the relays. I let it sit for some time with no luck.

However, I did notice some interesting things. First, your software seems a little different form mine. Within the maintenance panel I see that you have a button labeled "Reprogram Arduino" whereas the same button in my control panel is labeled "Reprogram controller". Likewise, in the device list, your devices appear as "Arduino Pin" and mine appear as "Controller Pin". The reason I mention this is becuase I have downloaded the brewpi software from the brewpi website and I'm I thought that I read some where that this no longer supports the Arduino Uno board. Also, I noticed that none of the algorithm parameters are populated in the Advanced Setting tab for the controller algorithm. Should these be populated already with some default constants? I also have found that when I stop the brewpi script from the web interface i cannot restart the script and it will only restart again after I re-program the arduino with the brewpi hexfile (arduino revision C from github).

I'm thinking that my hardware set up is fine and that there is a software issue but that I may need the legacy software for brewpi that is compatible with the Arduino Uno. How recently have you built your BrewPi system using the Arduino Uno? Any advice on software issues? Thanks!
 
@Tulock, when setting up the Brewpi, you should have chosen the legacy branch from git. I believe this used to be done using the --ask parameter. Do you remember doing so? Otherwise, you would have installed the most current software, which no longer supports the arduino. I believe you can check out the legacy version by running the update and using the --ask parameter. (see image below from the DIYBrewPi Wikia page)

Did you install on a raspberry pi?


Screenshot_2018-11-30 Setting Up Your RPI.png


And it may be that the legacy version is not supported at all. This is partially why I am going to be moving over to Fermentrack.
 
Last edited:
I believe the version I'm running is 0.2.10 - which I think was the last version with Arduino support. Elco was maintaining a legacy branch for Arduino support but I just spent 15 minutes trying to find signs of the legacy code on Github and came up empty. Not good...
 
I had found that legacy branch for the www part of the kit earlier, but didn't recognize the other (script) half is located here
https://github.com/BrewPi/brewpi-script/tree/legacy.
So between those and the correct firmware it should still be possible to build a full legacy installation, assuming all the requisite packages are still available. For the OPs case just replacing the www portion may fix his issues...

Cheers!
 
Thanks to everyone that has taken time to help me with this ( @day_trippr @kaljade @gromitdj). Especially since this is such an old thread. Also, thanks for your patience with me since I really only know enough of what I'm doing to be dangerous. With that out of the way I have to ask a couple of very foolish questions. First, my plan is to flash my Arduino Uno with the arduino revision C hexfile using Xloader. Then try to install brewpi from https://github.com/BrewPi/brewpi-www/tree/legacy and python (whatever that is???) from here https://github.com/BrewPi/brewpi-script/tree/legacy. The problem is I don't know what to do with the information from either of these links. What command prompt commands do I need to execute in my Raspberry pi? Will this pose a problem with any previously installed version of brewpi? Do i have to delete old directories with previous brewpi folders. I barely know any linux commands. As promised, I only know enough to be dangerous at this point. Again, many thanks!
 
Do you have existing BrewPi installations? I'd think if you did it might be easier to resurrect them than starting from scratch - there were "update" commands available that will pull files from Github automagically if needed.

[edit] I should have prefaced the following with this: I don't know if the "automatic" BrewPi installation script (that appeared some time after my installation) is still viable. I used it once to update my installations and it worked pretty well. If the installation script is still available I would certainly give that a try first. Check out the files in https://github.com/BrewPi/brewpi-tools.

Otherwise...this is the installation log from my very first BrewPi installation years ago. I actually would not expect it to work because of package deprecation and supersession, and to be honest short of giving it a try I don't know where all the break points might be - bvut I'm pretty sure anything to do with phpmysql5 is going to break without its current (archived) location added to the package repository listing file /etc/apt/sources.list.

btw, RPIDEV was the name of the RaspberryPi I used for testing stuff before deploying it to my "working" systems. Also, many of the required packages had already been installed with the RaspberryPints taplist manager I had already installed, but I included their installation references anyway.

So, you're welcome to give it a shot. Be sure to have created a backup or clone of your existing SD card before setting out on what could be a total wipeout ;)

Note that the installation creates two file trees. The default locations are /home/brewpi for the script files and and /var/www or /var/www/html for the web interface files. If you've installed anything in those root folders it could be overwritten. For example, if there's an index.php file in /var/www or /var/www/html it's going to get overwritten.

Code:
Install BrewPi

Update repository pointers

$ sudo apt-get update

Install packages:


APACHE2 INSTALLATION

Full installation:

$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

But php5-cgi was the only thing missing from RPIDEV, so just install that:

$ sudo apt-get install php5-cgi

This actually resulted in multiple package installs and upgrades:

The following extra packages will be installed:
  libapache2-mod-php5 php5-cli php5-common php5-gd php5-mcrypt php5-mysql php5-sqlite

The following NEW packages will be installed:
  php5-cgi
 
The following packages will be upgraded:
  libapache2-mod-php5 php5-cli php5-common php5-gd php5-mcrypt php5-mysql php5-sqlite

Package installation completed successfully

PHP INSTALLATION

This was already resident but ran installer to update the package

$ sudo apt-get install php5

Package update completed successfully


MYSQL INSTALLATION

Already resident but performed to update packages

$ sudo apt-get install mysql-server mysql-client php5-mysql
$ sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Package updates completed successfully


PYTHON REQUIREMENTS INSTALLATION

$ sudo apt-get install python-serial python-simplejson python-configobj python-psutil python-git

Package updates completed successfully

ARDUINO IDE INSTALLATION

$ sudo apt-get install arduino-core

Already newest versions


SETTING UP USERS AND PERMISSIONS

Create user brewpi and group brewpi

$ sudo useradd -m -k /dev/null -G www-data,dialout brewpi
$ sudo passwd brewpi (set password = xxxxxxx)

Check brewpi rights

$ id brewpi

uid=1001(brewpi) gid=1004(brewpi) groups=1004(brewpi),20(dialout),33(www-data)

Add user pi to www-data and brewpi group

$ sudo usermod -a -G www-data pi
$ sudo usermod -a -G brewpi pi

NOTE: If you get the error "usermod: user 'pi' does not exist" then add user 'pi' then execute the usermod commands.

$ adduser pi
$ passwd pi (set the password twice)

Set the ownership of all files and subdirectories to brewpi and www-data (first two lines)
Give the group all permissions on all files (third and fourth line)
Give the group all permissions and set the sticky bit on all directories (fifth and sixth line).

NOTE: DID NOT DO THIS SECTION YET!

$ sudo chown -R www-data:www-data /var/www
$ sudo chown -R brewpi:brewpi /home/brewpi
$ sudo find /home/brewpi -type f -exec chmod g+rwx {} \;
$ sudo find /home/brewpi -type d -exec chmod g+rwxs {} \;
$ sudo find /var/www -type d -exec chmod g+rwxs {} \;
$ sudo find /var/www -type f -exec chmod g+rwx {} \;

4. Installing BrewPi
4.2.1. Cloning the remote repository

For BrewPi1:
$ sudo -u brewpi git clone https://github.com/BrewPi/brewpi-script /home/brewpi/brewpi1

Completed successfully

4.3. The web interface: brewpi-www
4.3.1. Cloning the remote repository

Target www directory should be empty (automatic installer may delete it!)

$ sudo -u www-data git clone https://github.com/BrewPi/brewpi-www /var/www/brewpi1


4.3.3. Fixing permissions after git commands

Edit the fixPermissions script in each BrewPi instance to match up with its path:


$ sudo nano /home/brewpi/brewpi1/utils/fixPermissions.sh

change webPath to point to subordinate brewpi1 folder:

webPath="/var/www/brewpi1"

Save the file and exit

Then execute each of the bash scripts:

$ cd /home/brewpi/brewpi1/utils
$ sudo bash fixPermissions.sh (for BrewPi1)



1.3. Modify the config files
1.3.1. Edit the script config files

The settings/config.cfg needs to be created in each script instance to properly configure them.

BrewPi1:

$ sudo nano /home/brewpi/brewpi1/settings/config.cfg

scriptPath = /home/brewpi/brewpi1/
wwwPath = /var/www/brewpi1/
port = /dev/brewpi1
altport = /dev/null
boardType = uno

Save the file and exit


1.3.2. Edit the web interface config files

config_user.php needs to be created in each web interface instance to properly configure them.
Here are the config files I’m using.

1. /var/www/brewpi1/config_user.php

<?php
// The default settings in config.php are overruled by the settings in config_user.php
// To use custom settings, copy this file to config_user.php and make your changes in config_user.php
// do not add a php closing tag, because newlines after closing tag might be included in the html

// Do not include a trailing slash on the path
$scriptPath = '/home/brewpi/brewpi1';


Save the file and exit


Set up identifiers for UNOS:

Remove all but one UNO from the USB ports and hubs, then run these commands:

$ udevadm info -a -n /dev/ttyACM0 | less > info.log
$ nano info.log

 looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4':
    KERNELS=="1-1.3.4"
        ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
        ATTRS{serial}=="85336303532351F0A031"

Repeat for additional UNOS on the USB ports

Then create the rules files:

$ sudo nano /etc/udev/rules.d/99-arduino.rules

SUBSYSTEM=="tty", KERNEL=="ttyACM*" , ATTRS{serial}=="85336303532351F0A031", SYMLINK+="brewpi1", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*" , ATTRS{serial}=="85334333931351F0F020", SYMLINK+="brewpi2", GROUP="brewpi"

[NOTE: created entries for both UNOs to allow swapping]

Once the udev rules file is created, disconnect your Arduino and then reload udev
before connecting all of the Ardiunos to their respective ports.

Disconnected UNO (but did not power cycle)

$ sudo /etc/init.d/udev reload


REBOOTED

BrewPi is up and running!

Cheers!
 
Last edited:
UPDATE! SUCCESS! DIY Fermentation Controller Using Arduino Uno and BrewPi compatible Fermentrack

Many many thanks to @day_trippr @kaljade @gromitdj for all of your help. @day_trippr I'm so grateful for the time and effort you put into this (no small effort on your part. Thanks!). It was very helpful to have everyone's input to get me on the right direction with this. After some head scratching on the original path I was pursuing with the BrewPi interface, I did the best thing I could think of first. I brewed beer! I have a Duvel's clone that I brewed from all grain fermenting right now. After that, I decided to do a fresh install of the Raspian operating system from here https://www.raspberrypi.org/downloads/ (I downloaded the NOOBS zip file, extracted it and wrote the files to a new SD card by dropping and dragging the files within Windows file explorer to the SD card. Inserted the micro SD into my Raspberry pi and did a fresh install). Then I went to http://www.fermentrack.com/ as @gromitdj suggested and entered the following command in my raspberry pi terminal curl -L install.fermentrack.com | sudo bash as directed at the web site. From there I followed all the instructions. The interface was extremely easy. It walks you through a guided set up and even flashes the Arduino Uno for you. They have the RevA and RevC BrewPi hexfiles so I flashed Rev C. I configured my devices and started a "brewing session". Everything worked perfectly! So, my original hardware build using the instructions provided by @FuzzeWuzze below was all hooked up perfectly. (Thanks for the original post on this build! https://www.homebrewtalk.com/forum/...wpi-fermentation-controller-for-cheap.466106/ )

bc260afb617333c655a812e710148a2cff7ac1ae.png


My outlets switched perfectly for heating and cooling also!
While I'm certainly not as capable as everyone mentioned here, I've summarized the steps I took above and tried to link it to some of the original information in case it might help someone else. Thanks again!
 
UPDATE! SUCCESS! DIY Fermentation Controller Using Arduino Uno and BrewPi compatible Fermentrack

Many many thanks to @day_trippr @kaljade @gromitdj for all of your help. @day_trippr I'm so grateful for the time and effort you put into this (no small effort on your part. Thanks!). It was very helpful to have everyone's input to get me on the right direction with this. After some head scratching on the original path I was pursuing with the BrewPi interface, I did the best thing I could think of first. I brewed beer! I have a Duvel's clone that I brewed from all grain fermenting right now. After that, I decided to do a fresh install of the Raspian operating system from here https://www.raspberrypi.org/downloads/ (I downloaded the NOOBS zip file, extracted it and wrote the files to a new SD card by dropping and dragging the files within Windows file explorer to the SD card. Inserted the micro SD into my Raspberry pi and did a fresh install). Then I went to http://www.fermentrack.com/ as @gromitdj suggested and entered the following command in my raspberry pi terminal curl -L install.fermentrack.com | sudo bash as directed at the web site. From there I followed all the instructions. The interface was extremely easy. It walks you through a guided set up and even flashes the Arduino Uno for you. They have the RevA and RevC BrewPi hexfiles so I flashed Rev C. I configured my devices and started a "brewing session". Everything worked perfectly! So, my original hardware build using the instructions provided by @FuzzeWuzze below was all hooked up perfectly. (Thanks for the original post on this build! https://www.homebrewtalk.com/forum/...wpi-fermentation-controller-for-cheap.466106/ )

View attachment 600736

My outlets switched perfectly for heating and cooling also!
While I'm certainly not as capable as everyone mentioned here, I've summarized the steps I took above and tried to link it to some of the original information in case it might help someone else. Thanks again!
That illustration of the hardware wiring instructions has a ground wire in the picture that shouldn't be there. If you built it according to that illustration, remove the ground wire from the outlet to your relay board. Don't mix the grounds from your house wiring with the GND on your Arduino or other micro controllers.

Congrats on getting your build up and running. You are going to love it!
 
I have not used Fermentrack, but last week I was able to get a new Brewpi up and running using a Rpi 2b + Sainsmart Uno using FuzzeWuzze's instructions. I could not get it to work with Raspbian Stretch, and had to roll back to Jessie. That solved my PHP issues.

On a side note, I'm using Remot3.it to get remote access to my BrewPi's from the anywhere on the web. Works great, and I don't need a hosted website or domain name.
 
Greetings, @Rockem, and welcome to our tiny corner of HBT! :mug:

Does Remot3.it require port forwarding through NAT routers? If it doesn't I'm definitely going to take a closer look...

Cheers!
 
That illustration of the hardware wiring instructions has a ground wire in the picture that shouldn't be there. If you built it according to that illustration, remove the ground wire from the outlet to your relay board. Don't mix the grounds from your house wiring with the GND on your Arduino or other micro controllers.

Congrats on getting your build up and running. You are going to love it!

Thanks @CadiBrewer for the input! I actually did not connect the relay board ground to the house wiring.
 
Greetings, @Rockem, and welcome to our tiny corner of HBT! :mug:

Does Remot3.it require port forwarding through NAT routers? If it doesn't I'm definitely going to take a closer look...

Cheers!

No port forwarding needed either. I had port forwarding setup on my router for my DynDNS hosted site. Once the renewal came up, I decided to find a cheaper solution. I haven't had to touch my router with remot3.it.
 
Awesome, and thanks for that. I've been wrestling with going with some form of vpn but this might obviate that. I need to do some homework but I'm assuming the local agents open ports and keep them open hence no need for forwarding...

Cheers!
 
...aaaaannnnnnd thank you for teaching me a new word, "obviate". For a minute I thought you were channeling a Potter-universe spell.
 
Even though I don't know what a Potter-universe spell might entail (I've only incidental peripheral exposure to the genre) I'm still laughing :D

Cheers!
 
:off:I can imagine any number of "OBVIATE!" curses -- when fired at flat-earthers, or people in relationships their friends *KNOW* are bad, or at me when I opine about needing, REALLY NEEDING, a new ferm chamber...just...BECAUSE!

Carry on
:off:
 
lol! Ok, just don't point that magic wand in my general direction ;)

Life is too damned short. If you want another chamber, spent the kids' inheritance and go for it...

Cheers! :D
 
Before I start up this adventure, I want to make sure I have this straight: the hardware setup depicted in the wiki by fuzzewuzze is still valid, but the software directions are no longer supported and it is recommended to use fermentrack instead? I'm looking for a basic system: pi zero W, arduino uno, dual relay board with single beer and single fridge temp sensor (single vessel/single chamber). No bells, no whistles, just straight up single vessel/single chamber fermentation temperature control programmable through WLAN via web browser.
 
Before I start up this adventure, I want to make sure I have this straight: the hardware setup depicted in the wiki by fuzzewuzze is still valid, but the software directions are no longer supported and it is recommended to use fermentrack instead? I'm looking for a basic system: pi zero W, arduino uno, dual relay board with single beer and single fridge temp sensor (single vessel/single chamber). No bells, no whistles, just straight up single vessel/single chamber fermentation temperature control programmable through WLAN via web browser.
I suggest you read this thread first and ditch the UNO R3 for the ESP8266. https://www.homebrewtalk.com/forum/...ewpi-www-replacement-for-raspberry-pi.649303/
http://docs.fermentrack.com/en/master/
 
I think my eyes are bleeding... Fermentrack sounds great with ease of setup and use. The ESP8266 thread almost made my head juice leak all over though, and I only got through 4 of the 54 pages. What would a wiring diagram look like for that thing and how would it connect to the pi?
 
The
I think my eyes are bleeding... Fermentrack sounds great with ease of setup and use. The ESP8266 thread almost made my head juice leak all over though, and I only got through 4 of the 54 pages. What would a wiring diagram look like for that thing and how would it connect to the pi?
wiring diagram looks like this
top.svg.s.png
 
Since there's a new Raspbian release (Stretch) I decided to update my tutorials. Stretch (and possibly later Jesse) had pretty nice support for headless configurations so that's how I wrote the one for Stretch. Here's the old and new ones:


Doing a new install with Arduino Uno I had,with a Raspberry Pi 3 model B and I have . Can't get to the browser interface. After the install it said to go to Http:// without an IP.
I have Implemented steps from your pages above which were very helpful. Thank you for those as I've been confused by the number of BrewPi sites out there both commercial and DIY.

Is file /etc/dhpcpcd.conf supposed to be all commented out?
I get an error on booting
" failed to start Raise network interfaces. See 'systemctl status network.services'"
I can ping my RPI from a computer on my network
I can ping a computer on my network from the RPI
I can SSH into the RPI
I even have what looks like data in files called like My\ First\ BrewPi\ Run-2018-12-15-2.json
I put the Bonjour Printer Services on my Windows 10 machine

I just can't access the brewpi interface from a browser.

I'm thinking of eventually going a BruControl route but it would be good to get what I have up in running before putting more money into a system.
 
Try changing file /etc/network/interfaces.d/setup

From:

Code:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

to:

Code:
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp

then reboot and see what happens...

Cheers!
 
No change Day_trippr. In fact that file didn't exist until I created it and tried it.
I looked everywhere in case it ended up elsewhere. Could it be not there because dhpcpcd.conf is not used as it is all commented out?

pi@raspberrypi:~ $ sudo find / -name setup
/etc/network/interfaces.d/setup
/usr/lib/dpkg/methods/apt/setup
 
I get this
pi@raspberrypi:~ $ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.164 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::8213:4096:d661:adfc prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:47:ed:ea txqueuelen 1000 (Ethernet)
RX packets 7408 bytes 811685 (792.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1214 bytes 175776 (171.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

.....then stuff for

lo: wlan0: wlan1: inet6 etc
 
Status
Not open for further replies.
Back
Top