Pid

Hello,

I recently purchased Pololu wheels and motors for my line following project .
i am using Atmel 8051 as my micro-controller. I had done my line following project
using just two sensors. now i m gonna enter a competition where only speed matters.
so i planned to implement PID in my coding.
I had studied the concept of PID through various articles and understood it.
in my previous,i got the analog outputs from my sensors and convert them to
digital using a comparator.so the micro-controller follows the line using either 1 or 0.
but now for PID i have the following doubts:

  1. my microcontroller uses only int and char daatypes. then how to implement
    float values for PID constants?
    2)how to use the digital sensor values and convert them to (0 - 4000) for PID
    as you use for coding to set the motor speed? :question:

Hello.

The section of the Pololu 3pi user’s guide that talks about line following PID algorithms might be a good reference for you.

  1. Instead of using floating point numbers for your PID just use integers. For example, represent 4.567 as 4567.

  2. What kind of line sensors are you using and how many do you have? If you line sensors are evenly spaced and the spacing is smaller than the thinest line you need to detect, you can use a formula like the read_line function in the Pololu AVR library.

- Ryan

hello,
i have attached images my Ir reflective sensor which is TCRT 5000,
along with the functional and block diagram. i connect the output
from the collector to a voltage level comparator, which is LM324.
this comparator changes the analog collector output to digital and
feeds it to the micro-controller. so i get either logic ‘1’ or logic ‘0’ from
the sensors.i further attach my source code which i compile for
atmel 8051. my source code does not use PID.
so please suggest a way to use my sensor outputs for PID. :wink:





Hello.

It doesn’t look like you attached your code. Did you read my last post? Let me know if something in my last post or the 3pi documentation wasn’t clear. If you plan to attach source code, please attach just the small part you are having trouble with.

- Ryan