Any interest in starting new open source automated brewing project...for propane?

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.

Does this seem like a good idea?

  • Yes, this sounds awesome!

  • No, this sounds idiotic!

  • You'll shoot your eye out, kid!!!


Results are only viewable after voting.
I got a chance to work on the integration of the sensor/pid/servo last night, and it seems to be working. It's very basic - just moving the servo and writing some output to the serial monitor, but it's there.
Next step is to start working on the physical aspects (sensor waterproofing, mounting the servo), then begin working on the code to write a real 'program' for one pot. Once the single pot heating system works, it can be made into a real program for controlling heating,mashing, sparging, and boiling.
What fun!:rockin:
 
So... it seems there's some more servo weirdness going on. The servo seems to respond to write microseconds or angle, but it's not repeatable once attached to the regulator knob. On opening of the servo case it seems teh board is actually a hitec Hs755HB. So, i'm just not sure what the heck is going on. Will continue dismantling the servo and figure out how to work with it. I don't even know if position of continuous rotation servos CAN be controlled.
There do seem to be lots of other options regarding sail winch servos, though. http://www.hobbyking.com/hobbyking/store/__285__254__Boats_Parts-Sail_Boats.html
 
So... it seems there's some more servo weirdness going on. The servo seems to respond to write microseconds or angle, but it's not repeatable once attached to the regulator knob. On opening of the servo case it seems teh board is actually a hitec Hs755HB. So, i'm just not sure what the heck is going on. Will continue dismantling the servo and figure out how to work with it. I don't even know if position of continuous rotation servos CAN be controlled.
There do seem to be lots of other options regarding sail winch servos, though. http://www.hobbyking.com/hobbyking/store/__285__254__Boats_Parts-Sail_Boats.html

How are you powering the servo? I think that some of the bigger servo's require a bit of power to function properly. It seems strange that the board is labeled Hs755HB. Good luck.
 
Well the servo is fixed, and attached to the regulator (of somewhat haphazardly). Initial tests show the servo responding to the pid input pretty well. Once I have the temperature probe made (I don't have any thin enough wire) I can start tuning the pid parameters. :)
 
ASCO has proportional servo valves that might fit the bill for this sort of approach.

http://www.ascovalve.com/Applications/Products/ProportionalControl.aspx

These are pricey (about $250 for a 1/4" valve), but they are designed to have an output gas flow proportional to the current sent to the coil. This is simply achieved by a spring in the valve that opposes the force applied by the current moving through the solenoid. In theory, this could work with any solenoid. As the coil heats due to current, this will impact the flow, and they sell an electronic control module for the valve to compensate for this ($350!). But, you could probably control for this in the Arduino, etc.

I do like your idea for this, as it uses a purpose-built LP regulator to control gas flow. Unfortunately, this is not going to work for NG which is the direction I'd like to go.

There are some serious safety considerations with respect to LP though. These include making sure that a pilot is always burning (a thermocouple heated by the pilot) to ensure that the valve only opens when there is a flame). I would suggest also including a safety shutoff valve in line downstream of the regulator to shut this all off in an emergency. LP is heavier than air, so any leaks lead to pooling of a highly explosive gas that is not as likely to dissipate as NG.
 
Calibrating the DIY servo valve for proportionality is going to be a tricky proposition. Errors are going to accumulate in the I term so PI control might be a bit hit and miss.

Maybe it is not entirely necessary though. With a few valve settings (e.g full blast, halfway, low, off) you could probably come up with a simple rule-base system that approximates Proportional control. After a few runs you would probably have a good idea of the tweaks needed to avoid undershoot etc.
 
Calibrating the DIY servo valve for proportionality is going to be a tricky proposition. Errors are going to accumulate in the I term so PI control might be a bit hit and miss.

Maybe it is not entirely necessary though. With a few valve settings (e.g full blast, halfway, low, off) you could probably come up with a simple rule-base system that approximates Proportional control. After a few runs you would probably have a good idea of the tweaks needed to avoid undershoot etc.

I agree that valve linearity will probably be an issue. I can tell that my valve is not very linear. I am going to have to do some testing before I know how I’m going to use the servo in my setup. I might try to linearize the output to the valve by recording the temperature response at various valve positions. I might still use PWM at fixed valve positions which would allow me to increase the flame while I heat for boil and dial it back at boil. I’ll have to play with it a bit to see how I can get the best response.
 
Calibrating the DIY servo valve for proportionality is going to be a tricky proposition. Errors are going to accumulate in the I term so PI control might be a bit hit and miss.

Maybe it is not entirely necessary though. With a few valve settings (e.g full blast, halfway, low, off) you could probably come up with a simple rule-base system that approximates Proportional control. After a few runs you would probably have a good idea of the tweaks needed to avoid undershoot etc.
It seems that PID control should account for some non-linearity. If temp << setpoint, go to high; as temp < setpoint, a bit less; temp ~ setpoint, very low; temp>setpoint, off

That could be replicated pretty easily in code, but there's already a handy PID library, so why reinvent the wheel? :)
 
Fuzzy logic algorithms also exist, and don't need to be invented. :)

If you don't think your valve needs calibrating then don't do it and see how you get on. I think you will be flying blind - without a basic idea of how your system is responding you won't have a good idea how to tune the controller.
 
So, v0.1 is done :)
At least all the components are there. It still needs a lot of tuning, I'm sure.

