Arduino | Maze Solving Robot

by siddharth18018993 in Circuits > Arduino

91 Views, 1 Favorites, 0 Comments

Arduino | Maze Solving Robot

WhatsApp Image 2024-11-08 at 02.58.45_bccaf51e.jpg

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: Parts

WhatsApp Image 2024-11-08 at 01.08.28_b9fcaf5d.jpg
FGT8TB5JBWJZ0JE-removebg-preview.png
Screenshot 2024-11-10 123539.png
Screenshot 2024-11-10 123551.png
Screenshot 2024-11-10 123604.png
Screenshot 2024-11-10 123610.png
Screenshot 2024-11-10 123615.png

Parts List:

  1. Arduino UNO
  2. 12v DC motors (x2)
  3. Wheels (x2)
  4. Motor Driver (L298N)
  5. Distance Sensor (Ultra Sonic)
  6. Wires (Jumper wires 1-pin male-male)
  7. 12v Battery (1300 mAh)
  8. Switch


Building/Wiring

FJ2YY4BLK6VM6T9.png
WhatsApp Image 2024-11-06 at 22.23.01_fe73bfe8.jpg
WhatsApp Image 2024-11-06 at 22.21.19_1446a33a.jpg
WhatsApp Image 2024-11-06 at 22.11.56_27fec8c6.jpg
WhatsApp Image 2024-11-06 at 22.20.42_c1526712.jpg

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:

  1. GND: connect this to the Ground.
  2. VCC: connect to the power source 5 voltages.(Alert! if you connect it to more than 5v it will be damaged)
  3. Echo: connect this to any pin on the Arduino. (match it to the code)
  4. 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.

  1. DC motor 1 “+” > connect this the motor #1
  2. DC motor 1 “-” > connect this the motor #1
  3. 12v jumper > keep this connected to enable the 5v regulator.
  4. Power Source > Connect your battery positive here
  5. GND > connect this the battery negative
  6. 5v output (if 12v jumper in place) > connect the sensors here
  7. 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).
  8. IN1 Direction Control > connect it to the Arduino this is used to control the direction of motor 1 (match it to the code).
  9. IN2 Direction Control > connect it to the Arduino this is used to control the direction of motor 1 (match it to the code).
  10. IN3 Direction Control > connect it to the Arduino this is used to control the direction of motor 2 (match it to the code).
  11. IN4 Direction Control > connect it to the Arduino this is used to control the direction of motor 2 (match it to the code).
  12. 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).
  13. DC motor 2 “+” > connect this the motor #2
  14. 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.

Coding

Screenshot 2024-11-06 223625.png

Code flow:

  1. defining the pins
  2. defining output and input pins
  3. check sensors' readings
  4. use sensors' reading to define walls
  5. check first route (if it was left then follow the left wall, if it's right follow the right wall)
  6. 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 ;

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

Downloads