It's 3rd Year, 5th Semester, Microcontroller Lab Project
The ESP32 Surveillance Car project combines the capabilities of the ESP32-CAM module and L298N motor driver to create a Wi-Fi-controlled car equipped with a camera for surveillance. The project includes pan-tilt camera control, car movement, adjustable light intensity, and a live video feed accessible via a web interface.
- Camera Stream
- Live video stream available over Wi-Fi.
- Adjustable pan and tilt angles for the camera.
- Car Movement Control
- Forward, backward, left, and right movements.
- Adjustable motor speed using PWM.
- Center steering control.
- Light Control
- Adjustable light brightness using PWM.
- User Interface
- Accessible web interface for control and video streaming.
- Cross-platform compatibility.
- Additional Controls
- Pan-tilt camera movement.
- Car steering and speed adjustments.
- ESP32-CAM Module
- Wi-Fi-enabled microcontroller with camera functionality.
- L298N Motor Driver
- Dual H-bridge driver for motor control.
- Servo Motors
- Used for pan and tilt camera movement and car steering.
- Power Supply
- External power source for ESP32 and motors.
- Miscellaneous
- Jumper wires, breadboard, etc.
Component | ESP32 Pin | Description |
---|---|---|
Camera PWDN | GPIO 32 | Power-down control |
Camera RESET | GPIO -1 | Reset (not used) |
Camera XCLK | GPIO 0 | External clock input |
Motor IN1 | GPIO 13 | Motor direction 1 |
Motor IN2 | GPIO 15 | Motor direction 2 |
Motor ENA | GPIO 12 | Motor speed control |
Steering Servo | GPIO 14 | Servo control |
Pan Servo | GPIO 2 | Pan servo control |
Tilt Servo | GPIO 4 | Tilt servo control |
Light PWM | GPIO 16 | Adjustable light PWM |
esp_camera.h
: For ESP32-CAM camera control.WiFi.h
: For Wi-Fi connectivity.esp_http_server.h
: HTTP server for hosting the web interface.ESP32Servo.h
: Servo motor control.
- Web Server Initialization
- Hosts a web page for controlling the car and viewing the video stream.
- Camera Stream Handling
- Captures frames from the camera and sends them to the client.
- Car Control
- Implements motor control for forward, backward, left, and right movements.
- Uses PWM for speed adjustments.
- Pan-Tilt Control
- Adjusts the pan and tilt angles of the camera using servo motors.
- Light Brightness Adjustment
- Controls light intensity using PWM.
The web interface includes:
- Live video stream.
- Buttons for car and camera control.
- Sliders for speed and brightness adjustments.
- Main File (
setup
andloop
):- Configures the ESP32-CAM, initializes the web server, and sets up GPIO pins.
- HTTP Handlers:
index_handler
: Serves the HTML page.stream_handler
: Handles the video stream.cmd_handler
: Processes commands for car movement, camera angles, and light adjustments.
- Hardware Setup
- Connect the ESP32-CAM module, L298N motor driver, servo motors, and power supply as per the pin configuration table.
- Software Setup
- Install Arduino IDE and configure ESP32 board support.
- Upload the provided code to the ESP32-CAM module.
- Network Configuration
- Update the Wi-Fi credentials (
ssid
andpassword
) in the code.
- Update the Wi-Fi credentials (
- Power on the system.
- Connect to the ESP32’s Wi-Fi network.
- Open the web interface using the ESP32’s IP address in a browser.
- Use the web interface to control the car and view the live video stream.
- No Video Stream
- Check the camera connections.
- Ensure the ESP32 is connected to Wi-Fi.
- Car Not Moving
- Verify motor connections.
- Check the power supply.
- Servo Motors Not Working
- Ensure correct GPIO pin connections.
- Test with a known working servo.
- Obstacle Detection
- Integrate ultrasonic sensors for autonomous navigation.
- Battery Monitoring
- Add battery voltage monitoring and alerts.
- Mobile App Control
- Develop a mobile application for enhanced user experience.
- Additional Sensors
- Include environmental sensors for data collection.
-
ESP32-CAM Documentation
-
Arduino Servo Library
-
L298N Motor Driver Datasheet
-
https://randomnerdtutorials.com/esp32-dc-motor-l298n-motor-driver-control-speed-direction/