I shot a quick video of the system, though I could only get it at full tilt, since my phone crashed (twice) while the system was reducing or increasing the heat :/
[ame="http://youtu.be/Q8s6Ya5z6Ro"]http://youtu.be/Q8s6Ya5z6Ro[/ame]

I does work, but it definitely needs some tuning. I've tweaked the auto-tune example, but I didn't have time this weekend to run a full tuning.

It's not truly 'automated' yet, because the Brinkmann fryer I'm using has a gas shut off (safety!), so that when the flame dies, it cuts gas flow. Which means that when the temp should be going up, I have to be there to hold the shutoff switch and re-light the flame. When I add a pilot, that feature can be removed.

2013-02-18 14.42.13.jpg


2013-02-18 14.42.21.jpg


2013-02-18 14.42.26.jpg


2013-02-18 14.42.35.jpg
 
I like that you have the servo a long way from the burner. Less chance of overheating.
As much trouble as that d*&N thing has been, I didn't want to risk melting it :D

Also my dad ( a petrochemist) scared the hell out of me regarding the flamability of propane, so I'm trying to keep everything as far apart as possible.
 
By the way did you power the servo off USB? Pretty brave if you did. I have knackered 4 out of 6 USB ports on my laptop doing things like that.
 
Nice work! Thanks for sharing. I agree with alien about powering your servo. I believe that your servo can eat up upwards of an amp while under load. I wouldn't want my laptop's USB to see that sort of load.
 
By the way did you power the servo off USB? Pretty brave if you did. I have knackered 4 out of 6 USB ports on my laptop doing things like that.

One of the joys of Mac. It kills the power to the usb if the plug is drawing too much current. They're also built for pretty high current, to charge those power hungry iphones. This definitely needs a better power source, but... I'm lazy. Or, more to the point, I spent too much time rebuilding my servo, wiring and rewiring the temperature sensors.
 
In theory you can't rely on USB ports providing more than 500 mA (although that doesn't mean that more is not possible).

It probably means your servo is having no particular difficulty turning the valve, which is good to know.

The usual thing would be to supply a separate 5V for the servo and join the ground to the Arduino. I'm sure you know that though.
 
Very cool! I would love to see the action of the servo when the temp gets close to the set-point. I still don't get how you interfaced the servo with the Arduino. I understand how a standard RC servo is controlled with the Arduino library, but your situation is different because you are doing several turns (if I understand this correctly). My understanding of the servo library is that you output a particular angle to the servo and the servo changes position of the control horn to that defined position. With the 3.5 turn servo you are using, how do you define the position of the servo? Do you simply scale the 0-180 range to 0-100% and use the output from the PID loop to control the servo? I'd love to see your implementation in code.
 
