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 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 Pi. Raspberry 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.
- Raspberry Pi
- DC motor.
- L293d (Motor driving IC)
- Knowledge required:
- Python Programming.
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 192.168.1.1:5000
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.
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.