ESP32 Cam Motion detect | Send captured image to Telegram - Black keyhole

welcome to our keyhole, we provide you various knowledge from various sources such as Electric&Electronic, Health, Arduino, IOT, Diy projects, A/l past paper and model paper, Even though you can keep in touch with current technology

ESP32 Cam Motion detect | Send captured image to Telegram

Share This


In this project we’ll create a Telegram bot for the ESP32-CAM that allows you to control your board from anywhere to request a photo, sensor readings or control the flash. Additionally, you’ll receive a notification with a new photo whenever motion is detected.



ESP32-CAM board

Bread board

PIR sensor

FTDI prpgrammer



ESP32-CAM Telegram Bot

To control the ESP32-CAM shield, we need create Telegram bot, so that you can control your ES32-CAM from any part of the world.



3v3     vin

Gpio13 input

Gnd   gnd



  • check here my previous tutorials
  1.  ESP32-CAM Face detection|Face Recognition    
  2. Machine to Machine Interactions
  3.  mesh networking- explained



Creating a Telegram Bot

Go to Google Play or App Store, Download and Install Telegram

search for “botfather” and click that

The window should open and you’ll be prompted to click the start button.

Type /newbot. Give it a name and username.

If your bot is successfully created, you’ll receive a message with a link to access the bot and the bot token. Save the bot token that will use in code part.


You can make Bussiness queries by using the business queries section. You can find that at the bottom of this page

  • You can make queries related to place ads, product placement, and advertising
  • make project queries related to DIY project section (college and school students for their projects)

Get Your Telegram User ID

Anyone that knows your bot username can interact with it. To make sure that we ignore messages that are not from our Telegram account (or any authorized users), you can get your Telegram User ID. Then, when your telegram bot receives a message, the ESP can check whether the sender ID corresponds to your User ID and handle the message or ignore it.

In your Telegram account, search for “IDBot”

Start a conversation with that bot and type /getid. You will get a reply back with your user ID. Save that user ID, because you’ll need it later in this tutorial.


 Download the link for code


Preparing Arduino IDE

Before you go to upload the code you need to download the following library  

  1. Click here to download the Universal Arduino Telegram Bot library.
  2. Go to Sketch Include Library > Add .ZIP Library...
  3. Add the library you’ve just downloaded. 

Follow the next steps to install the ArduinoJson library.

1.    Go to Sketch Include Library > Manage Libraries.

2.   Search for “ArduinoJson”.

3.   Install the library.


 Upload Code to the ESP32-CAM

Check my previous post here that how to upload code to ESP32-CAM


After that, open your Telegram account and test your board. You can see that when any mosition is detected by pir, the ESP32-CAM alows to take an image and it would send that image to your telegram bot 

Hope you have liked this post and  don't forget to share this post who aspire to  make these kind of project

No comments:

Post a Comment

business queries