Skip to content

ProjectifyOfficial/Door-lock-unlock-via-telegram

Repository files navigation

Door-lock-unlock-via-telegram

DIFFICULTY LEVEL:EASY

Telegram home

materials

  • Raspberry pi – mini computer
  • Streaming camera or Raspberry pi camera
  • Servo motor – to control the lock
  • LED Lights – to show the lock condition (open/close)
  • Software(Language):
  • Python
  • Telepot, Motion

Setting up Pi

install Rasbian to Raspebbry pi with two options

Install Motion Software

To work with the Pi Camera you need a special version of Motion that supports MMAL cameras. The easiest way to install this is by downloading and installing a deb file as follows:

I followed the instructions provided in this great tutorial by Bouvet. With some changes described below.

First get the deb file with the following command (if this doesn’t work then have a look for the correct release file on the Motion project GitHub)

Then run this commands on Terminal

sudo apt-get install gdebi-core
sudo gdebi pi_stretch_motion_4.1.1-1_armhf.deb

try to run motion: type this command to terminal

to make copy

mkdir ~/motion && cp /etc/motion/motion.conf ~/motion/

run for the first time

motion -c ~/motion/motion.conf

set up motion.connf for our project

change codes on motion.conf // i uploaded motion.conf already changed you look for this also

getting live streaming

with this configuration, you should see the live streaming from this URL: http://192.168.1.27:8081

Communication with motion via telegram

Receiving the motion detection by emails is fine, but it can be done via Telegram and the awesome API telepot. Actually, you can even send commands to your pi using your phone using those telegram bots.

create mybot

here is great tutorial for this

install telepot

pip install telepot

after installing telepot . Now if the both listen_bot.py and motion -c ~/motion/motion.conf are running, the system should work.

creating service

ere, the following is working, but I am sure this is the right way to do, so use we care. add the file listen.service in the folder /etc/systemd/system and type thsese codes. Screenshot

run the service
pi@raspberrypi:/etc/systemd/system $ service listen status

here is example of motion detected

Screenshot

Setting up Servo and LED

set up servo and LED to GPIO by following this picture

Screenshot

Test your code

Screenshot

Finally build model of the door

Screenshot Screenshot

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages