PID Controls

December 15th was our member meeting for the month.  I gave a talk on PID controls with an live demonstration of temperature control using a relay-activated light bulb for heating and an RC motor with propeller used for cooling.  There was lots of audience participation with many great questions asked.

First, I'd like to thank the folks that showed up.  PID controls can be a pretty esoteric subject, but there was a lot of interest from the folks in attendance.  An interested audience always makes you feel better when giving a presentation.   

Second, there were a few questions from those who attended about where to read more on this topic.  For those who can read boring text and work your way through it, I'd recommend Control Guru as a place to read up and learn more in depth about PID controls.  He starts with a great general description of controls problems, then digs into individual aspects of it in great detail.  A good site to learn the basic concepts and get a hint of how to work some of the inner details.  If anyone is interested in the excel tool that I was using to illustrate the controls response numerically, it can be found here.

For the specifics on the live demo, I basically combined three non-standard arduino libraries.  I used the PID Library to calculate the control output using the proportional, integral, and derivative tuning parameters and the temperature input.  For the input, I was using a standard Type K thermocouple.  I used the MAX6675 breakout board available from adafruit.  It uses serial communications (SPI) to pass temperature information to the arduino.  The adafruit provides details on how to set up the board and links to a library they've developed to work with the board.  Finally, my output was a servo output given to the electronic speed controller (ESC) and motor I took from an RC plane.  I used the servo library to handle the servo communications.  I had to read up on the specifics of using my  ESC to make sure I allowed time for arming, etc.

The pseudo code is basically:

1. Read temperature input

2. Use temperature and PID parameters to calculate output.

3. Write output to ESC to set motor speed.

My exact code is basically just copy-pasting lines from those libraries together and changing pin numbers.  I'm willing to share, but the included examples really do show you everything you need.  Remember, I soldered the arduino used in the demo at the November meeting, so it doesn't take much to put it together.

 If anyone has any specific questions about how to get these pieces together, or if you have any controls-related questions from your projects, feel free to send me emails to ask questions.  I'm more than willing to help.  My email address can be figured out from the google group.  If you haven't signed up yet, do it now.

 

Tags: 

Comments

Great presentation!

Thanks a lot, Laz. I really enjoyed your presentation. You were well prepared with props (huhuh pun intended) and software. You really raised the bar! Thanks for adding value to the group.