• Please visit and share your knowledge at our sister communities:
  • If you have not, please join our official Homebrewing Facebook Group!

    Homebrewing Facebook Group

HOWTO - Make a BrewPi Fermentation Controller For Cheap

Homebrew Talk

Help Support Homebrew Talk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Status
Not open for further replies.
Teensy is an Arduino alternative, pretty cool from what I can see, and cheaper. I am, if anything, a cheapskate. :)

So, why couldn't I control boil/mash temps as I would with a traditional PID? My thinking is that if it can control temperature, it should be able to control the SSR driving my electric boil kettle. Set it to 170F and it will hold the kettle there for a hop stand. Set it to 152F and it will hold it there so I can recirculate a hot water coil through the mash, or even control a second electric element in a little RIMS tube.

Again, maybe I'm missing something obvious. I'm not familiar with automation or microcontrollers at all, really, so I'm just wondering why BrewPi can hold a ferm chamber at 65F but can't control a boil kettle element.

Thanks for the quick reply!

I would stick with an uno, you can them for 18 off Amazon, I can't imagine an teensy being much cheaper and i can't guarantee the pin outs the same. It's not setup to control a brew kettle, that's not to say couldn't be modified. Most of the config is assuming longer decision times since your not turning the fridge on and very frequently.
 
Ahhh, that makes sense. Thanks again!

And if cost is an issue but time isnt, you can always order an Arduino Uno off Dx.com or a similar chinese distributor for cheaper, but it will take 4-6 weeks to reach anywhere in the US. But now you can get knockoffs from Sainsmart here in the US in a few days for only like $5 more so its not really worth it.
 
So just for giggles( I have a dell mini pc collecting dust) is the upgrade path for a pc something like: install ubuntu>install debian wheezy> then back on track?

Thanks
 
Debian is its own distro of Linux and "Wheezy" is its code name, i wouldnt recommend using Ubuntu unless your willing to make some modifications yourself.

If you install Debian Wheezy you can just follow their manual steps, a few people here said there was a bit of difficulty but seemed to figure it out and we can help if you get stuck.
 
so I tried to install this on my raspberry pints pi. I get this error:

I installed to /var/www/brewpi, and stopped apache2 for the install.

Thanks

brewpi error.jpg
 
Rabeb25 .. are you running the install.sh script or following the "manual" instructions? When I hit errors like this I first tried an apt-get install of the package (as root) and then searching the web for solutions if that failed. You may want to search the brewpi forum as well.
 
Install.sh script


Sent from my iPhone using Home Brew
 
From 3.1.3 of the brewpi.docs ...

The current version of BrewPi doesn’t use MySQL. It is recommended to not install it. If you want MySQL anyway, you can install it with these commands:

So you may be able to get around this by either following the manual steps for installing MySQL then rerunning the install script or backup and go through the manual steps.

I'm sort of making this up as I go along and know enough about Linux to be dangerous. As I mentioned in an earlier post, mt brewpi install involved a lot of searching internet forums.

Todd
 
They must have broke or changed something since i used the install script.

I'll try to install it all on my extra system and write down the manual instructions and changes required for those of you having issues in the future.
 
Rabeb25 .. are you running the install.sh script or following the "manual" instructions? When I hit errors like this I first tried an apt-get install of the package (as root) and then searching the web for solutions if that failed. You may want to search the brewpi forum as well.

Also congratz on the tower from Birdman, i recognized your name :mug:
 
As a bit of an update, I managed to get everything up and running on a VirtualBox instance of Debian using the manual instructions, no problems at all. I had previously tried to install BrewPi on a virtual Mint install, but I got a few errors along the way that I think had their roots in the apt repos not being the same or something, and eventually it was just kinda messy so I scrapped it. I'm obviously not going to do anything live or even program my Uno with this virtual setup, but it's encouraging to see the BrewPi interface on my web browser!
 
Silver .. I know that feeling.

Fuzze ... yeah, the brew tower was probably what I needed/wanted least since I'm not even kegging yet. I guess it will inspire a top down kegerator build. Moving to Cornys is on the radar for me and the guys I brew with but I've been trying to concentrate on other areas ... like fermentation temp control! :)
 
I installed R Pints first and just had brewpi install into /var/www/brewpi instead of the normal www directory. I have had no problems with the web side of the house as both brew pi and rpints display with the right address. I just ran the script and haven't looked behind the curtain yet to see if there are two different systems as I am working on wiring right now.

