top of page
Writer's pictureSanskruti Ashtikar

Automatic Door Opening System Using PIC Microcontroller

Introduction


In today’s world, automation has become an integral part of our daily lives. One practical application of automation is an automatic door opening system, which uses sensors and a microcontroller to detect the presence of a person and open the door automatically. Such systems are commonly found in shopping malls, hotels, and other public places. In this article, we will explore how to design an automatic door opening system using a PIC microcontroller.


Overview of the Project


The automatic door opening system consists of several components, including a Passive Infrared (PIR) sensor, a PIC microcontroller, a motor driver, and a DC motor. The PIR sensor detects the motion of a person approaching the door, and the microcontroller processes this information to control the DC motor, which opens or closes the door. The entire process is efficient and minimizes manual effort.


Components Required


  • PIC Microcontroller (PIC16F877A): The brain of the project, responsible for processing the input from the PIR sensor and controlling the motor.

  • PIR Sensor: Detects infrared radiation emitted by a person, signaling the microcontroller to open the door.

  • DC Motor: Drives the door mechanism to open and close the door.

  • Motor Driver (L293D): Acts as an interface between the microcontroller and the DC motor, allowing the microcontroller to control the motor's operation.

  • Power Supply: Provides the necessary power to the microcontroller and other components.

  • Connecting Wires: For making connections between different components.

  • Breadboard/PCB: For assembling the circuit.

  • Resistors, Capacitors, and Diodes: Additional components for filtering and protection.


Circuit Diagram


Below is a basic circuit diagram for the automatic door opening system:

PIR Sensor      -->   PIC16F877A   -->   Motor Driver (L293D)   -->   DC Motor
                  |                  |
             Power Supply       Power Supply
  1. PIR Sensor to PIC Microcontroller:

  2. The output of the PIR sensor is connected to an input pin of the PIC16F877A.

  3. The sensor’s Vcc and GND are connected to the power supply.

  4. PIC Microcontroller to Motor Driver:

  5. The output pins of the PIC16F877A are connected to the input pins of the motor driver L293D.

  6. Enable pins of the L293D are connected to the microcontroller to control the motor's operation.

  7. Motor Driver to DC Motor:

  8. The output pins of the L293D are connected to the DC motor.

  9. Power Supply:

  10. The PIC microcontroller, motor driver, and PIR sensor are all powered by a suitable DC power supply, typically 5V or 12V, depending on the components.


Working Principle


  1. Detection:

  2. When a person approaches the door, the PIR sensor detects their motion by sensing the infrared radiation emitted from the person’s body.

  3. The PIR sensor sends a HIGH signal to the PIC microcontroller.

  4. Processing:

  5. The PIC microcontroller receives the signal from the PIR sensor. The microcontroller is programmed to process this input and send appropriate signals to the motor driver.

  6. If the PIR sensor sends a HIGH signal, the microcontroller activates the motor driver to rotate the DC motor in a direction that opens the door.

  7. Motor Operation:

  8. The L293D motor driver receives the control signals from the microcontroller and drives the motor accordingly.

  9. The door opens, and after a predefined time delay, the microcontroller sends a signal to the motor driver to reverse the motor’s direction, closing the door.

  10. Reset:

  11. After closing the door, the system resets, waiting for the next signal from the PIR sensor to repeat the process.


Programming the PIC Microcontroller


The microcontroller is programmed using Embedded C or Assembly language. Below is an example of a basic code snippet in Embedded C for this project:


#include <pic16f877a.h>


// Define pins
#define PIR_sensor RB0
#define Motor_pin1 RB1
#define Motor_pin2 RB2
// Function prototypes
void delay(unsigned int ms);
void main() {
    TRISB = 0x01; // Set RB0 as input and RB1, RB2 as output
    PORTB = 0x00; // Initialize PORTB
    while(1) {
        if (PIR_sensor == 1) { // If motion is detected
            Motor_pin1 = 1; // Rotate motor to open the door
            Motor_pin2 = 0;
            delay(5000); // Wait for 5 seconds
            Motor_pin1 = 0; // Rotate motor to close the door
            Motor_pin2 = 1;
            delay(5000); // Wait for 5 seconds
            Motor_pin2 = 0; // Stop the motor
        }
    }
}
void delay(unsigned int ms) {
    unsigned int i, j;
    for(i = 0; i < ms; i++)
        for(j = 0; j < 1275; j++);
}

Explanation of the Code


  • TRISB: Configures PORTB pins as input or output.

  • PIR_sensor: Represents the PIR sensor input pin.

  • Motor_pin1, Motor_pin2: Represent the control pins connected to the motor driver.

  • The main loop continuously checks if the PIR sensor detects motion. If motion is detected, the microcontroller controls the motor to open and close the door with a delay in between.


Advantages of the System


  • Convenience: Automatically opens the door without any manual effort.

  • Security: Can be integrated with security systems to restrict unauthorized access.

  • Energy Efficiency: The door only operates when needed, reducing unnecessary energy consumption.


Conclusion


An automatic door opening system using a PIC microcontroller is a simple yet effective project that demonstrates the practical application of microcontrollers in automation. By following the steps outlined in this article, you can build your own automatic door system, which can be further enhanced with additional features like remote control, access control, and more.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


4 views0 comments

Related Posts

See All

Comentarios


bottom of page