Arduino robot PoliArdo - Maze solver

Arduino robot PoliArdo - Maze solver

This robot took part in a competition and solved the maze.

  • 13,945 views
  • 2 comments
  • 55 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×2
ultrasonic sensor
×2
zumo arduino
×1
color sensor
×1
DC motor (generic)
×2

Necessary tools and machines

laser

Apps and online services

About this project

PoliArdo Arduino robot is designed to compete in pogramiranju robot. The robot has three versions of appearance, each designed for a specific task. We will show you where the task robot solves the maze.

Bill of materials

The robot is built with:

  • Two control units Arduino Uno
  • The controller for motors Arduino Zumo
  • Three ultrasonic sensors
  • Color sensor GY-31
  • Two DC motors
  • The construction of the robot
  • Two 9V batteries

What we present the final version of the robot. Of course, when concluding we tried turning sensor,s moved the components and came to serious results, you'll be able to see below.

Drawing a plan

First we need to imagine, draw a robot. How will the robot where we will look to place the motors, control units, sensors and other components needed to operate the robot. In SolidWorks, we made an initial appearance of robots and sent to laser cutting.

We started to learn to move on the given coordinates and self-supporting wall. Slowly we were preparing for the tasks that await us. Gave way to various problems robot he found a hole in the wall, did not have engines feedback - we manage them on time, the sensors are giving illogical feedback. Like every beginning it was very difficult, but we never gave up. We have found solutions.

Battery and ultrasonic sensors

Our batteries are very quickly consumed, due to the capacity control units were not allowed to put a stronger battery. Most often it happened that amperage quickly falls to zero. We installed a voltage stabilizer 7806 and worked with stronger batteries.

As is already known ultrasonic sensors operate on the principle of radar. Sends audio signals that are reflected from the object and returns back and this time supposed to be a signal to go and return is calculated as the time and distance itself is obtained by the time divided by two. First we set the sensor in a horizontal position because that is the basic position and we thought it would be a good show. We were wrong. So turn the sensors are good for measuring the distance while standing robot because its scope to capture 120°.

Therefore, when tracking, the wall was badly registered by the same distance. We tried to angle sensors placed against the wall. We turned it parallel to the wall but at an angle of 45°, 30° and 60°, but nothing significant has changed.

We found the solution!

We turned vertically or sensors so that component that sends a signal down is the one that receives the signal up.

Why Vertical?

Because it is a signal range of lines and measured the exact distance of the robot from the wall. It does not matter whether the robot approaches, moves away or is parallel to the wall. We can always get an accurate signal. Thanks to this we are not running into an invisible hole in the wall and began a nice robot that follows the wall.

Two control units

Since the robot we have has two control units on one we attached motors and ultrasonic sensors on the second color sensor, display and speaker. We had to have a free pin to both control units that would serve as a transmission signal. When the robot is reaching the goal he had to stop so that was an extra signal of important benefits to transmit a signal from one to another control unit. Color sensor obvious blue or green color signal and sends the second control unit to stop the engines.

Assignment

Robot must go through a whole labyrinth of openings and all the red lines over which transferred and to stop at the finish, which is colored blue or green color and prints by the number byline is counted. The algorithm monitoring the wall is one of the most popular algorithms for finding a way out of the maze, and is also known as the "Rule of the left hand" and "right hand rule". If the maze of connections, or if all its walls are connected to each other, or if they are connected with the external border of the maze, then if the robot is inside the maze, backing to one side of the wall during the entire passage through the maze, there is a guaranteed way out of the maze, otherwise the robot would be returned to the entrance of the labyrinth and thereby make the rounds of each path in the maze at least once. Our task is to go through the entire robot labyrinth and successfully complete it for you moving time. Therefore, the robot passes through some mazes automatically (independently), and through some software (known in advance maze).

PoliArdo was wearing for this task had three ultrasonic sensors to monitor the wall, a color sensor that counted the lines and recognize colors, also there were the speakers who gave a signal to the robot crossed the red line and a display that showed the number of lines.

