2

Author Topic: PID controller programming in AVR controller  (Read 4602 times)

0 Members and 1 Guest are viewing this topic.

Offline SalmanTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
PID controller programming in AVR controller
« on: May 22, 2008, 02:40:37 PM »
 ???
I have searched the internet but have failed to find sufficient info on how to program a controller to work as PID...........can u pls help me solve this problem...............also can we use hardware format PID in conjunction with AVR that too how...........pls help me out ;D

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: PID controller programming in AVR controller
« Reply #1 on: May 22, 2008, 04:13:39 PM »
Here is how to do it in BASIC on the BS2

http://forums.parallax.com/forums/default.aspx?f=6&m=66982


If you know C then you should be able to convert the code yourself

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: PID controller programming in AVR controller
« Reply #2 on: May 23, 2008, 09:50:17 AM »
good link pomprocker
good ol' BeNNy

Offline SalmanTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: PID controller programming in AVR controller
« Reply #3 on: May 23, 2008, 10:43:30 PM »
I wish to be using this PID controler for controlling a heater , compresser and a piltier module. I am basically making a final year project in which i have to control the temprature of an incubator between -10c to +40c..........so how will I use the error should I use a comparator and till the time the value doesnot become 0 keep the related equipment on some thing like that.........Also as the user needs to set the temprature the setpoint would become the input temprature..........Pls provide me with some usefull tips........
is this block diagram ok
sensor-->ADC-->PID-->controller-->relay-->heater

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: PID controller programming in AVR controller
« Reply #4 on: May 24, 2008, 03:55:55 AM »

Quote
..........so how will I use the error should I use a comparator and till the time the value doesnot become 0 keep the related equipment on some thing like that.........
yea osmthing like that ,,but lets put it this way
when your error is 0 (that means the heat is the same as the setpoint) then Kp*0=0 so no output and no changin anything
when your error has a number then you need to react someway,, this is how you determine kp.
so what you mentioned is just P ,,

, do you want to make all controls? P and I and D?

D helps you to run faster towards fixing your error when the error changes

do you need this property?

anyways that was a block diagram to understand the concept
you can turn it into a circuit the way you like,,
you can use a microcontroller,,or not ,,
the design can take many forms,
good ol' BeNNy

Offline SalmanTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: PID controller programming in AVR controller
« Reply #5 on: May 24, 2008, 12:06:13 PM »
well yes I have to use all of the three P,I and  D. how will i determine Kp, Ki and Kd.........I i wish to use a PID controller which work for diffrent tempratures so it needs to be made through programming so that it can be easily varied........

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: PID controller programming in AVR controller
« Reply #6 on: May 24, 2008, 03:29:16 PM »
this is what is stated in the link above

Quote
The resulting actuator output exerts a correcting influence on the system.  By definition, this influence is proportional to the measured error.  Since the actuator output has some effect on the system, the sensor value is checked again, and the whole process is repeated, over and over again to maintain the level(s) in the system

your answer is here ,read it over and over,,the explains the whole thing
you determine your constants depending on how your system works,,your circuit,,
you just have to build a circuit that resembles this concept
i dont know whats your type of actuator output to answer that,, it could be a pwm signal , an analog signal,, ,,etc
i hoped this helped ya a little
good ol' BeNNy

Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
Re: PID controller programming in AVR controller
« Reply #7 on: May 24, 2008, 05:25:35 PM »
well yes I have to use all of the three P,I and  D. how will i determine Kp, Ki and Kd.........I i wish to use a PID controller which work for diffrent tempratures so it needs to be made through programming so that it can be easily varied........

I don't think you fully understand what PID control means, as banji also said, read the link through.
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: PID controller programming in AVR controller
« Reply #8 on: May 24, 2008, 06:30:12 PM »
One of the best articles for Novices who want to use PID, entitled "PID without a PhD"

 


Get Your Ad Here