ESP32 Door Control System Using a Push Button

ESP32 07-04-25
48 0

Tutorial plan

1- How Open a door with ESP32 and push button ?

2- Required Components

3- Circuit Connections of system

4- Micropython program to control the door

 

 

How Open a door with ESP32 and push button ?

This project allows a user to control the opening and closing of a door using a simple push button. The ESP32 microcontroller handles the logic, a servo motor performs the mechanical door movement, and an I2C LCD display provides real-time visual feedback. This setup simulates an automated door mechanism, ideal for educational or prototype smart home applications.

How It Works (Functioning Step-by-Step):

1- System Initialization:

- When the ESP32 is powered on, it initializes all components.

- The LCD I2C display shows a welcome message (e.g., “System Ready” or “Door Closed”).

2- Idle State (Door Closed):

- The servo motor is set to its “closed” position (e.g., 90°, depending on how the door mechanism is designed).

- The LCD displays: Door Closed.

3- Button Press Detection:

- The ESP32 constantly checks for a signal from the push button.

4- Opening the Door:

- When the button is pressed, the ESP32 triggers the door to open.

- The servo motor rotates to its “open” position (e.g., 20°).

- The LCD updates to show: Opening... followed by Door Open.

5- Closing the Door Automatically:

- When the button is pressed again, the ESP32 triggers the door to close.

- the servo motor moves back to the “closed” position.

- The LCD displays: Closing... then Door Closed.

 

Required Components

ESP32 Card

The ESP32 card acts as the brain of the system, controlling all inputs and outputs.

Push Button

The push Button is used by the user to trigger the opening or closing of the door.

LCD I2C Display

Pinouts of 1602 LCD display with I2C

The LCD I2C Display Shows the current status of the door (e.g., "Door Closed", "Opening...", "Door Open", etc.).

Servo Motor

The servo motor opens and closes the door by rotating to a specific angle.

10kΩ Resistor (Pull-Down Resistor)

Résistance

A 10kΩ resistor is used to stabilize the push button input.

Breadboard

Breadboard

The Breadboard Connects components like the servo motor, LCD screen, and ESP32.

Wires and Jumpers

Fils de connexion

Ensure proper routing of power, ground, and data signals.

Wooden house prototype

- Represents a real-life house model with a door that opens and closes.

- The servo motor is mounted inside the house, controlling the door movement.

- The LCD screen is attached to the exterior for status display.

Circuit Connections of system

Connection of I2C LCD display

LCD I2C Pin

ESP32 pin

VCC

5 volt

GND

GND

SDA

GPIO 21

SCL

GPIO 22

Connection of servo motor

Servo motor

ESP32

Brown wire (-)

GND

Red wire (+)

5V

Yellow wire (Signal)

GPIO 23

Connection of push button

- Connect a leg of button between 10kΩ Resistor and GND pin of ESP32

- Connect the same leg of button to GPIO 19 of ESP32

- Connect another leg of button to 3V3 pin of ESP32

 

Micropython program to control the door

Before running the code, install the necessary libraries:

- Servo (for servo motor)

- i2c_lcd and lcd_api for I2C LCD screen

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info