Thanks, i use photo dioda in my robot. i uses 8 array infront of robot n 2 sensor in side right n left. I not use comparator to read a line, but i use ADC.
1. for using PID alogarithm, first we have to know how PID works. Start from P,I,or D. Actually, in my robot not 100% use PID to control motor. PID is only use to calculate the PWM value. For making motor can run forward or reverse, we can see from final calculating PID result. *If the calculating result is positive , motor is controlled to run forward as big as PID value.
The other way, *if the calculating result is negatif, motor is controlled to run reverse, but PID value must be in positive value first.* if the calculating result is big more then 255, so you must insert value with 255. And if the calculating result less then -255, so you must insert value with -255. Note: Don't forget to change to be positif, if the calculating result is the negative.
2. To get error value. you can use sensors to map this errors. like this: ...... if(PINA== 0b00000010){ error=2; } //its not real value (you can change this value) if(PINA== 0b00000100){ error=1; } if(PINA== 0b00001000){ error=0; } if(PINA== 0b00010000){ error=0; } if(PINA== 0b00100000){ error=-1; } if(PINA== 0b01000000){ error=-2; } .............. Thanks..!! I hope this is can help you to solve your problems.. By: KoeRa
Hey nice bot:)
btw what sensors did u use? motors? Can u share ur ideas regarding PID control?
uk3sh 2 years ago
Thanks, i use photo dioda in my robot. i uses 8 array infront of robot n 2 sensor in side right n left. I not use comparator to read a line, but i use ADC.
Motor: i use a motor DVD 5 volt
sory if my languange is bad..!!
koeracakep 1 year ago
Okay nice! What about the programming part?
How did u guys implement the PID control algorithm
uk3sh 1 year ago
1. for using PID alogarithm, first we have to know how PID works. Start from P,I,or D. Actually, in my robot not 100% use PID to control motor. PID is only use to calculate the PWM value. For making motor can run forward or reverse, we can see from final calculating PID result. *If the calculating result is positive , motor is controlled to run forward as big as PID value.
koeracakep 1 year ago
The other way, *if the calculating result is negatif, motor is controlled to run reverse, but PID value must be in positive value first.* if the calculating result is big more then 255, so you must insert value with 255. And if the calculating result less then -255, so you must insert value with -255. Note: Don't forget to change to be positif, if the calculating result is the negative.
koeracakep 1 year ago
And for PID formula, u can see a lot in internet.
You can try this formula. (write in C languange)
void PID() //calculate PID value ( P and D only )
{
left_value=(int)(((-error)* (((P)))) +top_speed)-((error-error1)* (((D))));
right_value=(int)((( error)* (((P)))) +top_speed)+((error-error1)* (((D))));
error1=error;
}
Note: P,D,top_speed is value .(we insert this value manually)
* use if then rule to controlled motor after calculating PID.
koeracakep 1 year ago
koeracakep 1 year ago
wuayooah...
koeracakep 1 year ago