Quick answer: A Blynk push notification is an Event with notifications switched on. The sketch only reports the event. The template decides whether your phone buzzes.
- In Blynk.Console open your template, go to Events & Notifications and create an event with the code
high_temp. - On that event’s Notifications tab, switch notifications on and set push notifications to Device Owner. Save the template.
- In the sketch, call
Blynk.logEvent("high_temp", "your message")once when the reading crosses the limit, never on every loop. - Install the Blynk IoT app, log in with the same account and allow notifications.
Free plan: 5 events per template and 100 events per device per day.
Parts you need
Parts for a Blynk temperature alert
Optional sensor swap
| Item | Price | Qty | |
|---|---|---|---|
DHT 11 DHT 22 Temperature and Humidity Sensor DHT22 High Sensitivity Sensor DHT11 For Aduino IOT - DHT22 SENSORDHT22HT | RM14.95 |
The white DHT22 reads in 0.1 degree steps. Same three wires, but its header reads +, out, minus (data in the middle). Buy one sensor, not both.
The ESP32 board has its header pins soldered on and the light-blue DHT11 module has a 3-pin male header, so female-to-female jumpers push onto both. No breadboard and no resistor: the pull-up the data line needs is on the module (R1, printed 512: 51 followed by two zeros, 5,100 ohms). The USB-C cable is for power and upload. The white DHT22 needs a one-line change (DHT_TYPE); see DHT11 vs DHT22.
How a Blynk alert reaches your phone
Blynk.logEvent() sends one short message from the ESP32 to Blynk’s cloud: an event code, plus an optional line of text. The cloud looks the code up in your template and, if it finds an event with that code, records it. The cloud sends a push only if that event has notifications switched on, and only to the Blynk app of the recipients listed there.
An event and a notification are separate, and the sketch controls only the first. The function also hands nothing back: the library source declares it void, and when the board is offline the send is skipped with no error. The sketch cannot know whether the phone buzzed, which is why Step 4 checks three places in order.

Step 1: Create the event in Blynk.Console
An event lives in a template, and the sketch needs the token of a device made from that template, so you need both. If you have neither, follow the template and token part of our Blynk relay guide and stop before its wiring. No datastream or widget is needed, because the sketch names the event by its code.
- Open Developer Zone, My Templates, your template, then the Events & Notifications tab. Click Edit, then + Create Event (Blynk’s events tutorial shows the screens).
- Fill in the event’s General and Notifications tabs from the table below.
- Click Create, then Save the template and choose to update active devices.
| Setting | Enter | Why |
|---|---|---|
| Event Name | High temperature | The name people see in the app |
| Event Code | high_temp |
The sketch sends this code, so it must match letter for letter. Check the field reads exactly high_temp before you click Create. Letters, digits, spaces and underscores, up to 50 characters (event settings) |
| Type | Warning | Sets the event’s priority level and its colour (orange for Warning) |
| Show event on the Timeline | On | Step 4 looks for the event on the device Timeline |
| Notifications tab: Enable notifications | On | With this off, the cloud records the event and sends nothing to any phone |
| Notifications tab: push notifications, under Default recipients | Device Owner | The owner is the account that added the device, so the phone app must be logged in to that account (notification settings) |
Step 2: Wire the DHT11 to the ESP32
The DHT11 module needs three wires. The letter S printed beside one end pin marks the data pin. Read the ESP32’s pin labels from the top, with the chips up and the USB-C socket towards you. The header pins point down, so the jumpers push on from underneath, and turning the board over swaps left and right.
| DHT11 module pin | ESP32 pin label | Where it is on the ESP32 | Why |
|---|---|---|---|
| Middle pin | 3V3 | Corner pin beside the USB-C socket, on the right-hand edge | Power. The DHT11 runs on 3.3 to 5.5V (Aosong DHT11 datasheet), and 3.3V keeps its data line at a level the ESP32 accepts |
| Other end pin | GND | Next to 3V3 | Ground, shared by the sensor and the board |
| S (the end pin beside the printed S) | D4 | Fifth pin along that edge, counting 3V3 as the first (3V3, GND, D15, D2, D4) | Data. D4 is GPIO4, which is why the sketch says DHT_PIN = 4 |
| White DHT22 instead | The same three pins | As above | Its header is printed +, out, minus, so data is the middle pin: out to D4, + to 3V3, minus to GND |
Power the module from 3V3, never VIN. The pull-up resistor joins the data line to the module’s power pin. On VIN that pin carries USB 5V, so D4 would be pulled up to 5V, and the ESP32 datasheet allows at most 3.6V on an input. Check all three wires before you plug in USB: a swapped 3V3 and GND wire puts 3.3V across the sensor backwards.

