./MEGABOT/MEGABOT.ino
-
ADD YOUR GAME FUNCTIONS IN THE APPROPRIATE EMPTY INITIALIZED FUNCTION
-
eg. add your maze function into the empty maze function in MEGABOT.ino
//Line: 335 void maze() { //ADD YOUR CODE HERE }
-
BattleBot is an autonomous and remotely controlled ESP32-based robot designed for competitive robotics tasks such as line tracking, maze solving, racing, and capture-the-flag (CTF) modes.
It integrates sensors, Wi-Fi networking, and OLED display feedback to execute intelligent navigation and combat behaviors.
-
Wi-Fi Control & Communication
- Operates as both a Wi-Fi Access Point and Station.
- Receives control commands via HTTP GET requests.
- Can scan nearby Wi-Fi networks for CTF gameplay logic.
-
Motion Control
- Forward, Backward, Turn Left, Turn Right, Stop.
- PWM motor control via ESP32 GPIO pins.
-
Line Tracking
- Dual light sensors for detecting black/white surface contrast.
- Adaptive calibration to determine optimal thresholds.
- Smooth turning and speed control for stable tracking.
-
Maze Navigation
- Uses VL53L0X (laser distance) and ultrasonic sensors.
- Autonomous decision-making for left/right turns and wall following.
-
Race Mode
- Dual ultrasonic sensors and front ToF sensor for high-speed obstacle avoidance.
-
Capture the Flag (CTF)
- Wi-Fi signal strength (RSSI) scanning to “find” other bots.
- Autonomous chase and escape strategies using signal proximity.
-
OLED Display Feedback
- Displays live sensor readings and calibration values.
Control the robot using HTTP commands or a web-based control panel.
Uses two line sensors to follow a black line on a white surface.
Displays calibration data on the OLED for sensor thresholds.
Uses VL53L0X and ultrasonic sensors to autonomously navigate through a maze by detecting obstacles and choosing optimal paths.
Combines ultrasonic and ToF sensors for high-speed racing and collision avoidance.
Uses Wi-Fi scanning (esp_wifi_scan_start) to locate other bots by SSID or RSSI signal strength.
The bot “chases” or “runs away” depending on signal proximity.
| Component | Description |
|---|---|
| ESP32 Dev Board | Main microcontroller |
| Adafruit VL53L0X | Time-of-Flight distance sensor |
| HC-SR04 Ultrasonic Sensors (x2) | For distance sensing during races/mazes |
| L298N / Motor Driver | Dual DC motor driver |
| DC Motors (x2) | Left and right motor drive |
| Line Tracking Sensors (x3) | For line-following mode |
| SSD1306 OLED Display | 128x32 display for telemetry |
| Battery Pack (7.4V–12V) | Power source |
Install the following Arduino libraries:
- WiFi.h (ESP32 core)
- Adafruit_SSD1306
- Adafruit_VL53L0X
- analogWrite.h (for ESP32 PWM)
- esp_wifi.h
- Wire.h
You can install them via the Arduino IDE Library Manager or PlatformIO.
Default network settings:
const char* ssid = "BattleBot";
const char* password = "43638253";
const char* ssidCTF = "Robot_B";