Very cool! I would love to see the action of the servo when the temp gets close to the set-point. I still don't get how you interfaced the servo with the Arduino. I understand how a standard RC servo is controlled with the Arduino library, but your situation is different because you are doing several turns (if I understand this correctly). My understanding of the servo library is that you output a particular angle to the servo and the servo changes position of the control horn to that defined position. With the 3.5 turn servo you are using, how do you define the position of the servo? Do you simply scale the 0-180 range to 0-100% and use the output from the PID loop to control the servo? I'd love to see your implementation in code.

Thanks,
I was thinking of posting my code someplace (git or google code, I suppose). Ideally, I'd like people smarter than I to contribute to the code, so I guess Git is the way to go.

The servo works like any other servo, but 0-180 is multiplied. So if a normal servo turns 1/2 turn with from 0-180 then mine rotates nearly 10 turns. So if going from 10-20 on a normal servo moves 10 degrees of rotation, my servo moves 200 degrees! As a result I use writeMicroseconds() which tells the arduino how long the PWM pulse should be, then sends that to the servo. That gives me a range of 1000-2000 give or take, which enables me to more finely control the servo's angle.
 
Thanks,
I was thinking of posting my code someplace (git or google code, I suppose). Ideally, I'd like people smarter than I to contribute to the code, so I guess Git is the way to go.

The servo works like any other servo, but 0-180 is multiplied. So if a normal servo turns 1/2 turn with from 0-180 then mine rotates nearly 10 turns. So if going from 10-20 on a normal servo moves 10 degrees of rotation, my servo moves 200 degrees! As a result I use writeMicroseconds() which tells the arduino how long the PWM pulse should be, then sends that to the servo. That gives me a range of 1000-2000 give or take, which enables me to more finely control the servo's angle.

Ah, so you are including servo.h, but using the writeMicroseconds() function to control the pulse width instead of the Write() function. Seems simple enough, though this would likely be different depending on the servo used.

As for the linearity issue, I can see how this could cause some significant problems with the PID loop. For example, if the PID sends a 0-100% signal to control the input heat, and the servo controlled regulator does not map to this proportionally, I can see overshoot problems. An example: as the temperature approaches the setpoint, the PID calls for 10% heat. This is mapped to 10% of full open on the regulator valve. But this results in say 50% output from the burner, and thus the temperature overshoots the setpoint. Obviously, your setup may give different results, but the point is still that the PID loop will not be able to accurately control the burner, especially given the high thermal capacitance of the system. In this case, wouldn't the system merely act as a full on, full off control (e.g. like a solenoid valve)?

It should be possible to account for this non-linearity by experimentally determining the burner output for a given servo position, and then use this data to map the PID output to the servo. It might be necessary to use a lookup table, or some sort of line fitting function. I'll be curious to see how you deal with this issue.
 
Thanks for the update… My built is moving along fairly slowly. I’ve gathered most of the equipment, and started programming, but I’ve got a lot more programming and assembly before I can test it out. I’m using a Raspberry Pi with a web interface instead of an Arduino, and a HiTec HS-645MG servo. The more I think about it, the more certain I become about needing to linearize the burner output. The proportional term of the PID should have the greatest influence on our system to minimize our response time. However, the burner output needs to be linear in order for the proportional term to work properly. The integral term should only be used to obtain our exact setpoint temperature. A larger integral term can compensate for small nonlinearities in our output, but at the expense of response time. I don’t think that the derivative term will be all that helpful, and should be used sparingly. Keep us posted on your PID tuning progress.
 
Ok homies, sorry it's been a while. I've been traveling for work, etc
Anyhoo, I've posted version 0.1 of the code to github.
https://github.com/jrubinstein/brew-PID-propane

I'd love to have feedback, collaboration, etc .

THANKS! :mug:

