Brewing Controller User Interface |
I have been a “home brewer” in the electronic hobbyist sense
for decades, but I am also a “home brewer” of beer. I mentioned this in my post on Reading Temperature With Thermistors.
I now use digital temperature sensors (typically the
DS18B20) read over an I2C bus. Adafruit
has a good tutorial on how this is done located at http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/overview
It is fairly common to control a refrigerator and heater to
keep a constant (or slowly changing) temperature during the fermenting process,
especially with lagers. I have done this
using the Raspberry Pi, thermistors, and an A/D convertor. Now, I decided to get a lot more ambitious.
I won’t go into all the details of the brewing process since there are many resources on the web to provide that. For a quick look at this process, see the article on my photo blog. I wanted to be able to control at least the following items for one of the simpler methods of brewing (called partial mash.)
- Valve to a tank of propane
- Grill ignitor to light the burner
- Sensor to detect if the burner actually did light
- Temperature sensor for the wort (the brew of water, malt extract, and hops)
- Pump for circulating water through the wort chiller
What I needed to do this:
- A relay to output 12V to control the propane valve
- Another relay to output much higher amperage of 12V to run the pump
- A relay connected in place of the button on the grill ignitor
- A connection for one or more DS18B20 temperature sensors
The hardware is described below. I also wrote software for the Raspberry Pi (in C, my language of choice) to manage this hardware and the brewing logic. C# .Net provides the user interface on a Windows laptop. That is the image at the top of this post. The laptop and the Pi communicate via socket calls over wifi.
There were three major problems that had to be overcome once I started testing. One is that I tried using a DS18B20 to detect the flame. Well, the maximum for that sensor is 125°C and I did not use a high temperature version. The flame is VERY hot (duh!) and the sensor eventually melted, shorting 5V to ground and shutting down the Pi. Fortunately it was not damaged. I doubt changing to a high temperature version will help, but I will try that next. Another option is to do what every furnace, stove, and hot water heater does for its pilot light – use a thermocouple to detect the heat. I may have to investigate this to see if I can devise a simple interface for one.
The second problem was that the wiring for the ignitor kept shorting out and creating a spark too far from the flame to light it. Additional insulation and a change in how it was mounted solved this problem.
The third problem was that the EMI created by the ignitor
caused massive interference on the I2C bus that made it unusable. This was corrected by re-wiring my
temperature probes with well shielded cables.
I used shielded audio cables commonly used for microphones. I am also a musician so I had
some of this already. If you have to buy
a small reel you may find that it is rather expensive. Cat-5 cable may also work well. That is what I use for my hot tub controller,
but it is not subjected to the massive EMI of this system.
I disabled the flame detection logic. This is a critical safety feature and must be corrected for this system to be trusted. However, this did allow me to successfully use this system to brew.
This is a good place to state that working with flammable gas and boiling liquids can be hazardous. I take no responsibility for your use of the advice provided in this post. BE CAREFUL! And drink responsibly.
Hardware
Control of all of the above components is pretty straight-forward. Search my blog or the web and you will find how to control relays. The Adafruit link above will show you how to connect the I2C temperature sensors.
I used audio connectors since they are cheap and readily available. ¼ inch mono for the relays and stereo for the I2C bus. Using an audio connector for the I2C bus gives the added benefit of being able to use pre-made splitters and extension cables and these tend to be well shielded and relatively inexpensive.
The 5V line from the GPIO connection is only used for the I2C bus. I already required 12V (which is actually 13.8V) for the valve and pump. However, the relays I used were controlled with 5V. This voltage does not need to be accurate, so I made a simple voltage divider using three 100Ω resistors. Two 100Ω resistors are used for R1 and one 100Ω resistor is used for R2. This divides the input voltage by 3 to provide 4.6V, which is adequate to control the relays.
The final interface box looks like this. The red and black power connector you see is
called an Anderson Power Pole. I chose to use this since I already have 12V supplies for my HAM radio
equipment. (I think maybe I have too
many hobbies.)
Modified Grill Ignitor |
The ignitor can be found in many hardware stores as a replacement for repairing gas grills. The cheaper versions of these use a spring and a piezoelectric voltage generator to create the spark. These are not suitable for this application. You must get the more expensive type that uses a battery. I removed the push button and made my own connection that runs to the relay in the interface box.
I still have a few kinks to work out in this system, but I am sure that this automation will make the process of brewing much easier and more consistent. This is definitely the most enjoyable project that I have done so far with the Raspberry Pi, and that is not just because I end up with great beer.
The system set up for brewing |
The temperature sensor is a water-proof high temperature DS18B20 covered in food grade shrink tubing. These are available at Adafruit.com
Here, the system is set up for chilling the wort.
The cooler has water and 10 pounds of ice cubes.
i've embarked on almost an identical journey with DS18B20 + spark ignition. all of my stuff is attached to an arduino+lcd until i get the electrical bugs & cabling worked out. i'll eventually upgrade to an arduino + RasPi combo where the Arduino does all of the data acquisition/control and the RasPi takes care of the user interface and data logging.
ReplyDeleteon my first iteration i used the exact same AA-powered spark ignitor. I used thermocouple + instrumentation amplifier for flame detection. I had the same EMI/EMC problems even with shielded cables and i hated the fact that i had to run an extra negative voltage supply rail for the instrumentation amp.
on the second iteration, i looked to the appliance industry for help. I found a tytronics re-ignition spark module with flame rectification (use those buzz words to find one) in a discarded gas stove. This unit will provide you a spark until it senses the presence of flame. It senses flame by passing some voltage through the flame (that's the flame rectification part).The beautiful part is that these units work on 120VAC, so they'll never touch the DC power your digital devices use. Hook them up to the same relay that your gas valve uses (well assuming your valve is 120VAC) and you're good to go. One unit will do multiple burners. I'm using a 4 burner unit on a two burner system.
Note that this unit just provides spark when flame is not present. it cannot shut off your gas valve. It isn't as intrinsically safe as other systems, but if reliably wired it will do the job.
http://www.amazon.com/Genuine-Viking-Pa020047-Invensys-Re-ignition/dp/B005SM9TI4
After installing this, i still had to do proper shielding/grounding, but the problems were much less pronounced. After i upgraded to shielded microphone connectors, all was easy sailing.
Thanks for the ideas. I still plan on using a thermocouple (already ordered it) and that should be trivial to amplify with a LM386 amplifier to a voltage level that I can use. I will have to add an A/D converter, which I have built before. I am thinking there will be a separate box for the thermocouple that connects to the Pi via SPI bus. I have some other ideas on how to reduce the EMI problems and will report on my results in a later post.
DeleteThis comment has been removed by the author.
ReplyDeletehttp://www.robotshop.com/en/dfrobot-flame-sensor.html
ReplyDeleteThanks for the suggestion. This is a very interesting sensor, especially because of the low price. Unfortunately this won't work any better than the sensor that I already tried using. The specification gives it's operating range as -40C to +85C. I need a sensor that can survive in very close proximity to a propane flame. (500C to 1000C) and the only thing I have found for that purpose is a JK thermocouple.
DeleteI believe the flame sensor could survive if mounted some distance from the flame, but it would probably give false positive readings due to the heated steel of the burner frame and the pot of boiling liquid.
Look up flame sensor rods. I think they work by passing a current from the burner to the sensor rod via the flame.
DeleteThose use a thermocouple to sense the flame. I did look in to using a replacement sensor rod for a furnace, but the price was higher that simply getting a generic type JK thermocouple, and the one I found allows me more flexibility in mounting it.
Deletehttp://www.faqs.org/patents/imgfull/20120288806_02
DeleteI'm seeing flame detector rods for less than $20.
DeleteDoes that include the detection circuit?
DeleteIn any case, I think you've gotten your point across.
I will check them out and if they work any better or easier than a thermocouple I will include them in the follow up post that I will do in a few months. There are other minor issues in the hardware to work out and a lot more to improve in the software,
It seems like http://www.robotshop.com/en/dfrobot-flame-sensor.html posted above would work as long is you didn't mount it directly in the flame. The sensor is designed to direct a robot towards flame, so presumably it could be some distance from the actual flame. You could probably find a suitable nearby location (like the burner leg) to mount it on.
DeleteTed,
ReplyDeleteCongrats... I see you finally made the "Cover of the Rolling Stone", at least as far as the Raspberry Pi world is concerned.
Yeh. Front and center on raspberrypi.org
DeleteGuess I'm done here now. :)
My stats went from a typical 500 to 600 views per day to over 2600 yesterday. Fortunately the comments have been pretty easy to keep up with. And very informational. I have at least three good ideas on how to detect a flame. I may have to try them all just to be able to report on them.
DeleteCouldn't you coil a copper wire around the sensor and run the end of it over to the flame and measure the lesser increase in temp but a guaranteed increase if the flame is heating the end of the wire in a flame?
ReplyDeleteThe response time would be too slow. I need to know if the flame is on within a second or so and then cut the gas off if not.
DeleteWhy not use an LDR to see if the flame is working?
ReplyDeleteI assume you mean a Light Dependent Resistor. That may work, but the flame would need to be noticeably brighter than the ambient light and I would rather not work in the dark.
DeleteWhat did you use for the electronic valve control on the propane?
ReplyDeleteYes. This is used to turn the propane flow on/off
DeleteI think he meant which one did you use. I would also be interested in this since there is little information on that part of the project. Do you have more detailed walkthrough on how to control the actual valve with the relay?
DeleteI used this one
Deletehttp://www.ebay.com/itm/1-4-Inch-Normally-Closed-Pneumatic-Aluminum-Electric-Solenoid-Air-Valve-110V-AC-/121007662356
It is not rated for flammable gas since it does not have a system to close the valve is the flame is lost. However, I add that elsewhere in the system.
Controlling it is straight-forward. This blog (and many other places) show how to control a relay. Use the relay to control 12V power to the valve. With power on it opens. With power off it closes.
Awesome thanks for the references!
DeleteA safer way to control the propane gas is using a controller and the rpi to a relay to put the gas on, via the controller, its only 18 usd and more professional
ReplyDeletehttp://www.aliexpress.com/item/110V-transformer-high-voltage-output-transformer-gas-ignition-controller-pulse-igniting-device-for-burner-oven-grill/1557286713.html
You may want to check that again. It is $180. That is an order of magnitude more than I paid for the entire system.
DeleteAnyway, I see no advantage to this over what I am doing already. All of the logic built into this device is already handled in software on the Pi on my setup.
that's $180 for a lot of 10 - $18 each.
DeleteOkay let me explain it another way : you can't use a RPI or even a PLC to implement safety features as flame detection and personal protection, just read basic machine safety guidelines they are not invented for nothing....
ReplyDeleteI use a RPi and PLC for controlling coffee roasting machines, yes also use LPG gas, All safety features are implemented in hardware (not RPI ) independent from software or the plc, you can use a fail safe contact of a plc or rpi in the emergency stop loop for additional safety.
You can also use a big size rice cooker >= 25Liter and a temperature controller with thermocouple + a relay to switch the rice cooker on and off.
example a toky ai808 controller has pid, and 50 programmable times and temperatures ,plus communication to the rpi for data logging and or setpoint adjustments
Safety First
I don't disagree - there is certainly a safety issue here. This type system should use a proper flammable gas valve - the type that has a built in thermocouple interface to detect flame and shut the valve off if not detected.
DeleteSince I am aware of this issue, I do not use the system unattended. If I am present during operation then I can intervene when things don't work, and in fact I have had to do this a couple of times. Operated in this manner it is only nominally more dangerous that total manual operation.
The only real advantage this automation gives me is preventing over heating (or cooling) of the wort and more consistent temperature holding. I don't have to constantly watch a hard to read thermometer.
as your setpoint is only 70'c its easier to control with an electric heating element but not directly in the worth but use a kind of water bath (or get another pan as in the picture ,and put the worth pan inside it, put 5cm water in the plus the heating element 700w...1000w
ReplyDeleteby this way the heat from the hot water is spread evenly.
I suppose your goal is making a nice beer yourself for hobby , so why not invest a little more for a good industrial grade temperature controller (25...30 usd)(ebay) it saves much headache , it will not burn down your house....and so on, and it will look good too
Use the RPI for logging and web interface, if you want i have written a modbus program for the RPI in python and use a usb to rs485 converter to connect the RPi to the controller, so you can change setpoints via the rpi and log the curve whatever you want
The final result is pure happiness, your self brewed beer, small scale ,but in a quite professional way. It taste better when it all looks good.
Another advance is you can use the same controller setup to distillate....to give you some ideas :)
There are actually several set points including the need for a full boil and an ice water chill to return it to room temperature quickly. Your suggested method would take several times longer than my current system. There is a good reason that I use propane instead of electric - I can get 15000 BTUs (about 4400 Watts) of heat. This is far more than I can get from typical electric burners.
DeleteAnd the judges scoring my beer don't care what my setup looks like. All they see are unmarked bottles with an entry number on it.
Just drop me a note when you're ready for an upgrade, in the meanwhile please be careful , for yourself and others around you.
ReplyDeleteMy experience with the RPi is that it often freezes after/during the ignition of the flame even when using optocouplers ,filters and shielding.
Hi congrats for the idea and all that you accomplished. Did you think in making the system all eletric?
ReplyDeleteI´m starting now doing something very similar, but all electric. Using a AC-DC SSR to load the heather. In theory would work flawless. I´m very concerned about the amount of energy drawn from RPI during SSR ignition if you know what I mean.
Anyway, i just bookmarked your blog for future references. Thanks and keep up RPI brewing!!!
An SSR typically draws very little current. That is one of the benefits of using an SSR. However, I would still recommend powering the relay from an external power source and controlling that with a relay. See one of my earliest post for instructions on how to do that.
DeleteI never considered using an electric heater because I already have a propane heater and need to keep the cost down. Another consideration with an electric heater is how much heat it provides. The ones I have seen are 1000 to 2000 watts. Propane burners can easily get up in to the hundreds of thousands of watts. You can expect to spend a very long time (close to an hour) getting a couple of gallons to boil with only 1000 watts.
I would like to do this with a RIMS tube.
ReplyDeleteTed, check out this igniter. http://www.amazon.com/gp/product/B00BTLLJ40?psc=1&redirect=true&ref_=oh_aui_detailpage_o08_s00
ReplyDeleteIt is 110 but uses very little amps. I am planning on creating a very similar project. Would be willing to share you current build code?
Thanks for the heads up. I have ordered one for a new project I am doing.
DeleteI will put my code on github if I ever get the time.
I second that! As a fellow homebrewer, this looks awesome! Unfortunately, I know nothing about C, so I would be interested in your code. Do you know if it would work the same on a Raspberry Pi 3? I know those are relatively new...but that's the one I'm hoping to buy. Thanks!
DeleteIt would run the same on a Pi v3.
DeleteWould you be able to post your code? I'm interested in setting up an automated system.
Delete