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

ESP32-WROOM-32UE Wi-Fi Controlled Robotic Car with OLED Display and RGB LED

View and Edit Project In Cirkit DesignerImage of ESP32-WROOM-32UE Wi-Fi Controlled Robotic Car with OLED Display and RGB LED

Circuit Documentation

Summary

This circuit is designed to control a pair of hobby gearmotors and an RGB LED using an ESP32 microcontroller. It also includes a 0.96" OLED display for visual feedback and a 7805 voltage regulator to ensure stable power supply. The circuit is powered by a 4 x AAA battery mount.

Component List

  1. Hobby Gearmotor with 48:1 gearbox

    • Pins: pin 1, pin 2
    • Description: A small DC motor with a 48:1 gearbox for increased torque.
    • Purpose: Used for driving the wheels of the robot.
  2. 0.96" OLED

    • Pins: GND, VDD, SCK, SDA
    • Description: A small OLED display for visual feedback.
    • Purpose: Displays status messages and other information.
  3. RGB LED (Wokwi compatible)

    • Pins: R, COM, G, B
    • Description: An RGB LED for visual indicators.
    • Purpose: Provides visual feedback using different colors.
  4. 4 x AAA Battery Mount

    • Pins: -, +
    • Description: Battery holder for four AAA batteries.
    • Purpose: Powers the entire circuit.
  5. Ceramic Capacitor

    • Pins: pin0, pin1
    • Description: A capacitor with a capacitance of 0.1 µF.
    • Purpose: Used for filtering and stabilizing the voltage.
  6. Resistor (100 Ohms)

    • Pins: pin1, pin2
    • Description: A resistor with a resistance of 100 Ohms.
    • Purpose: Current limiting for the RGB LED.
  7. Resistor (47 Ohms)

    • Pins: pin1, pin2
    • Description: A resistor with a resistance of 47 Ohms.
    • Purpose: Current limiting for the RGB LED.
  8. 7805 Voltage Regulator

    • Pins: Vin, Gnd, Vout
    • Description: A voltage regulator that outputs 5V.
    • Purpose: Provides a stable 5V supply to the circuit.
  9. L9110 Motor Driver

    • Pins: MOTOR B-A, MOTOR B-B, MOTOR A-A, MOTOR A-B, B-IA, B-IB, GND, VCC, A-IA, A-IB
    • Description: A motor driver for controlling two DC motors.
    • Purpose: Drives the hobby gearmotors.
  10. Electrolytic Capacitor

    • Pins: -, +
    • Description: A capacitor with a capacitance of 1 µF.
    • Purpose: Used for filtering and stabilizing the voltage.
  11. ESP32-WROOM-32UE

    • Pins: 3v3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, GND, 13, D2, D3, 5V, 23, 22, TX, RX, 21, 19, 18, 5, 17, 16, 4, 0, 2, 15, D1, D0, CKL
    • Description: A powerful microcontroller with WiFi and Bluetooth capabilities.
    • Purpose: Controls the entire circuit and handles communication.

Wiring Details

Hobby Gearmotor with 48:1 gearbox

0.96" OLED

RGB LED (Wokwi compatible)

4 x AAA Battery Mount

Ceramic Capacitor

Resistor (100 Ohms)

Resistor (47 Ohms)

Resistor (47 Ohms)

7805 Voltage Regulator

L9110 Motor Driver

Electrolytic Capacitor

ESP32-WROOM-32UE

Code Documentation

#include <WiFi.h>  //remember to download library
#include <Adafruit_SSD1306.h>

// Define pins for RGB LED and motor driver
#define RED_PIN 14
#define GREEN_PIN 12
#define BLUE_PIN 13
#define MOTOR_A1 26
#define MOTOR_A2 27
#define MOTOR_B1 25
#define MOTOR_B2 33
#define OLED_RESET -1

// Create an object for OLED
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

// WiFi settings
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";

WiFiServer server(80);

void setup() {
  // Initialize RGB LED pins
  pinMode(RED_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  pinMode(BLUE_PIN, OUTPUT);

  // Initialize OLED
  if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
    Serial.println(F("OLED initialization failed"));
    for (;;);
  }

  // Initialize serial communication
  Serial.begin(115200);

  // Set motor driver pins as output
  pinMode(MOTOR_A1, OUTPUT);
  pinMode(MOTOR_A2, OUTPUT);
  pinMode(MOTOR_B1, OUTPUT);
  pinMode(MOTOR_B2, OUTPUT);

  // Display "turned on" message and green light
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 25);
  display.println("TURNED ON");
  display.display();
  setRGBColor(0, 255, 0); // Green
  delay(3000);

  // Connect to WiFi
  display.clearDisplay();
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("Connecting to WiFi...");
  display.display();

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    flashBlue(); // Indicate no connection with flashing blue
    delay(500);
  }

  // Display connected message and set blue light
  display.clearDisplay();
  display.setTextSize(2);
  display.setCursor(10, 25);
  display.println("CONNECTED");
  display