It's Arduino code for NodeMCU ESP8266 client with a motion sensor. You can use any model you want.
-
Create your env file from
env.cpp.example
:#include <Arduino.h> #include "env.h" const char* wifi_ssid = ""; const char* wifi_password = ""; const String alert_url = ""; const uint8_t alert_url_fingerprint[20] = {};
-
Set proper alert URL with it's SHA1 fingerprint. For example, you can use Telegram Bot API.
-
Upload the project to your device.
- Connect to WiFi network
- Detect motion
- Count HIGH value from digital input pin with 10ms delay
- If
count > 10
we have a real motion
- Send
POST
request to provided URL - Try again if
response != 200,301