ESP32-Controlled Smart Robot with Obstacle Avoidance and Smoke Detection
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates various components controlled by an ESP32 microcontroller to perform a range of functions including motion detection, distance measurement, audio playback, and motor control. The ESP32's GPIO pins are utilized to interface with sensors, a motor driver, and an I2C LCD display. A smoke sensor and a buzzer provide safety features, while a PIR motion sensor and an ultrasonic distance sensor enable environmental interaction. The L298N motor driver controls two sets of DC gearmotors for movement, and an ISD1820 voice module with a loudspeaker allows for audio output. The entire system is powered by a Lithium-ion battery.
Component List
- ESP32 (30 pin): A microcontroller with a variety of digital I/O pins, capable of Wi-Fi and Bluetooth communication.
- L298N DC Motor Driver: An H-bridge motor driver that allows for the control of two DC motors.
- LCD I2C Display: A display module with I2C communication for showing information.
- ISD1820: A voice record and playback module.
- Loudspeaker: An audio output device connected to the ISD1820.
- Servomotor SG92R: A small servo motor for precise angular movement.
- HC-SR505 Mini PIR Motion Sensing Module: A compact PIR sensor for motion detection.
- Gearmotor DC Wheels (Right and Left): DC motors with gear reduction used for driving wheels.
- Lithium-ion Battery 10000mAh: A rechargeable power source providing 11.1V.
- Buzzer: An audio signaling device.
- Sensor HC-SR04: An ultrasonic distance sensor.
- Smoke Sensor: A sensor for detecting smoke particles in the air.
Wiring Details
ESP32 (30 pin)
D34connected to Smoke Sensor DOD26connected to Buzzer PIND27connected to L298N DC Motor Driver IN4D14connected to L298N DC Motor Driver IN3D12connected to L298N DC Motor Driver IN2D13connected to L298N DC Motor Driver IN1GNDconnected to system groundVinconnected to system power (11.1V from Lithium-ion Battery)D23connected to Servomotor SG92R SIGD22connected to LCD I2C Display SCLD21connected to LCD I2C Display SDAD5connected to Sensor HC-SR04 ECHOD4connected to Sensor HC-SR04 TRIGD2connected to HC-SR505 Mini PIR Motion Sensing Module outD15connected to ISD1820 P-E3V3connected to ISD1820 VCC
L298N DC Motor Driver
OUT1andOUT2connected to Gearmotor DC Wheels Right12Vconnected to Lithium-ion Battery 11.1VGNDconnected to system ground5Vconnected to system power (11.1V from Lithium-ion Battery)OUT3andOUT4connected to Gearmotor DC Wheels Left
LCD I2C Display
GNDconnected to system groundVCCconnected to system power (11.1V from Lithium-ion Battery)SDAconnected to ESP32 D21SCLconnected to ESP32 D22
ISD1820
VCCconnected to ESP32 3V3GNDconnected to system groundP-Econnected to ESP32 D15Sp1connected to Loudspeaker pin1SP2connected to Loudspeaker pin2
Loudspeaker
pin1connected to ISD1820 Sp1pin2connected to ISD1820 SP2
Servomotor SG92R
SIGconnected to ESP32 D23VCCconnected to system power (11.1V from Lithium-ion Battery)GNDconnected to system ground
HC-SR505 Mini PIR Motion Sensing Module
+connected to system power (11.1V from Lithium-ion Battery)outconnected to ESP32 D2-connected to system ground
Gearmotor DC Wheels (Right and Left)
PIN1andPIN2of both right and left motors connected to respective L298N DC Motor Driver OUT pins
Lithium-ion Battery 10000mAh
11.1Vconnected to system powerGNDconnected to system ground
Buzzer
PINconnected to ESP32 D26GNDconnected to system ground
Sensor HC-SR04
VCCconnected to system power (11.1V from Lithium-ion Battery)TRIGconnected to ESP32 D4ECHOconnected to ESP32 D5GNDconnected to system ground
Smoke Sensor
DOconnected to ESP32 D34AOnot connectedGNDconnected to system groundVCCconnected to system power (11.1V from Lithium-ion Battery)
Documented Code
ESP32 Microcontroller Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Buzzer Microcontroller Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The code provided for the ESP32 and the buzzer is a template and does not contain any functional code. It needs to be populated with the logic required to control the circuit as per the design requirements.