Step 3: Upload the sketch with Blynk.logEvent
The Blynk.logEvent sketch needs two libraries from the Arduino IDE Library Manager: Blynk and DHT sensor library by Adafruit. Click Install All when each asks for the library it depends on (BlynkNcpDriver for Blynk, Adafruit Unified Sensor for the DHT library). Select the board ESP32 Dev Module (if it is missing, install esp32 by Espressif Systems in Boards Manager first), paste the three #define lines from your device’s Device Info tab over the ones below and enter your Wi-Fi name and password.
// Blynk + ESP32: one phone alert when a DHT11 crosses a temperature limit.
// These three lines come from your device's Device Info tab in Blynk.Console.
// They must stay above every #include.
#define BLYNK_TEMPLATE_ID "TMPL_PASTE_YOURS"
#define BLYNK_TEMPLATE_NAME "Temp Alert"
#define BLYNK_AUTH_TOKEN "PASTE_YOUR_TOKEN" // secret, never share it
#define BLYNK_PRINT Serial // connection messages in Serial Monitor
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
const char WIFI_SSID[] = "YourWiFiName"; // 2.4GHz network
const char WIFI_PASS[] = "YourWiFiPassword";
const int DHT_PIN = 4; // the pin labelled D4
#define DHT_TYPE DHT11 // change to DHT22 for the white sensor
const float ALERT_AT = 32.0; // send the alert at or above this (deg C)
const float REARM_BELOW = 30.0; // allow the next alert only below this
const unsigned long READ_EVERY_MS = 5000UL; // the DHT11 needs over 2 s between reads
DHT dht(DHT_PIN, DHT_TYPE);
BlynkTimer timer;
bool alertSent = false; // the flag: true = this crossing is already reported
void checkTemperature() {
float t = dht.readTemperature(); // Celsius
if (isnan(t)) {
Serial.println("DHT read failed, skipping");
return; // never alert on a bad reading
}
Serial.print("Temperature: ");
Serial.println(t, 1);
if (!alertSent && t >= ALERT_AT && Blynk.connected()) {
// "high_temp" must match the Event Code in your template exactly
Blynk.logEvent("high_temp", String("Temperature is ") + String(t, 1) + " C");
alertSent = true; // one event per crossing
Serial.println("Event sent");
} else if (alertSent && t < REARM_BELOW) {
alertSent = false; // cooled down, ready for the next crossing
Serial.println("Re-armed");
}
}
void setup() {
Serial.begin(115200);
dht.begin();
Blynk.begin(BLYNK_AUTH_TOKEN, WIFI_SSID, WIFI_PASS); // waits here until Wi-Fi and Blynk connect
timer.setInterval(READ_EVERY_MS, checkTemperature);
}
void loop() {
Blynk.run(); // keeps the cloud connection alive
timer.run(); // calls checkTemperature() every 5 s
}
A BlynkTimer takes a reading every 5 seconds. The DHT11 datasheet asks for more than 2 seconds between reads, and Blynk.run() must keep running to hold the cloud connection, which delay() would stop (Blynk’s recommendations).
Step 4: Test the alert on your phone
Install the Blynk IoT app, log in with the console account and allow notifications when the phone asks.
For a first test, set ALERT_AT to 20.0 and REARM_BELOW to 18.0 and upload. In any room warmer than 20°C the first reading, 5 seconds after the board connects, is already over the limit, so the event goes out straight away. Check in this order:
| Checkpoint | What you should see | What it proves |
|---|---|---|
| 1. Serial Monitor (115200) | Ready (ping: ...ms)., then a temperature, then Event sent |
The board is online and the sketch called logEvent |
| 2. Blynk.Console, the device’s Timeline tab | The High temperature event | The cloud found an event with that code in the template |
| 3. Phone | The notification | Notifications are on, the recipient is right and the phone lets the app notify |
To repeat the test, unplug and replug USB (or press EN). The flag is a variable in RAM, so a restart clears it. Then set your real limit. A warm Malaysian room can sit near 32°C, so put ALERT_AT a few degrees above the readings you saw, REARM_BELOW 2°C under it, and upload again.
The same event can be fired with no board. Paste this into a browser with your device’s token and your region’s server, shown in the bottom right corner of Blynk.Console (for example sgp1.blynk.cloud for Singapore; Blynk HTTPS API):
https://YOUR_SERVER/external/api/logEvent?token=YOUR_TOKEN&code=high_temp
If the phone buzzes, the console and phone are set up correctly, so the fault is in the sketch or on the board. Each call uses one of the day’s 100 events, and the token stays in the browser history, so use your own computer.
Stop repeat alerts from flooding your phone
Calling Blynk.logEvent on every 5-second reading would fire for as long as the room stays hot. The sketch alerts on the crossing instead, with one flag, alertSent.
- The first reading at or above
ALERT_ATsends the event and sets the flag. While it is set, nothing more is sent. - The flag clears only below
REARM_BELOW. The DHT11 reports in 1°C steps (datasheet), so a room sitting at the limit flickers between 31 and 32. With a single threshold, every flicker up is a new crossing and a new alert. With the 2°C gap, the reading must fall to 29 first. - The flag is set only while
Blynk.connected()is true, so an alert that could not go out is tried again on the next reading.

