Touchless Automatic Door System
ESP32-S3 Automation, IR Obstacle Detection & Servo Motor Actuation
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.
Procure the following core components to build this touchless entry prototype platform:
| Target Component Label | Structural Allocation Quantity | Functional Deployment Purpose |
|---|---|---|
| ESP32-S3 Board | 1 Unit | Main microcontroller handling ADC polling, driving the I2C OLED frame, and commanding PWM lines. |
| IR Obstacle Sensor | 1 Unit | Emits and catches infrared bursts to verify proximity clearance without touch. |
| SG90 Servo Motor | 1 Unit | Precision rotational steering actuator driving the mechanics of the door position. |
| 0.96" SSD1306 OLED (I2C) | 1 Unit | Local diagnostic matrix rendering clear sensor states and open/close readouts. |
| Jumper Wires & Breadboard | 1 Set | Signal path routing jumpers and prototyping power rails. |
Wire your hardware prototype precisely matching these designated digital and analog configuration pins:
| Sensor / Module Output Pin | ESP32 Target Pin Mapping | Functional Context |
|---|---|---|
| IR Sensor Signal Out | Digital Input Pin GPIO 14 | Polls for human presence interrupts |
| Servo PWM Control Line | Digital Output Pin GPIO 41 | Pushes high-speed timing sweeps to the actuator |
| OLED Display SDA | I2C Data Pin GPIO 20 | Serial data stream pipeline |
| OLED Display SCL | I2C Clock Pin GPIO 21 | Synchronized clock cycle signal |
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
}
Adafruit GFX Library, Adafruit SSD1306, and the ESP32Servo toolkit into your local framework workspace before clicking the compile engine button.

0 Comments