Did you get any errors? I am trying the exact same thing and get this error:
error unable to open files list file for package `php5-mysql' :input/output error
 
I got the install script to work. If you install Debian wheezy create a pi user and add him to the sudoers file. Login as the pi user.

Next exectue:
$ git clone https://github.com/BrewPi/brewpi-tools.git ~/brewpi-tools

Then you need to vi the install.sh script and remove rpi-update from the apt-get line that adds the packages. Line 179 in the script.

After that it all ran and I get the GUI to launch without issue.

Now to order the parts. Hope this helps someone.
 
Would you post your brewpi/settings/config.cfg file? I'd like to get a look at your path settings for the various Arduino variables.

Todd
 
Did you get any errors? I am trying the exact same thing and get this error:

error unable to open files list file for package `php5-mysql' :input/output error


No, I don't remember any errors. I seem to remember something about php but I think it was related to it already being installed. I used the default settings for everything except the web path, where I put /var/www/brewpi/

Not sure if it matters but I installed pints first and then brewpi from a brand new installation so nothing had been configured before.
 
Anyone who wants to, want to do a join.me and take a look?

Thanks
 
Would you post your brewpi/settings/config.cfg file? I'd like to get a look at your path settings for the various Arduino variables.

Todd

My default.cfg is

scriptPath = /home/brewpi/
wwwPath = /var/www/
port = /dev/ttyACM0
altport = /dev/ttyACM1
boardType = leonardo
beerName = My First BrewPi Run
interval = 120.0
dataLogging = active

And my Config.cfg to override those is
beerName = CurrentBeer
dataLogging = active
profileName = Ruby

Im confused by this because i am most definitely running an Uno not a leonardo...but it gives me hope that you guys are getting the interface up and running :)
 
So did you leave all the "ArduinoHome = "stuff commented out? Maybe because I started out trying a non-Wheezy install I got stuck in the mindset that I had to reset these parts of the config.cfg file. I stuck to the paths outlined in the manual install instructions so I'll try commenting those out and see what happens.

Todd
 
All i did was run the install script on a bare Raspbian install, but that was several months ago. Recently a few weeks ago i ran the updater script and it ran without any issues.

I didnt touch any of the config files.
 
Alright...so...

I got the error from the first time I installed that I posted about. After much searching, and tweaking I rebooted my pi and it hung, and everything was borked, formatted and re-installed everything.

Brought up a fresh install of everything concentrating on loading raspberrypints first then brewpi. That worked, upgraded my uno, brewpi saw everything. Rebooted it hung again, and would not load, after trying some things..formatted and re-installed everything.

bought up another fresh install, this time backing up every time I made a change... installing raspian, installing pints, installing brewpi, etc.. of course it is running flawless now, after taking 4x the time because of all the backing up.. but that is actually nice, so if something does get borked again, I should be able to start basically at a fresh install of all the stuff, and not at zero.

With that being said, I do have a few questions.
I want other to be able to view these beers in real-time, is there a way to password the configuration settings? i.e. script stuff, maintenance panel, set temperature mode, etc.. or put them all behind one master password that is behind the maintenance panel?

I looked at your page you have Fuzze, copied the source and it looks like you just stripped the buttons(links) to that stuff. I guess you have have 2 pages a regular index page, and a say public.php with the public.php stripped like you have. NAy ideas welcome.. thanks again.
 
Good to hear you got it up, sucks you had so many problems but that just goes to show you how finicky the RPI can be and that is the exact reason they use a Arduino to control the sensors, so when/if the RPI goes tits up at 2am your chamber continues to run its preset and doesnt ruin your beer.

Your right that's what i did, i had to copy both the main page(default.php?) as well as one of the other config pages in order to make a "public accessible" version that no one can get too. I can post more specifics tonight when i get home if you want, i cant see the exact changes i made because a lot of the html is generated by php from pulling in other pages.

That said if you ONLY want to password protect your setup and dont care about making a public version use this info here to setup your HTAccess permissions in apache, then open your RPI to the world on your router obviously.

http://www.debianhelp.co.uk/htaccess.htm

You will probably want to use something like their very first example to limit post and require a password to get to the page.

For me i used one of the lower settings to make it so that only people from my LAN IP range can access my default.php file. There was one thing i had to change in the apache config files, it had to do with enabling AllowOverride which by default i think is commented out in the apache files..again i can post info about it when i get home.

You can see that if you tried to go to the root(which would send you to the default.php)
http://fuzzelogicbrewing.dyndns-server.com/

At some point I may make it so i can just login and alter it anywhere as well, but it dont need that functionality really..i set a profile up for the 7-10 days i ferment and just let it do its thing.
 