The console adds a second brake. On the event’s Notifications tab, Limit Period allows one notification per period (1 hour, say), counted from the first event. It limits notifications only: every event still counts against the daily 100. A sketch that logs on every 5-second reading uses them up in 100 × 5 = 500 seconds, about 8 minutes, though the phone buzzed once. After that the Timeline shows a limit notice and a real alert later that day has no allowance left. Set Limit Period after your tests, or a repeat test inside the period reaches the Timeline while the phone stays quiet.
What the free Blynk plan allows
Blynk’s free plan covers this build, so the only cost is the parts. Figures from Blynk’s limits page and pricing page:
| Limit | Free plan | In this build |
|---|---|---|
| Events per template | 5 | Uses 1 |
| Events per device per day | 100 | One per crossing |
| Gap between events of the same type | At least 1 second | The sketch reads every 5 seconds |
| Gap between notification messages | At least 5 seconds | Limit Period makes it far longer |
| Devices | 5 | Uses 1 |
| Datastreams per template | 50 | Uses none |
| Device messages per month | 100,000 | The sketch sends no datastream values |
| Event message length | 300 characters at the cloud (logEvent reference). Longer messages are discarded. On an ESP32 the library builds the code and the text in a 1,024-byte buffer (BlynkDetectDevice.h), so the 300-character cloud limit is the one that counts | “Temperature is 32.0 C” is 21 characters |
| Ways to notify | Push and email. SMS is not in the free plan | Push |
Treat this as a convenience alert. It works only while the Wi-Fi, the internet, Blynk’s cloud and the phone’s settings all work, and the DHT11 datasheet says “Don’t use this product in safety or emergency stop devices”. Keep a proper smoke or gas alarm for that job. A power cut also takes the router down with the board (see our mini UPS guide).
Why is my Blynk notification not showing?
A Blynk notification that never arrives has stopped at one of the three checkpoints. Find the last one that worked and read that row.
| Where it stops | Cause | Fix |
|---|---|---|
| The upload fails, or no port appears in the Arduino IDE | A driver, cable or boot-mode problem on the board. Blynk is not involved yet | Work through ESP32 not detected or upload failed |
Serial Monitor stays on Connecting to and your Wi-Fi name |
Wrong Wi-Fi name or password, or a network the ESP32 cannot join. Its radio is 2.4GHz only, and it has no browser to pass the login page of campus or hostel Wi-Fi | Check the spelling and capitals. For a demo at school or campus, use a phone hotspot set to 2.4GHz |
Serial Monitor prints Invalid auth token |
The token was copied incompletely, or its device was deleted or given a new token | Copy the three #define lines again from the device’s Device Info tab |
DHT read failed, skipping |
The board gets no data on D4: a loose jumper, S on the wrong pin, or power and ground swapped | Unplug USB and go through the Step 2 table again |
Temperatures print but never Event sent |
The reading has not reached ALERT_AT, the flag is still set from an earlier alert, or the board was offline at that reading (it tries again on the next one) |
Lower ALERT_AT for a test, or restart the board (unplug and replug USB) to clear the flag |
Event sent prints but the Timeline is empty |
The cloud found no event with that code (the name was typed instead of the code, or the capitals differ), the template was not saved, the sketch holds another device’s token (so the board logged in as that device), “Show event on the Timeline” is off, or the day’s 100 events are used up (the Timeline then shows a limit notice) | Run the browser test from Step 4. Can't find Event with this code in Product template confirms a code mismatch. Fix the code, then save the template |
| The event is on the Timeline but the phone is silent | Notifications are off for that event, the push recipient is not Device Owner, the phone is logged in to a different account, or a Limit Period from an earlier test is still running | Recheck the two Notifications rows in the Step 1 table. On the phone, allow notifications for Blynk IoT, and check Do Not Disturb and battery saver (Blynk’s phone notification settings) |
The browser test answers Invalid token. |
A wrong token, or the wrong server region | Read your region in the bottom right corner of Blynk.Console and put it in the address, for example sgp1.blynk.cloud for Singapore (HTTPS API troubleshooting) |
The browser test answers Event code is not provided. |
The &code= part is missing from the address |
Paste the whole line again |
FAQ
Does Blynk.notify() still work?
No. Blynk.notify() belonged to the old Blynk app. The current Blynk library has no such function, so a sketch that calls it stops compiling with “’class BlynkWifi’ has no member named ‘notify’”. Create an event and call Blynk.logEvent() instead.
How many notifications can Blynk send in a day?
Up to 100 per device, because each notification starts as an event and one device can log 100 events a day. Notification messages must also be at least 5 seconds apart.
Can Blynk send an email instead of a push notification?
Yes. On the event’s Notifications tab, set the email recipient to Device Owner too. Email is included in the free plan.
Last updated November 2026. Stuck? Chat with us on WhatsApp.



NodeMCU ESP32 Wi-Fi + Bluetooth Development Board CH340/CP2012 - For IOT Project - ESP-32 (CH340)
DHT 11 DHT 22 Temperature and Humidity Sensor DHT22 High Sensitivity Sensor DHT11 For Aduino IOT - DHT11 SENSOR
40pcs Dupont Wire 10cm 20cm 30cm for Breadboard DIY Experiment Jumper Wire Breadboard wire - DUPONT WIRE F-F 20CM
Data Cable Type-A Type-C MicroUSB Type-B 0.5m 1m 30cm 0.3m 100cm Data Transfer Upload Code - TYPE-A TO TYPE-C CABLE (1.0M)
DHT 11 DHT 22 Temperature and Humidity Sensor DHT22 High Sensitivity Sensor DHT11 For Aduino IOT - DHT22 SENSOR