Sie sind auf Seite 1von 10

BY PIYUSH SINGH ELECTRICAL ENGINEERING 1009120063

Wall Avoider is an autonomous robot which detects the wall using sensors and avoids itself to make contact with the wall. Its a closed loop control system.

Following is the circuit of sensor. (analog And digital)

In Wall avoider we use analog sensors because we need to have continuous value of the distance between the wall. We then convert the analog value to digital using inbuilt ADC of the Microcontroller. We set a threshold point and continuously check the error with respect to the threshold point and using PID algorithm and PWM give the output to the motors.

FIRST SET THE THRESHOLD SAY threshold = 200; Value of input can differ from 0-255 only; So take the input from the sensor by continuously sampling the input and find the error ;

error=threshold-input; Take another variable to store the previous value of the error perror=error;
Now calculate the PROPOTIONAL component: P = kp * error; Where kp is the proportionality constant

Calculate the DERIVATIVE component D = kd * (error-perror); where kd is derivative coefficient. At last calculate the integral coefficient I = ki * ( perror + error); Total correction correction = P + I + D; Now we give output to left and right motors through L293d rightpulse = basespeed correction; leftpulse = basespeed + correction;

Das könnte Ihnen auch gefallen