Yea that would be great if you could post your methods, I don't know that the doc you linked me to is going to do what I need it to. Basically I would like a "read only access" and a admin login to change settings. Much like the raspberry pints.. display the data, but need a login/pass to change any of it.

Thanks.
 
Yea your going to have to do what i did basically, ill post the details later...you will have to have two separate pages though just like i have unless you want to do a crap load of PHP coding to alter their existing page generation. Because the settings are spread all over the page, at the top panel, and at the bottom there is no single "one" entry point into the what you would call the "Admin area". Both the top panel start/stopping/arduino config as well as the bottom graph and beer settings are built from two entirely different php files, i suppose you could somehow setup Htaccess to require every one of these buttons to require a login but it seems like overkill.

The easier method is like mine where you would just have the regular default.php that requires a login, and the Public.php which anyone can see and is like mine which is just the default page with all of the buttons torn off so someone cant mess with it remotely.
 
Sounds great, I can do that.
 
Method to make password protected external BrewPi Page

Disclaimer, this opens your BrewPi up to the outside world. While this is cool, I take no responsibility for the security of your system. We are doing our best to ensure that the htaccess settings below are fool proof but there may be other methods of malicious people screwing with your BrewPi by putting it out on the internet. If you aren't ok with this risk please do not make your BrewPi public

  1. Putty/SSH into your BrewPi system(or keyboard if its hooked up to a monitor).
  2. Run the following commands to enable htaccess
    cd /etc/apache2/sites-available
    sudo nano default
  3. look for <directory /var/www/> ... </directory>
    change allowOverride to All and save the file.
  4. Now its time to restart apache:
    cd /usr/sbin
    sudo apache2ctl -k graceful
  5. Go to /var/www directory
  6. Create a file using vi editor called .htaccess and inside of it put the following, modify the first line where it is bold and replace it with what you plan to call your Private PHP file.
    <FilesMatch "index.php">
    Allow from all
    authuserFile /var/www/private/.htpasswd
    AuthName "YOUR LOGIN HERE"
    AuthType Basic
    <Limit GET POST>
    require valid-user
    </Limit>
    </FilesMatch>
    <FilesMatch "beer-panel.php|config.php|configuration.php|control-panel.php|maintenance-panel.php|previous_beers.php|program_arduino.php|s ave_beer_profile.php|start_script.php">
    Order deny,allow
    Deny from All
    Allow from 192.168.
    </FilesMatch>
  7. Edit the last allow line that says Allow from 192.168. to match up with whatever your local LAN IP address scheme is. You dont need wildcards or subnet masks or anything else.
  8. Create a directory called private(to store the above .htpasswd file), and go into it.
  9. Type htpasswd -c .htpasswd <UserName>, it will pop up asking you for a password, and make you repeat it.
  10. Your done! If you try going to Http://brewpi/index.php it will now as you for a password and it wont let you in unless you enter in the right one from above. A side effect of this seems to be you cant just go to http://brewpi anymore as it will say you dont have authorization and not forward you to the proper page, not a big deal though. Also make sure obviously that if you want to access this from the external world that your RPI is port forwarding properly through your router.

Method to Make a public accessible version of BrewPi
This will make a page identical to mine, with all of the buttons stripped so someone cant change your chamber settings yet you can show off your cool fermentation chamber status to everyone!
http://fuzzelogicbrewing.dyndns-server.com/FuzzeLogicBrewery.php

  1. Goto /var/www
  2. Create a file with any name you want, with a php file extension, this will be your primary entry point...give it your brewery name, or something simple like public.php it doesnt matter. This is the contents that goes in the file

<?php
/* Copyright 2012 BrewPi/Elco Jacobs.
* This file is part of BrewPi.

* BrewPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* BrewPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with BrewPi. If not, see <http://www.gnu.org/licenses/>.
*/
?>

<?php
// load default settings from file
$defaultSettings = file_get_contents('defaultSettings.json');
if($defaultSettings == false){
die("Cannot open default settings file: defaultSettings.json");
}
$settingsArray = json_decode(prepareJSON($defaultSettings), true);
if(is_null($settingsArray)){
die("Cannot decode defaultSettings.json");
}
// overwrite default settings with user settings
if(file_exists('userSettings.json')){
$userSettings = file_get_contents('userSettings.json');
if($userSettings == false){
die("Error opening settings file userSettings.json");
}
$userSettingsArray = json_decode(prepareJSON($userSettings), true);
if(is_null($settingsArray)){
die("Cannot decode userSettings.json");
}
foreach ($userSettingsArray as $key => $value) {
$settingsArray[$key] = $userSettingsArray[$key];
}
}


