In this project the flame sensor with telegram notifications is realized. So when the fire is detected by a sensor, you get a notification about this event immediately in Telegram. It is pretty useful and convenient.
So how it works ? I'll show you! Let's get it started!
Step 1: Components Required
For this project we need:
- NodeMCU V3 with ESP12 - 1;
- IF Flame Sensor - 1 ;
- Jumper Wires - 3;
- USB cable - 1;
- Any PC - 1.
Step 2: Schematics
NodeMCU and Flame sensor must be connected as shown on a figure above. NodeMCU is also connected to PC via USB cable.
Step 3: Notifications Realization
To make notifications, we have to set up IFTTT.
Step 4: Setting Up IFTTT
Actions you need to do:
- Go to ifttt.com;
- Register on this website;
- Once you registered you can create applets. Press "New Applet" and then "if +this";
- Choose a service "Webhooks" and then click on "Receive a web request";
- Now you need to write a name of event you will refer to in your sketch to adjust notifications. It doesn't matter what a name you will give to it. It can be "fire_detected", for instance. But notice that the EXACT name of event must be used in your sketch.
- Press "+that";
- Now you are supposed to choose a service that will send you notifications when fire detected. In our case it is a Telegram, so choose action service "Telegram";
- Choose "Send message";
- Than you can modify the message content that you will receive when the event happens, so when fire detected. Also you can choose whether you will get notifications from standard IFTTT dialogue or any other dialogue. But notice that in any case you will be notified by IFTTT, so in fact to get notifications from any other dialogue, you need to add IFTTT to that dialogue. The only advantage of such action is that you can name this dialogue "Fire alarm" or somehow else and then only have read the name of dialogue in notification you will know what happened without reading a text of message.
- Click "Create action" and then "Finish".
- You set up IFTTT!
Step 5: Code of Program
On ifttt.com choose your profile and go to "My services". Click on "Webhooks" and then press "Settings". You will see URL like on a figure above. The symbols combination after last "/" is your Webhooks Service Key. It is necessary to know it because you will use it in the program. Just open "EMAIL.ino" and fill in your SSID, WiFi network password and Webhooks Service Key.