GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsA Telegram bot is the easiest free way to get a phone notification from a microcontroller. You create a bot with BotFather, find your chat id, and the ESP32 sends a message with a single HTTPS request. Here the trigger is an infrared flame sensor, so the project suits a kitchen shelf or workshop demo. It is a learning project and must not be the only fire protection in a building.
Test with a small flame, such as a candle, at arm's length and never near flammable material.
This project is not a certified fire alarm.
Tick anything you already have and the total updates.
Infrared flame sensor with digital output
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB phone charger.
flame_telegram.inoVerify & upload in Electrolark#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
const char* WIFI_NAME = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";
const String BOT_TOKEN = "123456:YOUR_BOT_TOKEN";
const String CHAT_ID = "YOUR_CHAT_ID";
const int FLAME_PIN = 27, BUZZ = 25;
unsigned long lastSent = 0;
void sendTelegram(String text) {
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
http.begin(client, "https://api.telegram.org/bot" + BOT_TOKEN + "/sendMessage");
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
http.POST("chat_id=" + CHAT_ID + "&text=" + text);
http.end();
}
void setup() {
Serial.begin(115200);
pinMode(FLAME_PIN, INPUT);
pinMode(BUZZ, OUTPUT);
WiFi.begin(WIFI_NAME, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) delay(300);
}
void loop() {
// the module output goes LOW when it sees a flame
if (digitalRead(FLAME_PIN) == LOW) {
delay(2000); // must still be there after 2 seconds
if (digitalRead(FLAME_PIN) == LOW) {
digitalWrite(BUZZ, HIGH);
if (millis() - lastSent > 60000 || lastSent == 0) {
sendTelegram("Flame detected by the ESP32 sensor!");
lastSent = millis();
}
}
} else {
digitalWrite(BUZZ, LOW);
}
delay(200);
}
Open the getUpdates link again to check the chat id, and make sure you sent your bot a message first.
Infrared from the sun looks like flame. Keep it indoors or shade the sensor.
The sensor output may be inverted on your module. Swap LOW for HIGH in the sketch.
No. Bots and messages are free.
Yes. Add the bot to the group and use the group's chat id, which starts with a minus sign.
No. Use a certified smoke or heat alarm for real fire safety.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic Flame Sensor Infrared Receiver Module – 1 Channel, 3.3V/5V, 60° Detection Angle, Buzzer Module 3.3–5V, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1.5 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (flame_telegram.ino).
Making a Telegram bot and finding its token; Sending HTTPS requests from the ESP32; Reading a digital flame sensor with a debounce.
Test with a small flame, such as a candle, at arm's length and never near flammable material. This project is not a certified fire alarm.
Ideas that reuse this build: ESP32 web server relay switch. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.