$beerName = $settingsArray["beerName"];
$tempFormat = $settingsArray["tempFormat"];
$profileName = $settingsArray["profileName"];
$dateTimeFormat = $settingsArray["dateTimeFormat"];
$dateTimeFormatDisplay = $settingsArray["dateTimeFormatDisplay"];
?>

<!DOCTYPE html >
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>BrewPi reporting for duty!</title>
<link type="text/css" href="css/redmond/jquery-ui-1.10.3.custom.css" rel="stylesheet" />
<link type="text/css" href="css/style.css" rel="stylesheet"/>
</head>
<body>
<div id="beer-panel" class="ui-widget ui-widget-content ui-corner-all">
<?php
include 'PublicBeerPanel.php';
?>
</div>

<!-- Load scripts after the body, so they don't block rendering of the page -->
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/spin.js"></script>
<script type="text/javascript" src="js/dygraph-combined.js"></script>
<script type="text/javascript">
// pass parameters to JavaScript
window.tempFormat = <?php echo "'$tempFormat'" ?>;
window.beerName = <?php echo "\"$beerName\""?>;
window.profileName = <?php echo "\"$profileName\""?>;
window.dateTimeFormat = <?php echo "\"$dateTimeFormat\""?>;
window.dateTimeFormatDisplay = <?php echo "\"$dateTimeFormatDisplay\""?>;
</script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/device-config.js"></script>
<script type="text/javascript" src="js/control-panel.js"></script>
<script type="text/javascript" src="js/maintenance-panel.js"></script>
<script type="text/javascript" src="js/beer-chart.js"></script>
<script type="text/javascript" src="js/profile-table.js"></script>
</body>
</html>

<?php
function prepareJSON($input) {
//This will convert ASCII/ISO-8859-1 to UTF-8.
//Be careful with the third parameter (encoding detect list), because
//if set wrong, some input encodings will get garbled (including UTF-8!)
$input = mb_convert_encoding($input, 'UTF-8', 'ASCII,UTF-8,ISO-8859-1');

//Remove UTF-8 BOM if present, json_decode() does not like it.
if(substr($input, 0, 3) == pack("CCC", 0xEF, 0xBB, 0xBF)) $input = substr($input, 3);

return $input;
}
?>

Next create a new file called PublicBeerPanel.php with these contents
<?php
/* Copyright 2012 BrewPi/Elco Jacobs.
* This file is part of BrewPi.

* BrewPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* BrewPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with BrewPi. If not, see <http://www.gnu.org/licenses/>.
*/
?>

<div id="top-bar" class="ui-widget ui-widget-header ui-corner-all">
<div id="lcd" class="lcddisplay"><span class="lcd-text">
<span class="lcd-line" id="lcd-line-0">Live LCD waiting</span>
<span class="lcd-line" id="lcd-line-1">for update from</span>
<span class="lcd-line" id="lcd-line-2">script...</span>
<span class="lcd-line" id="lcd-line-3"></span>
</div>
<div id="logo-container">
<img src="brewpi_logo.png">
<div id=beer-name-container>
<span>Fermenting: </span><?php echo $beerName;?></a>
<span class="data-logging-state"></span>
</div>
</div>


