Header Ads Widget

Responsive Advertisement

Touchless-Automatic-Door-System-using-ESP32-IR-Sensor-Servo-Motor-and-OLED-Display-main

Touchless Automatic Door System

ESP32-S3 Automation, IR Obstacle Detection & Servo Motor Actuation

📊 Operational Overview & Video Guide System Live Demo

This automated access gate leverages an IR obstacle detection sensor to identify approaching traffic without physical touch. When the sensor line changes to a detected state, the ESP32 command loop signals the server actuator to perform a swift 90-degree sweep to lift or swing open the barrier mechanism. Status readouts are pushed instantly onto a high-contrast I2C OLED subscreen.

Sensor Default State
⚡ Logic LOW (0V) triggers on object presence
Gate Positioning Bounds
🔄 0° for Locked/Closed | 90° for Open Access
🛠️ Structural BOM Requirements Hardware List

Procure the following core components to build this touchless entry prototype platform:

Target Component Label Structural Allocation Quantity Functional Deployment Purpose
ESP32-S3 Board1 UnitMain microcontroller handling ADC polling, driving the I2C OLED frame, and commanding PWM lines.
IR Obstacle Sensor1 UnitEmits and catches infrared bursts to verify proximity clearance without touch.
SG90 Servo Motor1 UnitPrecision rotational steering actuator driving the mechanics of the door position.
0.96" SSD1306 OLED (I2C)1 UnitLocal diagnostic matrix rendering clear sensor states and open/close readouts.
Jumper Wires & Breadboard1 SetSignal path routing jumpers and prototyping power rails.
🔌 Device Interface Pin Maps I/O Infrastructure

Wire your hardware prototype precisely matching these designated digital and analog configuration pins:

Complete Device to ESP32 Pin Mapping Architecture:
Sensor / Module Output PinESP32 Target Pin MappingFunctional Context
IR Sensor Signal OutDigital Input Pin GPIO 14Polls for human presence interrupts
Servo PWM Control LineDigital Output Pin GPIO 41Pushes high-speed timing sweeps to the actuator
OLED Display SDAI2C Data Pin GPIO 20Serial data stream pipeline
OLED Display SCLI2C Clock Pin GPIO 21Synchronized clock cycle signal
💻 Optimized Production Code Engine Firmware Source

Copy and flash this highly efficient firmware directly onto your target hardware platform via the Arduino IDE workspace:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP32Servo.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1

#define IR_SENSOR_PIN 14
#define SERVO_PIN 41

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Servo doorServo;

bool doorOpen = false;

void setup()
{
    Serial.begin(115200);

    pinMode(IR_SENSOR_PIN, INPUT);

    // Custom I2C Bus Mapping for ESP32 Pins
    Wire.begin(20, 21);

    if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
    {
        Serial.println("OLED Failed!");
        while (1);
    }

    display.setTextColor(SSD1306_WHITE); // Text visualization toggle

    doorServo.attach(SERVO_PIN);
    doorServo.write(0); // Lock initial boundary to zero

    display.clearDisplay();
    display.display();

    Serial.println("Automatic Door System Started");
}

void loop()
{
    // Reading 0 (LOW) or 1 (HIGH) from module output
    int irValue = digitalRead(IR_SENSOR_PIN);

    // Most IR sensors output LOW (0) when an object is detected
    if (irValue == LOW) 
    {
        if (!doorOpen)
        {
            doorServo.write(90); // Trigger clear access sweep
            doorOpen = true;
            Serial.println("Object Detected -> Door OPEN");
        }
    }
    else // Sensor reads HIGH (1), meaning path is clear
    {\n        if (doorOpen)
        {
            doorServo.write(0); // Relock gate perimeter
            doorOpen = false;
            Serial.println("Path Clear -> Door CLOSED");
        }
    }

    // Process local diagnostics on screen matrix
    display.clearDisplay();
    display.setTextSize(1);

    display.setCursor(0, 0);
    display.println("AUTO DOOR SYSTEM");

    display.setCursor(0, 20);
    display.print("Sensor: ");
    if (irValue == LOW) {
        display.println("DETECTED");
    } else {
        display.println("CLEAR");
    }

    display.setCursor(0, 40);
    display.print("Door  : ");
    if (doorOpen) {
        display.println("OPEN");
    } else {
        display.println("CLOSED");
    }

    display.display();
    delay(100); // Frame buffer loop debounce
}
Required Software Dependencies: Ensure that you add Adafruit GFX Library, Adafruit SSD1306, and the ESP32Servo toolkit into your local framework workspace before clicking the compile engine button.

Post a Comment

0 Comments