Concurs : Robot Autonom
Acest articol este publicat in cadrul concursului Robofun 2012. Perioada de votare pentru acest proiect s-a incheiat. Acest proiect a acumulat un numar de 617 voturi.
Ma numesc Gidofalvi Norbert si anul trecut am terminat facultatea de mecatronica si robotica din cadrul universitatii Petru-Maior Tg Mures.
Sunt pasionat de electronica, mai ales proiectarea si dezvoltarea robotilor, asta inseamna proiectarea mecanica proiectarea electronica si dezvoltare software.
Cadrul robotului meu a fost proiectat in autocad inventor si taiat din Plexiglas cu o masina CNC.
Prinderea senzorilor de distanta am facut in asa fel incat cele doua senzori din lateral sa fie raglabil, si senzorul din fata este fix.
Robotul este echipat cu:
2 motoare cu reductor
3 senzori de linie
3 senzori de distanta sharp,
O camera whireless
Un servomacanism
O placa arduino uno
O placa driver cu integratul l298
Un system de captarea semnalului de la telecomanda
Un acumulator de 6V pentru alimentarea motoarelor si a senzorilor
O baterie de 9v pentru placa arduino
Pentru capturarea imaginilor si vizualizarea drumul robotului am folosit o camera wireless prins pe un servomecanism care permite o rotire de 180 grade pentru o vizibilitate mai buna.
Camera foloseste ca sursa de alimentare o baterie de 9v si poate sa trimite imagini pana la 150m de la receptor.
Senzor: CMOS Color
Robotul permite sa fie comandat manual cu ajutorul unei telecomanda fara fir, raza de actiune maxima 5m, este foarte usor de manevrat si se poate intra cu el in locuri greu accesibile pentru a face poze sau video.
In final am reausit sa asamblezi componentele si sa fac un robot autonom programabil.
Robotul este capabil sa urmareasaca linia si daca apare un obstacol pe linie ori intoarce ori iese de pe linie si dupa ocolire intoarce pe linie depinde de programare,
Componentele mecanice si electronice
O parte din programul folosit
//obsatacle avoid robot program with 3 Ir distance sensors//
// line thresholds
#define line_center_threshold 400
#define line_left_threshold 200
#define line_right_threshold 200
// obstacle thresholds
#define obstacle_center_threshold 300
#define obstacle_left_threshold 300
#define obstacle_right_threshold 300
// speeds
#define high_speed 150
#define medium_speed 70
#define low_speed 30
int mot1A = 11;
int mot1B = 10;
int mot2A = 6;
int mot2B = 5;
int s0 = 0;
int s1 = 1;
int s2 = 2;
int s3 = 3;
int s4 = 4;
int s5 = 5;
int followline = 1; // 1-follow the line, 0-surround the obstacle
int canswitch = 1; // 1-the followline can be switched, 0-cannot switch
int obstaclepos = 0; // 0-left, 1-right
int linepos = 0; // 0-left, 1-right
void setup() {
pinMode(s0, INPUT);
pinMode(s1, INPUT);
pinMode(s2, INPUT);
pinMode(s3, INPUT);
pinMode(s4, INPUT);
pinMode(s5, INPUT);
pinMode(mot1A, OUTPUT);
pinMode(mot1B, OUTPUT);
pinMode(mot2A, OUTPUT);
pinMode(mot2B, OUTPUT);
}
void loop() {
// ANALOG SENSORS READ
int sens0 = analogRead(s0);
int sens1 = analogRead(s1);
int sens2 = analogRead(s2);
int sens3 = analogRead(s3);
int sens4 = analogRead(s4);
int sens5 = analogRead(s5);
//delay( 50 );
// PRIORITY
// line=0, obstacle=0
if ( ( ( sens2 > line_left_threshold ) && ( sens0 > line_center_threshold ) && ( sens1 > line_right_threshold ) ) &&
( ( sens3 < obstacle_left_threshold ) && ( sens4 < obstacle_center_threshold ) && ( sens5 < obstacle_right_threshold ) ) )
{
followline = 1;
canswitch = 1;
}
// line=1, obstacle=0
else if ( ( ( sens2 < line_left_threshold ) || ( sens0 < line_center_threshold ) || ( sens1 < line_right_threshold ) ) &&
( ( sens3 < obstacle_left_threshold ) && ( sens4 < obstacle_center_threshold ) && ( sens5 < obstacle_right_threshold ) ) )
{
followline = 1;
canswitch = 1;
}
// line=0, obstacle=1
else if ( ( ( sens2 > line_left_threshold ) && ( sens0 > line_center_threshold ) && ( sens1 > line_right_threshold ) ) &&
( ( sens3 > obstacle_left_threshold ) || ( sens4 > obstacle_center_threshold ) || ( sens5 > obstacle_right_threshold ) ) )
{
followline = 0;
canswitch = 1;
}
// line=1, obstacle=1
else if ( ( ( sens2 < line_left_threshold ) || ( sens0 < line_center_threshold ) || ( sens1 < line_right_threshold ) ) &&
( ( sens3 > obstacle_left_threshold ) || ( sens4 > obstacle_center_threshold ) || ( sens5 > obstacle_right_threshold ) ) )
{
if ( canswitch == 1 )
{
if ( followline == 1 )
followline = 0;
else
followline = 1;
canswitch = 0;
}
}
// LINE FOLLOWER
//followline = 1;
// all on line (intersection)
if ( (followline == 1) && ( sens2 < line_left_threshold ) && ( sens0 < line_center_threshold ) && ( sens1 < line_right_threshold ) )
{
// go strait
analogWrite(mot1A, 0);
analogWrite(mot1B, medium_speed);
analogWrite(mot2A, medium_speed);
analogWrite(mot2B, 0);
}
// line to the center-left
else if ( (followline == 1) && ( sens2 < line_left_threshold ) && ( sens0 < line_center_threshold ) && ( sens1 > line_right_threshold ) )
{
// turn left
analogWrite(mot1A, 0);
analogWrite(mot1B, low_speed);
analogWrite(mot2A, high_speed);
analogWrite(mot2B, 0);
linepos = 0;
}
// line not in center, but both sideways
else if ( (followline == 1) && ( sens2 < line_left_threshold ) && ( sens0 > line_center_threshold ) && ( sens1 < line_right_threshold ) )
{
// go strait
analogWrite(mot1A, 0);
analogWrite(mot1B, medium_speed);
analogWrite(mot2A, medium_speed);
analogWrite(mot2B, 0);
}
// line only to the left
else if ( (followline == 1) && ( sens2 < line_left_threshold ) && ( sens0 > line_center_threshold ) && ( sens1 > line_right_threshold ) )
{
// turn left
analogWrite(mot1A, low_speed);
analogWrite(mot1B, 0);
analogWrite(mot2A, high_speed);
analogWrite(mot2B, 0);
linepos = 0;
}
// line to the center-right
else if ( (followline == 1) && ( sens2 > line_left_threshold ) && ( sens0 < line_center_threshold ) && ( sens1 < line_right_threshold ) )
{
// turn right
analogWrite(mot1A, 0);
analogWrite(mot1B, high_speed);
analogWrite(mot2A, low_speed);
analogWrite(mot2B, 0);
linepos = 1;
}
// line only in center
else if ( (followline == 1) && ( sens2 > line_left_threshold ) && ( sens0 < line_center_threshold ) && ( sens1 > line_right_threshold ) )
{
// go strait full speed
analogWrite(mot1A, 0);
analogWrite(mot1B, high_speed);
analogWrite(mot2A, high_speed);
analogWrite(mot2B, 0);
Acest articol este publicat in cadrul concursului Robofun 2012. Perioada de votare pentru acest proiect s-a incheiat. Acest proiect a acumulat un numar de 617 voturi.