First steps of PoliArdo

FINAL!

Code

Code arduino robotArduino
arduino board uno its shield arduino zumo control ultrasonic sensors and motors.
#include <ZumoMotors.h>
#include <ZumoBuzzer.h>
#include <Pushbutton.h>

ZumoBuzzer buzzer;
ZumoMotors motor;
Pushbutton button(ZUMO_BUTTON);
int  f=83.5/80;
int thigD=A2;
int ehcoD=A3;
int thigL=A4;
int ehcoL=A5;
long distancaL,distancaD;
long distanca,trajanje;
int signal=2;

void setup(){
  Serial.begin(9600);
  pinMode(thigL,OUTPUT);
  pinMode(ehcoL,INPUT);
  pinMode(thigD,OUTPUT);
  pinMode(ehcoD,INPUT);
  pinMode(signal, INPUT);  
  button.waitForButton();
  buzzer.play("L16 cdegreg4");
  while(buzzer.isPlaying());
  
  distancaD=izracunaj(thigD,ehcoD);
  DesniZid();
  okretDesno();
  
  distancaL=izracunaj(thigL,ehcoL);
  LeviZid();
  okretLevo();
  
  distancaD=izracunaj(thigD,ehcoD);
  DesniZid();
  okretDesno();
  
  distancaL=izracunaj(thigL,ehcoL);
  Prati_Levi_zid();
   
   motorSTOP();
}
void loop(){
}
void motorSTOP(){
  motor.setSpeeds(0,0); 
  delay(500);
}
int izracunaj(int thig,int ehco){
  
  digitalWrite(thig,LOW);
  delayMicroseconds(2);
  digitalWrite(thig,HIGH);
  delayMicroseconds(10);
  digitalWrite(thig,LOW);
  trajanje=pulseIn(ehco,HIGH);
  distanca=(trajanje/2)/29; 
  return (distanca);
}
void DesniZid(){
   while(distancaD < 27){
    distancaD=izracunaj(thigD,ehcoD);
     
    if(distancaD <=11 && distancaD >=9){
                 motor.setSpeeds(83.5,80); }
    else if (distancaD >=15){
           motor.setSpeeds(165,55); 
           delay(15); }
    else if(distancaD <9){
           motor.setSpeeds(55,100); 
           delay(10); }
    else if(distancaD >11 && distancaD < 15){
             motor.setSpeeds(100,65); 
             delay(10); }
  }
  
}
void LeviZid(){
  while(distancaL < 27){
     distancaL=izracunaj(thigL,ehcoL);
     
    if(distancaL <=11 && distancaL >=9){
             motor.setSpeeds(83.5,80);
             delay(10); }
    else if (distancaL >=15){
              motor.setSpeeds(55,165); 
              delay(15); }
    else if(distancaL <9){
              motor.setSpeeds(100,55); 
              delay(10); }
    else if(distancaL >11 && distancaL < 15){
              motor.setSpeeds(65,100); 
              delay(10); }
  }
  
}
void Prati_Levi_zid(){
    while(1){
      distancaL=izracunaj(thigL,ehcoL);
      if(digitalRead(signal)==HIGH){motor.setSpeeds(0,0); delay(50000);}
      if(distancaL <=11 && distancaL >=9){
            motor.setSpeeds(83.5,80);
            delay(10); }
      else if (distancaL >=15){
            motor.setSpeeds(75,165); 
            delay(15); }
      else if(distancaL <9){
            motor.setSpeeds(100,72); 
            delay(10); }
      else if(distancaL >11 && distancaL < 15){
            motor.setSpeeds(80,100); 
            delay(10); }
  }
}
void okretDesno(){
   motorSTOP();
   motor.setSpeeds(90*f,90); 
   delay(1900);
   motorSTOP();
   motor.setSpeeds(100,-100); 
   delay(1000);
   motorSTOP();
   motor.setSpeeds(90*f,90); 
   delay(4000);
   motorSTOP();
   motor.setSpeeds(100,-100); 
   delay(1000);
   motorSTOP();
  
}
void okretLevo(){
  motorSTOP();
  motor.setSpeeds(90*f,90); 
  delay(1700);
  motorSTOP();
  motor.setSpeeds(-100,100); 
  delay(1000);
  motorSTOP();
  motor.setSpeeds(90*f,90); 
  delay(4000);
  motorSTOP();
  motor.setSpeeds(-100,100); 
  delay(1000);
  motorSTOP();
  
}
Code arduino robotArduino
for arduino board with speaker and color sensor
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#define NOTE_CS8 4435
#define NOTE_B6  1976
int melody[] = {NOTE_CS8,NOTE_B6};
int noteDurations[] = {8,8};
const int s0 = A3;  
const int s1 = A4;  
const int s2 =A1;  
const int s3 = A2;  
const int out = A0;
int signal=7;
int ind=0;
int red = 0;  
int green = 0;  
int blue = 0;
int brojac=0;

