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

ESP32-Based Smart Arena System with IR Sensor, Keypad, and OLED Display

View and Edit Project In Cirkit DesignerImage of ESP32-Based Smart Arena System with IR Sensor, Keypad, and OLED Display

Circuit Documentation

Summary

This document provides a detailed overview of a circuit design that includes an ESP32 microcontroller, an IR sensor, a 4x4 membrane matrix keypad, a servo motor, an OLED display, two 12V relays, a loudspeaker, a 5V power supply unit (PSU), a 5V battery, a 12V power LED, and a buzzer. The circuit is designed to detect objects using the IR sensor, control relays and a servo motor, display information on an OLED screen, and provide audio feedback through a buzzer and loudspeaker.

Component List

  1. ESP32

    • Description: Microcontroller with Wi-Fi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
  2. IR Sensor

    • Description: Infrared sensor for object detection.
    • Pins: out, gnd, vcc
  3. 4x4 Membrane Matrix Keypad

    • Description: Keypad with 4 rows and 4 columns.
    • Pins: R1, R2, R3, R4, C1, C2, C3, C4
  4. Servo

    • Description: Servo motor for precise control of angular position.
    • Pins: GND, VCC, PWM
  5. OLED Display 2.42"

    • Description: 2.42-inch OLED display.
    • Pins: GND, VCC, SCK, SDA, RES, DC, CS
  6. 12V Relay

    • Description: Relay for switching high voltage devices.
    • Pins: NO, COM, NC, IN, DC-, DC+
  7. Loudspeaker

    • Description: Loudspeaker for audio output.
    • Pins: pin1, pin2
  8. 5V PSU

    • Description: 5V power supply unit.
    • Pins: 5V+, GND, 5V OK, PE, N, L
  9. 5V Battery

    • Description: 5V battery for power supply.
    • Pins: +, -
  10. Power LED 12V 10W 0.8-0.9A

    • Description: High-power LED.
    • Pins: +, -
  11. Buzzer

    • Description: Buzzer for audio feedback.
    • Pins: GND, IN

Wiring Details

ESP32

IR Sensor

4x4 Membrane Matrix Keypad

Servo

OLED Display 2.42"

12V Relay 1

12V Relay 2

Loudspeaker

5V PSU

5V Battery

Power LED 12V 10W 0.8-0.9A

Buzzer

Documented Code

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Keypad.h>
#include <ESP32Servo.h> // Use the correct Servo library for ESP32

// OLED display settings
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
#define SSD1306_I2C_ADDRESS 0x3C // Define the I2C address for the OLED
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Keypad settings
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {32, 33, 25, 26}; // Connect to the row pinouts of the keypad
byte colPins[COLS] = {27, 14, 12, 13}; // Connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

// Servo settings
Servo myservo;
const int servoPin = 15;

// IR sensor settings
const int irSensorPin = 34;

// Relay settings
const int relay1Pin = 19;
const int relay2Pin = 23;

// Buzzer settings
const int buzzerPin = 4;

void setup() {
  // Initialize serial communication
  Serial.begin(115200);

  // Initialize OLED display
  if(!display.begin