Skip to content

HC-SR501 + ESP-32 + Telegram equals a motion sensor alarm!

License

Notifications You must be signed in to change notification settings

imharvol/hc-sr-501-esp-32-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HC-SR501 + ESP-32 + Telegram

HC-SR501 + ESP-32 + Telegram equals a motion sensor alarm! Also serves as a good introduction to the ESP-IDF, the official development framework for the ESP-32. The HC-SR501 detects the motion, the ESP-32 sends an HTTP request to the Telegram API which then relays the message to you.

Made with ESP-IDF and PlatformIO.

Pinout

HC-SR501 ESP-32
GND GND
OUT G26
VCC 5V

If you want HC-SR501 - OUT to connect to another GPIO. Change the variable SENSOR_GPIO with with one of these values https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#_CPPv410gpio_num_t.

Variables

Before using, you should change the following variables:

  • ESP_WIFI_SSID: WiFi SSID.
  • ESP_WIFI_PASS: WiFi password.
  • TG_AUTH_TOKEN: Telegram bot auth token. See https://core.telegram.org/bots/api#authorizing-your-bot.
  • TG_TARGET_CHAT_ID: Telegram chat id where you want the alerts to be sent. If you don't know how to get the chat id, start the bot @RawDataBot and use the value in message.chat.id.

Credits

About

HC-SR501 + ESP-32 + Telegram equals a motion sensor alarm!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published