Raspberry pi based automatic door controller | Diy Project

By | February 18, 2018

The goal of this project is to control your door latch using your smartphone, with the help of raspberry pi 3, a smartphone and some basic engineering knowledge.

Raspberry Pi:

Raspberry Pi is commonly known as a general purpose full-fledged computer and can perform tasks like your desktop Pc. You can push your limits in coding and circuit making using Raspberry PiRaspberry Pi is used to perform higher-level processes and it can be assigned multiple numbers of tasks at a time. Such as:

  •  Designing a robot which performs multiple tasks.
  •  Performing intense calculations.
  •  Creating a web server.
Unlike Arduino Raspberry Pi runs on an Operating System called the “Linux” Operating System which is specifically designed for it and is known as the Rasbian. However other Operating Systems like Windows 10 or Android can also be installed on Raspberry Pi. In Raspberry Pi, you can interact with your program using external devices such as a keyboard and mouse, and you can also plug in a display. You can easily get access to input/output pins and can connect all types of devices including buzzers or whatever you may require. It was designed to improve programming skills and hardware understanding at the pre-university level. It is generally used by hobbyist for prototyping purpose.

Components required:

  1. Raspberry Pi
  2. DC motor.
  3. L293d (Motor driving IC)
  4. Breadboard.
  5. Knowledge required:
  6. Python Programming.
  7. HTML.

Let’s create a simple IOT project using python on raspberry pi to control door latch in your home. For this project, we will use FLASK a very simple micro-framework for python. With Flask, we can very easily control GPIO pins over the internet.

In this tutorial, we will be using Raspberry Pi as a local web server where we will control L293d via a simple web page. L293d is an H-Bridge motor driving IC, Used to control the direction of the motor.

Learn How to create a python web server by using Flask:

  • Open any python IDE (Thonny or Geany).
  • Download and open The Source Code file. What this code does is it create the backend of our website. It tells the server what it has to do when a user presses the open or close button.
  • Now create an HTML file for user interface by copying the given HTML code in text editor and save it with index.html name (  Download index.html file )
  • You can also customize your webpage by adding CSS like I did to make it more attractive.

What this HTML code does it send the server two conditions either open or close and accordingly server functions Now to run our website we need to host the server for that we need our raspberry pi’s ip address.

  • To Know ip address of your Raspberry pi just type: ifconfig in a terminal window and copy the ip address.
  • Then run the python file by typing: sudo python index.py (index.py or sourcecode.py)
  • Now open the web browser and type: (Your ip Address):5000  — Like

Your website will open now you can click buttons to command the pi to work accordingly.To control the door latch I have used slider crank mechanism it converts rotary motion of the motor to linear motion to move the latch. It is a small taste of what you can do with python and raspberry pi. By taking it to next stage you can also control your household appliances on your smartphone and many more. This project can be implemented anywhere in home, office or garage doors.

Schematic Diagram:

Click Here To Download Source Code 


Project Copyrights Mr.Vishal Agarwal, he is from India currently pursuing  Electronic and Telecommunication Engineering. He love to play with embedded system. His most and favorite programming language is Python. 

Leave a Reply

Your email address will not be published. Required fields are marked *