This looks really interesting! I would really be interested in seeing how the servo position correlates to heating. I guess this could be done by setting the servo to a few positions over time, allowing the system to reach a stable temperature, and then plotting servo position vs. temperature. For example, at 10% of servo throw, stable temp = 95F; servo throw at 75% stable temp = 200F, etc. Plus this into Excel to derive a line function (e.g. least squares; y=mx+b) and use this to scale the output of the PID. It would be interesting to see how the slope is affected by volume.
 
This looks really interesting! I would really be interested in seeing how the servo position correlates to heating. I guess this could be done by setting the servo to a few positions over time, allowing the system to reach a stable temperature, and then plotting servo position vs. temperature. For example, at 10% of servo throw, stable temp = 95F; servo throw at 75% stable temp = 200F, etc. Plus this into Excel to derive a line function (e.g. least squares; y=mx+b) and use this to scale the output of the PID. It would be interesting to see how the slope is affected by volume.

I am planning on plotting the temperature change with respect to time over several different servo positions. I will use the same volume of water on each test, and heat over the same temperature range. I will use these tests to determine the rate of change of the temperature at a particular temperature, say 120 deg F. The result of this can be used to linearize the burner's output by applying some sort of curve fitting equation or interpolation. Unfortunately, my rig is not going to be ready for quite a while, so I can't do any testing in the near future.
 
I am planning on plotting the temperature change with respect to time over several different servo positions. I will use the same volume of water on each test, and heat over the same temperature range. I will use these tests to determine the rate of change of the temperature at a particular temperature, say 120 deg F. The result of this can be used to linearize the burner's output by applying some sort of curve fitting equation or interpolation. Unfortunately, my rig is not going to be ready for quite a while, so I can't do any testing in the near future.

Well, do keep us posted. I am definitely curious to see how this will work out.
 
Just to keep folks updated, I am still working on the project, but I haven't had a lot of success tuning the PID. It turns out to be trickier than I first thought. I'm going to use a simple linear algorithm tomorrow or Sunday.

Of course if someone wants to help with PID tuning params, I'm all ears :)
 
One approach is to try P only, trim the gain until there is no overshoot, add I until there is no droop, and then add a little bit more P gain so you get just a tiny overshoot. PI and no D is conservative but it's a starting point.
 
Thanks alien. Any thoughts on reasonable starting points for kP ? I've tried 1, 100, then 1000 , with each worse than the last.
Another thought I had was to engage PID control only near the setpoint, so it doesn't over index on error early on in the cycle.
 
I have made a bit of progress with my rig over the last few months. In fact, I just did some PID tuning last weekend for the first time. I got it to oscillate at +-0.25 deg F of my setpoint with the following parameters: Kp = 30, Ki = 20, kd = 0.7 (my PID uses the independent gains calculation). However, the CV is changing way too much for my liking. Furthermore, it takes a while to settle down after I give it a good stir. I am planing on trying the Zeigler-Nichols closed loop relay tuning method this weekend (time permitting). I'll report back with my results if I get a chance for more tuning. My rig might be setup a little bit different than yours. I am recirculating with the intake coming from a false bottom and my temp probe is in a tee on the suction of my pump. I have also linearized the burner output like I mentioned earlier in this thread. I think that our tuning parameters might end up being a bit different because of the differences on how we are measuring temperature (I am assuming that your rig is the same as it was in your video). Good luck with your tuning!:mug:
 
Thanks alien. Any thoughts on reasonable starting points for kP ? I've tried 1, 100, then 1000 , with each worse than the last.
Another thought I had was to engage PID control only near the setpoint, so it doesn't over index on error early on in the cycle.

The values are completely dependent on your set up. It sounds like your I parameter might have been too high. My (very sluggish) electric set up worked reasonably well with kP = 1, kI = 0.002.

With P only, if the gain is too high the temperature will overshoot and then oscillate. If the gain is too low, the rise will be very slow and then "droop" (undershoot and stay low).

