Introduction: Use of Motion Sensor With RaspberryPi and Telegram Bot

Picture of Use of Motion Sensor With RaspberryPi and Telegram Bot

Hi guys.

In this post we are going to be using Raspberry Pi Telegram Bot with PIR(motion) sensor.

Step 1: Connect PIR

Picture of Connect PIR

I had a PIR sensor before and I wanted to use my PIR sensor with Raspberry Pi. I followed a guide here is the link :"

Step 2: How to Create a Telegram Bot

Picture of How to Create a Telegram Bot

Click this link for “How to create a Telegram Bot”

Creating a new bot
Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot. The name of your bot is displayed in contact details and elsewhere. The Username is a short name, to be used in mentions and links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot's username must end in ‘bot’, e.g. ‘tetris_bot’ or ‘TetrisBot’.

The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API.

Generating an authorization token If your existing token is compromised or you lost it for some reason, use the /token command to generate a new one.

Step 3: Bot and Raspberry Pi

Picture of Bot and Raspberry Pi

Raspberry Pi connect ssh

git clone

cd RaspberryPiTelegramPIR/


CTRL+X and save exit nano

sudo python

Github Link:

Original post:

Step 4:


Swansong (author)2017-01-18

Thanks for sharing :)