Go Down

Topic: Looking for general PID code for the Arduino (Read 1 time) previous topic - next topic


Jan 28, 2011, 08:42 am Last Edit: Jan 28, 2011, 08:49 am by Daanii Reason: 1
I'm looking for the code for a general PID (proportional, integral, differential) control algorithm for the Arduino. Anyone know of any?

Thank you.

Coding Badly





Jan 28, 2011, 05:47 pm Last Edit: Jan 28, 2011, 08:50 pm by Daanii Reason: 1
Thank you.

I see I have been "smitten" using the new forum function. Well deserved, I guess, for not having found the PID library myself. My only excuse is that I have not visited this forum for a few weeks, and was surprised to find the new look. Plus I think I typed PDI in the search box by mistake.

But the links Coding Badly posted helped. There is a full and expertly written PID library that seems to get good reviews. But for me, the PID library requires more knowledge than I had. I wanted to understand what was being done, and why. That was a little hard to do from that code. (I don't mean to criticize the PID library by saying this.)

These two things helped me more:

http://www.eetimes.com/ContentEETimes/Documents/Embedded.com/2000/f-wescot.pdf  This article "PID Without a PhD" goes into the theory behind PID and gives sample code.

http://www.atmel.com/dyn/products/app_notes.asp?family_id=607  You need to scroll down to Atmel Application Note 221 "Discrete PID controller on tinyAVR and megaAVR devices". Then you can find download links for a pdf file with notes and a software file with sample code.

With these two resources, I was quickly able to write a simple PID program that meets my needs. And that I know how to tune and work with.

Others with more demanding applications may find the PID library more helpful.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131