void setup(){
  Serial.begin(9600);
 
  pinMode(s0, OUTPUT);  
  pinMode(s1, OUTPUT);  
  pinMode(s2, OUTPUT);  
  pinMode(s3, OUTPUT);  
  pinMode(out, INPUT);   
  digitalWrite(s0, HIGH);  
  digitalWrite(s1, HIGH); 
   pinMode(signal, OUTPUT);  
  lcd.begin(16,2);   
  lcd.backlight();
  lcd.clear();
  lcd.setCursor(0,0); 
  lcd.print("ARDUINO TEAM");
 
}
void loop(){
  if(ind==0){
  color();
  
  delay(200);
 
   if (red < blue && red < green && red < 20)
  {  
      if (!(red <=10 && green <=10 && blue <=10)){
              delay(70);
              brojac++;
              lcd.setCursor(5,1);
              lcd.print(brojac);
     for (int thisNote = 0; thisNote < 1; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
     noTone(8);
  }
}
    }
  
              
    if ((red > 40 && red <80) && (green >20 && green <45) && (blue >0 && blue <20))   
  {  
    if (!(red <=10 && green <=10 && blue <=10)){
    for (int thisNote = 0; thisNote < 2; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
     noTone(8);
     ind++;
  }
   digitalWrite(signal,HIGH);
      }
      else digitalWrite(signal,LOW);
  }
  }     
  }
  

void color()  
{    
  digitalWrite(s2, LOW);  
  digitalWrite(s3, LOW);  
  red = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);  
  digitalWrite(s3, HIGH);  
  blue = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);  
  digitalWrite(s2, HIGH);  
  green = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);  
}

Custom parts and enclosures

SolidWorks model Robot
YhPvw5oQqqlxIPrqOjsA.SLDASM
SolidWorks model Robot
erGKLifmpXXC5aAMY8Kh.SLDDRW

Schematics

version robot 1
48wgy81dlydrgpqndlcp

Comments

Similar projects you might like

Make your first Arduino robot - The best beginners guide!

Project tutorial by Muhammed Azhar

  • 44,087 views
  • 15 comments
  • 98 respects

MeArm Robot Arm - Your Robot - V1.0

Project tutorial by Benjamin Gray

  • 19,302 views
  • 3 comments
  • 34 respects

Swarm Robot Using NRF Chat Application

Project tutorial by 3 developers

  • 3,353 views
  • 2 comments
  • 16 respects

OttoDIY Build Your Own Robot in One Hour!

Project tutorial by Camilo Parra Palacio

  • 104,209 views
  • 128 comments
  • 296 respects

Self Balancing Robot Using Blubug

by Team Twob

  • 27,527 views
  • 7 comments
  • 35 respects

Hand Gesture Controlled Robot

Project tutorial by Mayoogh Girish

  • 54,973 views
  • 78 comments
  • 65 respects
Add projectSign up / Login