Wednesday, April 16, 2014

DIY BrewPi Fermentation Controller Cheap

So, i will start this post by saying Elco and _mdma are amazing at what they have created with BrewPi and continue to develop for free.  Brewers are great in that they share nearly everything, and they are no different.

This post is in no means being created in an effort to hurt their sales at their BrewPi store(http://www.brewpi.com) and the PCB's they have created, if your willing to spend the extra $$ you can get most of the hard circuitry done for you.  But all of this as you know comes with a price, and a prebuilt BrewPi from them can cost a good amount of money.

This is a post for how to piece together a basic relay driven circuit  using an Arduino  and a RPi for about $100 in such a way that it will interface with the amazing BrewPi software running on a RaspPi that gives you graphs like this




And to give you the precision of this because of its advanced dynamic PID algorithms, you can see over the 4 hours of this sample brew with the set point at 65F my temperature rarely moved .1F off of the set point.

Or this zoomed in snippet of the same brew during nearly 24 hours of constant temperature ramping, again almost rarely reaching .1F over its set point, in most cases its .05F-.07F.  Ignore the front panel showing 65.05C, its because they are Euro :tank: and BrewPi defaults to C, but i have it swapped to Fahrenheit in the settings but there are a few GUI bugs like that still that dont swap properly...no biggie doesnt effect the operation.


And hopefully for only about $100, or less depending on which route you take which will be explained below.  This assumes you have the basics, like a soldering iron and some way to strip wires.

So lets get a list of things that are needed

PARTS

Arduino Uno - $18

http://www.amazon.com/SainSmart-ATmega328P-Development-Compatible-Arduino/dp/B00E5WJSHK/ref=sr_1_8?ie=UTF8&qid=1395333930&sr=8-8&keywords=Arduino+Uno
  • Can get a Sainsmart Arduino Uno on amazon for $13, cheapest I have found it not buying a knockoff from China.

Webserver Host (PICK ONE)

RaspPi - $70



Any PC with USB


  • This is where you can save a ton of money, if you are like me and have any old spare PC’s laying around with old drives, you can install Debian Wheezy on it, Unix based OS's are great because they can run on the crappiest of PC's.  Doing this route makes the software installs a bit more manual but  its all very well documented line by line on the BrewPi Wiki. Instructions here 
  • http://docs.brewpi.com/manual-brewpi-install/manual-brewpi-install.html

SainSmart 2 Channel Relay Board - $10


DS18B20 Sensors x2


  • There are a lot of options here, you can buy pre-made ones, something like this http://www.ebay.com/itm/1pc-Waterproof-DS18B20-Temperature-Temp-Sensor-Digital-Thermal-Probe-for-Arduino-/331111738688?pt=LH_DefaultDomain_0&hash=item4d17cc2d40
  • Just make sure if you get premade sensors that any sheathing is not greater than .305 inches or it wont fit in the listed thermowell.
  • Or you can buy just the sensors themselves and wire make cables yourself, you can get 4 wire cable by the foot at Lowes/HD for like 44c per foot.  If you think 1 Meter of cable is long enough for your implementation then the above are good...if you need a long run you may want to make your own..or splice some longer cable onto the premade ones…I think you can get 10 DS18B20 sensors on Amazon for about 8 bucks. Hooking them up is straight forward just follow the schematic.

Thermowell (OPTIONAL BUT RECOMMENDED) - $12


  • Brewers Hardware sells these that i use, the width is wide enough to fit the premade sensors down.  You also need to figure out a way to get said thermowell in your fermenter.  For me using a bucket, i simply drilled another hole in my lid, bought another cheap rubber stopper with a hole drilled in it to fit that hole and the thermowell fits very snuggly in a standard drilled stopper.
  • You can alternatively just insulate it properly on the side of the fermenter, although this can give you more wild temperature swings and result in your cooling and heating coming on more often.

Power socket - $5?


  • Any 10-15A socket from HD/Lowes should work

Power cord 


  • The easiest thing to do is to harvest a PC power cord and cut off the power supply end and keep the socket plug in end.  Many people have boat loads of these laying around, the nice thing is you can harvest the cut end for good 14-16 gauge  wire to use for this project.  If you must, buy the shortest and cheapest 16 gauge extension cord you can find.  You may be able to find something to harvest at a store like GoodWill/Salvation army, they usually have piles of cables near their electronics for a few dollars each.  In the case of PC power cords you can cut the power supply end off, then cut some 6-12 inch sections off  as needed and pull the individual White/Green/Black cables out of the outer black sheathing.  These make great connections for the Relay side going to the Wall socket, which should use 14-16 gauge wire to be safe.  Use thinner wire if possible for the arduino connections, it will make it easier to solder onto the pads...or if you want you can  always use header pins and just plug directly into the arduino from the top.

Assorted bag of Twist on Wire nut style connectors


  • These can be used to make the connections more quickly and easy, optionally instead of using these you could twist the wires in the diagram together and solder them, but this makes it harder to disassemble if you hook something up wrong.


SCHEMATIC

This is a very basic sketch i threw together with my amazing MS Paint skills.  The circles are the wire nuts.

You can view the larger image here
https://dl.dropboxusercontent.com/u/2798684/BrewPiArduinoCircuit.jpg

The wiring isn’t actually all that difficult and can be banged out in an hour or so once you have all of your wires cut and ready, i will note that you are playing with 120V mains voltage coming from your wall.  Be extremely careful when handling this when plugged in, always ensure that there is no power being supplied from the Arduino and the 120V plug hooked up to the SSR is not plugged in when  you are messing with the wiring.

I will note that the Sainsmart relay board comes with stupid male pins for the inputs instead of female to use easy jumper cables.  Because of this I and many others just pull the header pins out and solder wires to the pads or through the connector.

Installation


  • Hook Up Arduino to RPi via USB
  • Once you have the Arduino wired up properly to the relay board and Sensors, hook it up via USB to the RPi.
  • Install Raspian Wheezy - 
  • If you  bought the Canakit listed above, simply plug it into a monitor via HDMI and usb keyboard in with the MicroSD card in it...when it boots it will ask you what OS to install, select Raspian and leave it...it takes a while to install.
  • If you didnt have the NoobSD card, install Raspbian Wheezy onto a MicroSD card following the Raspbian instructions.
  • If you are using a PC instead of an RPI, use the install Debian Wheezy on the hard drive(Dont use a Live DVD)

Install BrewPi



Update Arduino’s image


  • This may or may not be different now, i have not done a fresh install in quite a while.  It seems like now when you run an Install that one of the steps is to program automatically flash your Arduino via the above Install script.  You want the Uno RevC image.
  • If it does not pop up asking you this during the install then use the following instructions to upload the appropriate image to the Arduino, you want to save the brewpi-uno-revc.hex image to your local machine by right clicking on it and saving it to a file.  You then go to your BrewPi interface at [url]http://brewpi/[/url] on your local network(or goto the IP address of your RPI) You will then use that file in these instructions http://docs.brewpi.com/after-install/program-arduino.html

Setup Devices


  • We are almost there! You should have have a brewpi web interface if you open up a web browser and go to http://brewpi
  • The final step is to tell it about your sensors, this is where you will find out if something is not wired properly in your Arduino circuit.
  • First check the top right, it should say that the Script is running.  If it is not, try clicking the button the start the script and wait 30 seconds to see if it starts.  If it still wont work, this means the script on your Arduino is not properly running and you may need to try reflashing it with the image, you cant set the settings below until  it shows the Script is running.
  • Under the Maintenence Panel, select Device Configuration
  • Check Read Values, and press the Refresh Select Device button
  • When you do so a big list of devices will show up under Detected Devices.  Scroll through the list and you should see TWO that are detected as a Temp Sensor with a value(probably in Celcius).  If you do NOT see two sensors reporting back a temperature, check your circuitry.
  • When both are detected,  set each one to Chamber 1 and Beer 1, and hit apply, you need to determine which sensor your going to use for which temperature and set the Function dropdown accordingly to either Chamber Temp(sensor that just sits in your thermal chamber), or Beer  Temp(the one that is on the side of your fermenter or in a thermowell), we dont care about the Room temperature.  Be sure to hit Apply for each device  after you’ve set them up properly.
  • You should also have two  device types of “Switch Actuator”, one on Arduino Pin 5(Act2) and one on Arduino Pin 6(Act 1).  
  • Set them to Chamber 1, and Chamber Device(not Beer 1) 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.
  • Your now done!



After that, you should have a functioning BrewPi, take whatever steps you want to make it pretty by putting it in a box to protect the electronics.  I recommend testing it and your  electrical socket wiring with a fan or light of some sort and watch the BrewPi interface to see if it thinks it is heating or cooling or idle, and that it is indeed doing that by powering the appropriate outlet or none(idle).

The brewpi LCD interface in the top left by default updates every 10s, you can press the refresh graph button to update the graph, or just reload the page.

Lets keep the banter about doing everything on a RPi to a minimum, there are reasons that they have chosen to go this route, mostly due to the innate stability of the Arduino, and the general unstability of Raspbian and the RPi.  If the RPi was to crash, the Arduino would still has everything it needs to maintain its temperature until you fix the problem. But a micro controller like the Arduino crashing is generally unheard of, although i guess in theory it could happen it should reset itself.  And honestly the Arduino Uno at this point is so cheap it doesnt matter if you did it strictly on a RPI, your not  really saving much money.

Lastly if you made it this far you can take a look at my BrewPi graph and play with it, i altered the page so that the settings are all gone so people cant mess with my ferm chamber, but you can still see the graph and play with  it if you want.  You can turn on and off the various graphs on the right, zoom in time or temperature, etc.
http://fuzzelogicbrewing.dyndns-server.com/FuzzeLogicBrewery.php

Finally there is a post on HomeBrewTalk where there are plenty of users creating this that can help troubleshoot issues along with myself if you have issues!
http://www.homebrewtalk.com/f51/howto-make-brewpi-fermentation-controller-cheap-466106/

No comments:

Post a Comment