</div>
<div class="chart-container">
<div id="curr-beer-chart-label" class="beer-chart-label"></div>
<div id="curr-beer-chart" class="beer-chart" style="width:815px; height:390px"></div>
<div id="curr-beer-chart-controls" class="beer-chart-controls" style="display: none">
<div id="curr-beer-chart-buttons" class="beer-chart-buttons">
<div class="beer-chart-legend-row">
<button class="refresh-curr-beer-chart" title="Refresh"></button>
<div class="beer-chart-legend-label">Refresh Chart</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row last">
<button class="chart-help" title="Help"></button>
<div class="beer-chart-legend-label">Help</div>
<br class="crystal" />
</div>
</div>
<div id="curr-beer-chart-legend" class="beer-chart-legend">
<div class="beer-chart-legend-row time">
<div class="beer-chart-legend-time">Date/Time</div>
</div>
<div class="beer-chart-legend-row beerTemp">
<div class="toggle beerTemp" onClick="toggleLine(this)"></div>
<div class="beer-chart-legend-label" onClick="toggleLine(this)">Beer Temp</div>
<div class="beer-chart-legend-value">--</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row beerSet">
<div class="toggle beerSet" onClick="toggleLine(this)"></div>
<div class="beer-chart-legend-label" onClick="toggleLine(this)">Beer Setting</div>
<div class="beer-chart-legend-value">--</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row fridgeTemp">
<div class="toggle fridgeTemp" onClick="toggleLine(this)"></div>
<div class="beer-chart-legend-label" onClick="toggleLine(this)">Fridge Temp</div>
<div class="beer-chart-legend-value">--</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row fridgeSet">
<div class="toggle fridgeSet" onClick="toggleLine(this)"></div>
<div class="beer-chart-legend-label" onClick="toggleLine(this)">Fridge Setting</div>
<div class="beer-chart-legend-value">--</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row roomTemp">
<div class="toggle roomTemp" onClick="toggleLine(this)"></div>
<div class="beer-chart-legend-label" onClick="toggleLine(this)">Room Temp</div>
<div class="beer-chart-legend-value">--</div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row state">
<div class="state-indicator"></div>
<div class="beer-chart-legend-label"></div>
<br class="crystal" />
</div>
<div class="beer-chart-legend-row annotation last">
<div class="toggleAnnotations dygraphDefaultAnnotation" onClick="toggleAnnotations(this)">A</div>
<div class="beer-chart-legend-label" onClick="toggleAnnotations(this)">Annotations</div>
<br class="crystal" />
</div>
</div>
</div>
</div>
<div id="chart-help-popup" title="Beer graph help" style="display: none">
<p>This chart displays all temperatures and state information logged by BrewPi.
Not all temperatures are shown by default, but you can toggle them with the colored dots.</p>
<p>Click and drag left or right to zoom horizontally, click and drag up or down to zoom vertically. Double click to zoom out.
When zoomed in, you can hold shift to pan around. On your phone or tablet you can just pinch to zoom.</p>
<p>The state information is shown as colored bars at the bottom of the graph, explanation below.</p>
<div class="state-info"><span class="state-color state-idle"></span><span class="state-name">Idle</span>
<span class="state-explanation">
No actuator is active.
</span>
</div>
<div class="state-info">
<span class="state-color state-cooling"></span><span class="state-name">Cooling</span>
<span class="state-explanation">
The fridge is cooling!
</span>
</div>
<div class="state-info"><span class="state-color state-heating"></span><span class="state-name">Heating</span>
<span class="state-explanation">
The heater is heating!
</span>
</div>
<div class="state-info"><span class="state-color state-waiting-to-cool"></span><span class="state-name">Waiting to cool</span>
<span class="state-explanation">
The fridge is waiting to start cooling. It has to wait because BrewPi has just cooled or heated. There is a a minimum time for between cool cycles and a minimum time for switching from heating to cooling.
</span>
</div>
<div class="state-info"><span class="state-color state-waiting-to-heat"></span><span class="state-name">Waiting to heat</span>
<span class="state-explanation">
Idem for heating. There is a a minimum time for between heat cycles and a minimum time for switching from cooling to heating.
</span>
</div>
<div class="state-info"><span class="state-color state-cooling-min-time"></span><span class="state-name">Cooling minimum time</span>
<span class="state-explanation">
There is a minimum on time for each cool cycle. When the fridge hits target but has not cooled the minimum time, it will continue cooling until the minimum time has passed.
</span>
</div>
<div class="state-info"><span class="state-color state-heating-min-time"></span><span class="state-name">Heating minimum time</span>
<span class="state-explanation">
There is a minimum on time for each heat cycle too. When the fridge hits target but has not heated the minimum time, it will continue heating until the minimum time has passed.
</span>
</div>
<div class="state-info"><span class="state-color state-waiting-peak"></span><span class="state-name">Waiting for peak detect</span>
<span class="state-explanation">
BrewPi estimates fridge temperature overshoot to be able to turn off the actuators early. To adjust the estimators, it has to detect the peaks in fridge temperature.
When BrewPi would be allowed to heat/cool by the time limits but no peak has been detected yet for previous cycle, it waits in this state for a peak.
</span>
</div>
</div>

I dont recommend typing these out obviously, use Putty and some form of SCP file transfer to make the files on your Windows/MAC and then SCP file copy them to the BrewPi.
An example using pscp.exe from Putty

pscp -v c:\temp\PublicBeerPanel.php brewpi@brewpi:/var/www/PublicBeerPanel.php
This will copy the file from your C:\Temp folder to the brewpi at /var/www, and will ask you for your debian brewpi user account password.
 
Wait, I lied it looks to be asking for a password for anyone wanting to access it even though it is pointed to the public.php.
 
Trend Micro's reaction would indicate that your URL is "dangerous". Was that link meant to be live?

Todd
 
Status
Not open for further replies.
Back
Top