Sunday, September 8, 2013

Raspberry Pi PID/PWM 12V Fan Controller

Just for fun project.


So awhile back I purchased a Raspberry Pi.  I'm trying to stray away from the expensive industrial world in my home automation projects (namely the PLC).  I had many many project ideas for this neat little computer.... homemade digital picture frame, turtle habitat controller, light switches, weather station, thermostat, and on and on.  I purchased a PI weather board (found here) which gives you temperature, humidity, barometer , 4 high power dc outputs, and a couple external 1-wire sensors ports.
I had lots of fun with this little board and the PI. I didn't have to put it together which made it a good first project.  I put it in the fridge, on the ac vents, outside, and in the crawlspace to see what the temperatures were. I couldn't think of much more to do until I could get more funds and more parts for the projects I had in mind.

So after toying around for a bit with an LED and PWM I thought it'd be cool to get that working with the high power outputs the weather board has except with a computer fan :-). I found an old 12v 1000mA AC adapter plenty good enough for the fans.


Now that I got that working I wanted it to start cooling the weatherboard sensors and slow down to try and meet the desired set point. I found that in the industrial world there are nice little equations and formulas to help you achieve this. The PID loop (if you want to learn what that is (wiki link) gave me a value which I added to my dutycycle:
python pid code here ( i'll post my code later)

After recording that video the fans adjusted their speed to about 20-30% to maintain the setpoint. This could be a helpful addition to the cooling part of my turtle habitat project.