Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-CAM Wi-Fi Controlled Battery-Powered Robotic Car

View and Edit Project In Cirkit DesignerImage of ESP32-CAM Wi-Fi Controlled Battery-Powered Robotic Car

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to control a Wi-Fi-enabled car with a camera using an ESP32-CAM microcontroller. The circuit includes various components such as DC motors, a power regulator, a rocker switch, and capacitors. The ESP32-CAM is programmed to control the motors and capture images, which can be viewed and controlled via a web interface.

Component List

ESP32-CAM

3.7V Battery

DC Motor

MP1584EN Power Regulator Board

Drv8833

Rocker Switch

Electrolytic Capacitor

Resistor

Wiring Details

ESP32-CAM

3.7V Battery

DC Motor (Instance 1)

DC Motor (Instance 2)

DC Motor (Instance 3)

MP1584EN Power Regulator Board

Drv8833 (Instance 1)

Drv8833 (Instance 2)

Rocker Switch

Electrolytic Capacitor (100 Farads)

Electrolytic Capacitor (0.1 Farads)

Documented Code

ESP32-CAM Code

#include "esp_camera.h"
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <iostream>
#include <sstream>

struct MOTOR_PINS
{
  int pinEn;  
  int pinIN1;
  int pinIN2;    
};

std::vector<MOTOR_PINS> motorPins = 
{
  {12, 13, 15},  //RIGHT_MOTOR Pins (EnA, IN1, IN2)
  {12, 14, 2},  //LEFT_MOTOR  Pins (EnB, IN3, IN4)
};
#define LIGHT_PIN 4

#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
#define STOP 0

#define RIGHT_MOTOR 0
#define LEFT_MOTOR 1

#define FORWARD 1
#define BACKWARD -1

const int PWMFreq = 1000; /* 1 KHz */
const int PWMResolution = 8;
const int PWMSpeedChannel = 2;
const int PWMLightChannel = 3;

//Camera related constants
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27
#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

const char* ssid     = "MyWiFiCar";
const char* password = "12345678";

AsyncWebServer server(80);
AsyncWebSocket wsCamera("/Camera");
AsyncWebSocket wsCarInput("/CarInput");
uint32_t cameraClientId = 0;

const char* htmlHomePage PROGMEM = R"HTMLHOMEPAGE(
<!DOCTYPE html>
<html>
  <head>
  <meta name="viewport" content="width=device-width, initial-scale=1,