Advertisement

Sri Lanka's First and Only Platform for Luxury Houses and Apartment for Sale, Rent

Sunday, March 13, 2016

Home Security using Raspberry Pi + Web Cam + PIR Sensor and Telegram Bot

I saw a post in Hackaday.com which was about using Telegram API to control LEDs attached to a Raspberry Pi. Telegram is a messaging service similar to Watsapp but it allows a unique bot API to support its non human machine to machine communication. 

Because of this feature it is hacker friendly because the possibilities are only limited by imagination. I had a PIR sensor and a USB web camera lying around and thought it would be cool to put together something related to Telegram bot API using those.

In Sri Lanka CCTV cameras selling like hot cake and office and home security surveillance has become a high priority in the last couple of years. Because of this I thought it would be cool to put a Home security service for me using the aforementioned components. 

Thus came up with the following schematic.


And attached the USB camera to the Raspberry Pi's USB port. 


Finally a little bit of coding 




After installing all important Telegram messenger and creating a bot by going through the Documentation of Telegram, finally I managed to get the whole thing working together. You can see the application in action in the following video.



References
  1. Telegram on Raspberry Pi
  2. Raspberry Pi + PIR
  3. Telegram Bot Python Library
  4. Telegram Bots Introduction
  5. Standard Web Cam usage in Raspberry Pi

7 comments:

jade said...
This comment has been removed by a blog administrator.
Unknown said...


This is really a great post. Thank you for taking time to provide us some of the useful and exclusive information with us. Keep on blogging

Unknown said...

Hello,

i did exactly similar to what you did but it is not working. is it possible that you can help.

thank you

Unknown said...

when i run this code say me error :
in module of sendphoto ......................

if you can help me
i'm very need to this program

thank's for all
regards

Unknown said...

can you explain to me your program line of the line
what is token ="token"
thank salam from indonesia

Unknown said...

I have problem when i run the code...the output is
Traceback (most recent call last):
File "/home/pi/Desktop/homesecurity.py", line 21, in
bot = telegram.Bot(token = token)
AttributeError: 'module' object has no attribute 'bot'

Can your help me?
What is problem?

shazsterblog.blogspot.com said...

@Adi Surahman

Wahalaikum salam, token="token" is the Token for Telegram API. You can get it from Telegram