# How to learn PID Control?

Controlling temperature (it depends upon your medium) isn't terribly hard. That was my first project when I started. Pardon me, if I repeat things you already know.

I assume you already have a way of controlling the system (ie, a heater or cooler unit), and a way of getting feedback from the system (a temperature sensor like a thermistor or something). You'll need both to implement a PID loop, which is a type of closed loop control. All you really need to do after that is write a bit of software to send control commands, read feedback, and make decisions upon that feedback.

I'd start out by reading PID without a PhD. It's the article I used when I first had to regulate temperature in a science experiment. It provides some easy-to-understand pictures, and nice sample code (a basic loop that you can tweak only needs 30 lines) that explains how to control your 'plant' - in this case, the thing you want to control the temperature of.

The gist of PID - Proportional-Integral-Differential - control is to use instantaneous, past, and predicted future performance (respectively) of the system to determine how to control a system at a given point in time to reach a specified set point. In many cases, you'll have to tune the algorithm's gain factors to get the desired performance you need - how quickly the temperature will rise, how much you want to avoid overshoot, etc. You might even find you don't need the differential or even integral control to get where you want to be!

Yes. Get a thermistor and a resistor. Pick a resistance that can pull a decently large current (>100mA).

Use thermal paste between them and tape them together with tape. Hook the thermistor circuit to a microcontroller through ADC. Use a transistor to control the resistor and control this with a PWM.

Develop a PID that allows you to control temp with a dial and practice making a PID that overshoots and rings the temperature. Make it over-damped and take forever to reach temp, and try to get it critically damped and get to the temp at max speed.

Let me know if more detail would help.

After you get this done reduce their thermal conductance, try adding a stage that will delay the temperature propagation and try to get it to control well.

This can also be done with an LED and a photo-transistor.

Besides the obvious temperature control application, here is a beautiful project that required PID control. Make yourself a line-following bot: http://elm-chan.org/works/ltc/report.html