The Great Bottle Opener Giveaway

Home Brew Forums > Home Brewing Beer > Automated Brewing Forum > Any interest in starting new open source automated brewing project...for propane?

View Poll Results: Does this seem like a good idea?
Yes, this sounds awesome! 29 82.86%
No, this sounds idiotic! 4 11.43%
You'll shoot your eye out, kid!!! 2 5.71%
Voters: 35. You may not vote on this poll

Reply
 
LinkBack Thread Tools
Old 02-22-2013, 05:28 AM   #61
craigmw
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2012
Location: Villa Park, CA
Posts: 133
Liked 14 Times on 11 Posts
Likes Given: 4

Default

Quote:
Originally Posted by jrubins View Post
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.
__________________
craigmw is offline
 
Reply With Quote Quick reply to this message
Old 03-12-2013, 08:54 PM   #62
jrubins
Feedback Score: 0 reviews
Recipes 
 
Join Date: Aug 2012
Location: San Jose, CA
Posts: 83
Liked 5 Times on 3 Posts
Likes Given: 3

Default

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!

__________________

In bottles: Last Day IPA, AAPL American Pale Ale
On deck: Some sort of porter type thing

The answer to the ultimate question of life, the universe, and everything? 42. The number of bottles in my first batch of homebrew? 42. Coincidence? I think not.

jrubins is offline
 
Reply With Quote Quick reply to this message
Old 03-12-2013, 09:34 PM   #63
tob77
Feedback Score: 0 reviews
Recipes 
 
Join Date: Sep 2012
Location: Napa, CA
Posts: 61
Liked 6 Times on 4 Posts
Likes Given: 15

Default

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.

__________________
tob77 is online now
 
Reply With Quote Quick reply to this message
Old 03-13-2013, 04:49 AM   #64
craigmw
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2012
Location: Villa Park, CA
Posts: 133
Liked 14 Times on 11 Posts
Likes Given: 4

Default

Quote:
Originally Posted by jrubins View Post
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!
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.
__________________
craigmw is offline
 
Reply With Quote Quick reply to this message
Old 03-13-2013, 05:37 AM   #65
tob77
Feedback Score: 0 reviews
Recipes 
 
Join Date: Sep 2012
Location: Napa, CA
Posts: 61
Liked 6 Times on 4 Posts
Likes Given: 15

Default

Quote:
Originally Posted by craigmw View Post
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.
__________________
tob77 is online now
 
Reply With Quote Quick reply to this message
Old 03-13-2013, 10:15 PM   #66
craigmw
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2012
Location: Villa Park, CA
Posts: 133
Liked 14 Times on 11 Posts
Likes Given: 4

Default

Quote:
Originally Posted by tob77 View Post
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.
__________________
craigmw is offline
 
Reply With Quote Quick reply to this message
Old 10-19-2013, 12:33 AM   #67
jrubins
Feedback Score: 0 reviews
Recipes 
 
Join Date: Aug 2012
Location: San Jose, CA
Posts: 83
Liked 5 Times on 3 Posts
Likes Given: 3

Default

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

__________________

In bottles: Last Day IPA, AAPL American Pale Ale
On deck: Some sort of porter type thing

The answer to the ultimate question of life, the universe, and everything? 42. The number of bottles in my first batch of homebrew? 42. Coincidence? I think not.

jrubins is offline
 
Reply With Quote Quick reply to this message
Old 10-19-2013, 12:44 AM   #68
alien
Feedback Score: 1 reviews
Recipes 
 
Join Date: Apr 2012
Location: Philadelphia, PA
Posts: 1,233
Liked 63 Times on 57 Posts
Likes Given: 61

Default

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.

__________________
Magic Smoke brewhouse and grill

Arduino PID controller - Automatic Smoker - Cooler MLT - Counterflow Chiller - SSR demo - PWM timer - Folding Brew Table
alien is offline
 
Reply With Quote Quick reply to this message
Old 10-19-2013, 01:10 AM   #69
jrubins
Feedback Score: 0 reviews
Recipes 
 
Join Date: Aug 2012
Location: San Jose, CA
Posts: 83
Liked 5 Times on 3 Posts
Likes Given: 3

Default

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.

__________________

In bottles: Last Day IPA, AAPL American Pale Ale
On deck: Some sort of porter type thing

The answer to the ultimate question of life, the universe, and everything? 42. The number of bottles in my first batch of homebrew? 42. Coincidence? I think not.

jrubins is offline
 
Reply With Quote Quick reply to this message
Old 10-19-2013, 05:41 AM   #70
tob77
Feedback Score: 0 reviews
Recipes 
 
Join Date: Sep 2012
Location: Napa, CA
Posts: 61
Liked 6 Times on 4 Posts
Likes Given: 15

Default

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!

__________________
tob77 is online now
 
Reply With Quote Quick reply to this message
Reply


Quick Reply
Message:
Options
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Brewtarget 1.2.3 - Free Open Source Brewing Software rocketman768 Brewing Software 260 04-11-2013 04:36 AM
Brewtarget 1.2 - Free open source brewing software rocketman768 Brewing Software 294 02-22-2013 05:48 AM
Open Source Brewing PowellAvenueBrew General Beer Discussion 20 09-21-2011 04:30 PM
New free open source brewing software rocketman768 General Beer Discussion 23 01-19-2009 11:01 PM
Open Source Beer Project rbenvin Recipes/Ingredients 3 06-04-2007 09:27 PM