A wireless autonomous robot that uses the A* pathfinding algorithm to navigate a grid, communicating between a Python script and an ESP32 microcontroller over WiFi.
This project combines pathfinding algorithms with embedded systems to create a robot that can autonomously navigate from a start position to a goal while avoiding obstacles.
The system consists of two main components:
- Python (Laptop) — Runs A* algorithm, generates optimal path, converts path to motor commands and sends them wirelessly to the robot
- C++ (ESP32) — Receives commands over WiFi and controls motors to physically navigate the grid
- A* algorithm finds optimal path on a grid map
- Path is converted to physical commands (F, L, R)
- Commands sent wirelessly via WiFi TCP socket
- ESP32 receives commands and drives motors accordingly
- Robot navigates from start to goal
- ESP32 microcontroller
- L298N dual motor driver
- 2x DC motors
- 3x AA batteries (ESP32 power)
- 9V battery (motor power)
- Python 3 (pathfinding + communication)
- Arduino IDE / C++ (ESP32 firmware)
- Protocol: WiFi TCP Socket
- Port: 8080
- Commands: F (forward), R (turn right), L (turn left)
- Responses: OK (success), BLOCKED (obstacle detected)
A* uses Manhattan distance heuristic to find the optimal path. The grid supports configurable maps with obstacles, start and goal positions. Path is converted to physical robot commands accounting for robot orientation.
pip install socket
python Astar.py- Open Arduino IDE
- Install ESP32 board package
- Update WiFi credentials in code
- Upload to ESP32
├── Astar.py # Python A* implementation + WiFi communication
├── esp32_robot.ino # ESP32 motor control + WiFi server
└── README.md
- Add ultrasonic sensors for real time obstacle detection
- Implement dynamic replanning when obstacles detected
- Add camera for position feedback
- Expand to larger grid sizes
To ensure you know your ESP32 IP Address use the file Finding-IP-Address-For-ESP32-For-Wireless-Connection.ino so you can find your IP Address for your board. I am using wifi as a wireless communication between the ESP32 and laptop. To connect the ESP32 wirelessly using wifi use the example code in arduino or even my uploaded code. A blue light should start flickering. Remember to press the EN/Reset button on the ESP32 so that it can tell you the IP Address before you can connect to it using whatever methods you require.