If the output is not well linearized you may be better off with a "fuzzy" rule based controller but they generally have more parameters so are even harder to tune.
 
Thanks alien, tob77.
I'd love to hit +- .25 degrees (F), but I'm pretty happy with where I got to yesterday +/- 1.5 degrees F.

I was using a rule based system for -15 degrees of setpoint, +2 degrees of setpoint. So that narrows the band for PID control. For this go-round I only used kP set to 1 or two. 1 seemed to work a bit better, so I'll stick with that.

One problem I've found, which relates to tob77's linearity issue is that below about 25% of valve lock-to-lock the fire goes out. So, I set my PID algo output limits to 25-100. Even at low flame, the temp can keep going up (especially if I have the lid on). I'm finding I can "fine tune" the heat loss by how much lid cover I use.

So here's a second video. Now I have an iPhone - much better than my old android for video :)
[ame]http://youtu.be/CGzJfUD3EuA[/ame]

We're making progress, thanks guys!
 
I've ran into some of the same problems as you have. I adjust my minimum CV value according to how windy it is outside and I've been leaving the top completely off to prevent the temp from continuously rising. I have also set a burner cutoff temp at 0.5 degrees F but thankfully this hasn't been a problem once the temp has stabilized.
 
Sounds like you are getting there.

To get below 25% you could turn it on and off and vary the duty cycle.
 
I was able to try out the relay tuning method today. I am very happy with my new results. I ended up using Kp = 0.33*Ku, Ki = 0.33*Ku / (0.5*Pu), Kd = 0. Where Ku is the gain from the test and Pu is the period. My final parameters were Kp = 14.0, and Ki = 27.6. I also rearranged the my pump outlet so that it mixed the water better. This seemed to make a big difference in my final results. I attached a couple of screenshots. The first one is the relay tuning test and the second one is the results after tuning and rearranging the pump output.

Screenshot_2013-10-20-14-26-58.jpg


Screenshot_2013-10-20-17-56-27.jpg
 
Hey guys, I thought you might be interested that (at long last?) I've updated my code for the automated BIAB system. I decided to make a new branch in Github to host the new code for the automated arduino brew in a bag system because it's different enough from the old system.

https://github.com/jrubinstein/brew-PID-propane/tree/automatedBIAB_v1

I've added:
an ignition system (a 120v silicon nitride ignitor)
automatic recipe parsing
buzzer for step change notification and hop drop time notification
automatic sensor detection for ds18b20
There's some error catching
pushes to serial for data capture
reads from serial for control
and a few other odds and ends

next steps - a processing or python front end to send/receive serial messages, make graphs, and parse beerXML files. And more PID tuning, since I just stole @tob77's Kp, Ki, and Kd values:)

I'll be posting an instructable on how I put everything together in the near future (we are moving house next week, so hopefully I don't forget)

I'd love to have some help from you guys to look over the code and help me find places to make it better, add ideas, and extend the code. Let me know what you think.

Cheers,
JR:mug:
 
restarting this project.
I wonder if anyone is interested in helping out with debugging, providing some future directions, etc?

:mug:
 
I read this thread and recognized some of you have been following the same threads including the teensynet and teensypi threads that I have over the last few years, so I feel very much at home. With that said, I need some advice. As I am a bacteriologist and not an engineer, it has taken two and a half years to put together a teensypi-based gas system until I realized that I had no idea how to mesh the two together. There is not a lot of info for open source controllers for gas fired systems as for PIDS. Before I put it in my NEMA cabinet, I have most of it mocked up, less the pumps and gas valves. Right now, I have I have two action boards wired in parallel so that (I think) I can turn the pumps and HLT and MLT burners on and off, the ds18b20 sensors providing the signals for the pumps and gas valves. I will be using a 24v transformer connected to two SSRs to power two Honeywell VR8300A3500s, which are wired from the three position terminal for the 3v3, ground and sensor data line to the other action board containing the pump switches and temp sensors. Am I on the right track?
 

Latest posts

Back
Top