PID Control 1: Set up and thoughts

A while ago I acquired some electronics that had plenty of good stuff to “recycle”… An influx of some interesting mechanical bits I hope to add to a future project; It’s also held me up on new project posting after my last Modbus blog post.

Today I entered my shop and realized I was all done for the most part… What to do?! Well next on my projects list is “something PID” … It should really read “something PI”. PID is an algorithm for proportional, integral, derivative control. Wikipedia is your friend on the painful math bits. I don’t really use the D in PID much but it’s something to be aware of if you’re every looking into it yourself. My expectation in this experiment/project is to keep some item level with a stepper motor and hopefully tune my PI loop so it’s not hunting.

I work with PID nearly daily… So I’m going to just shoot from the hip and see what I come up with. No fancy math the first time around, let see where I go?


I set up a 18F14K22 on the 20pin breadboard.. All the important stuff, and I’m outputting an accelerometer to an A/D and dumping it to the UART… I’m now at the point of writing the PID code. No code for now, I’ll link in some code when this project isn’t an over-glorified LED blinker and has some purpose.

My notes say I’ll take my process variable which will be accelerometer data on the X-axis. I’ll feed my PID process a setpoint (the value read at level) and the multiplier, a “gain” figure, and then finally process a error correcting value at some set time constant (timer?) I believe this legitimate proportional control.

The integration seems to be much more straightforward but maybe that’s wishful thinking… TBC!


Leave a Reply