Introduction: Arduino | Maze Solving Robot
Welcome, I'm Siddharth and this is my first robot "Lexus v1.0". This Robot was designed to solve a simple Maze. In the competition we had two mazes and the robot was designed to able to identify them and solve both. Any changes in the maze may need changes in the code or the design but it's easy to do. Here is the video link for the our project
Step 1: Step 1: Parts
Parts List:
- Arduino UNO
- 12v DC motors (x2)
- Wheels (x2)
- Motor Driver (L298N)
- Distance Sensor (Ultra Sonic)
- Wires (Jumper wires 1-pin male-male)
- 12v Battery (1300 mAh)
- Switch
Step 2: Building/Wiring
Sensors
Lets talk about "The Ultrasonic sensor"
An Ultrasonic sensor is simple radar that measures the distance of an object by
using sound waves.
Ultrasonic Sensor connections:
- GND: connect this to the Ground.
- VCC: connect to the power source 5 voltages.(Alert! if you connect it to more than 5v it will be damaged)
- Echo: connect this to any pin on the Arduino. (match it to the code)
- TRIG: connect this to any pin on the Arduino. (match it to the code)
--------------------------------------------------------------------------------------------------------------------------
Motor Driver
The L298N H-bridge: it controls the speed and direction of two DC motors. it can be used with motors that have a voltage of between 5 and 35V DC.
- DC motor 1 “+” > connect this the motor #1
- DC motor 1 “-” > connect this the motor #1
- 12v jumper > keep this connected to enable the 5v regulator.
- Power Source > Connect your battery positive here
- GND > connect this the battery negative
- 5v output (if 12v jumper in place) > connect the sensors here
- DC motor 1 enable jumper > Remove the jumper and connect it to the Arduino this is used to control the speed of motor 1 (match it to the code).
- IN1 Direction Control > connect it to the Arduino this is used to control the direction of motor 1 (match it to the code).
- IN2 Direction Control > connect it to the Arduino this is used to control the direction of motor 1 (match it to the code).
- IN3 Direction Control > connect it to the Arduino this is used to control the direction of motor 2 (match it to the code).
- IN4 Direction Control > connect it to the Arduino this is used to control the direction of motor 2 (match it to the code).
- DC motor 2 enable jumper > Remove the jumper and connect it to the Arduino this is used to control the speed of motor 2 (match it to the code).
- DC motor 2 “+” > connect this the motor #2
- DC motor 2 “-” > connect this the motor #2
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Battery
I used 12v Battery with 1300 mAh.
Note:Remember to connect all grounds to a common Ground to the battery negative.
Step 3: Coding
Code flow:
- defining the pins
- defining output and input pins
- check sensors' readings
- use sensors' reading to define walls
- check first route (if it was left then follow the left wall, if it's right follow the right wall)
- Use PID to avoid hitting the walls and to control motors' speed
1- first_turn = false ;
2- rightWallFollow = false ;
3- leftWallFollow = false ;
first_turn = true ;
rightWallFollow = true ;
leftWallFollow = false ;
if you want it to follow the left wall:
first_turn = true ;
rightWallFollow = false ;
leftWallFollow = true ;
Step 4: PROJECT RREPORT
The Arduino Maze Solving Robot project focuses on the integration of analog electronics concepts with microcontroller-based robotics to solve a maze autonomously. The robot utilizes various analog and digital sensors, actuators, and control algorithms to navigate through a predetermined path in a maze, demonstrating practical applications of analog electronics, signal conditioning, and control systems in robotics.
https://github.com/SiD4422/Arduino-Maze-Solving-Robot