GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsESP-NOW is a direct, connectionless protocol between ESP32 boards. The sender measures temperature and humidity and sends a small data packet to the receiver's MAC address, and the receiver shows it on an OLED. There is no Wi-Fi network involved, so it works in a field or a workshop with no router. Range is usually tens of metres through a few walls. The code is written for the ESP32 Arduino core version 3; older versions use a slightly different callback signature.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
Each board runs from its own USB supply.
espnow_sender.inoVerify & upload in Electrolark// SENDER: DHT22 on GPIO 4
#include <WiFi.h>
#include <esp_now.h>
#include <DHT.h>
uint8_t receiverMac[] = {0x24, 0x6F, 0x28, 0x00, 0x00, 0x00}; // replace with the receiver's MAC
typedef struct { float t; float h; } Packet;
DHT dht(4, DHT22);
void setup() {
WiFi.mode(WIFI_STA);
dht.begin();
esp_now_init();
esp_now_peer_info_t peer = {};
memcpy(peer.peer_addr, receiverMac, 6);
peer.channel = 0;
peer.encrypt = false;
esp_now_add_peer(&peer);
}
void loop() {
Packet p = { dht.readTemperature(), dht.readHumidity() };
if (!isnan(p.t) && !isnan(p.h)) esp_now_send(receiverMac, (uint8_t*)&p, sizeof(p));
delay(5000);
}
espnow_receiver.inoVerify & upload in Electrolark// RECEIVER: OLED on GPIO 21 / 22
#include <WiFi.h>
#include <esp_now.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
typedef struct { float t; float h; } Packet;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
volatile float lastT = 0, lastH = 0;
volatile bool fresh = false;
void onReceive(const esp_now_recv_info_t* info, const uint8_t* data, int len) {
if (len != sizeof(Packet)) return;
Packet p;
memcpy(&p, data, sizeof(p));
lastT = p.t; lastH = p.h; fresh = true;
}
void setup() {
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
WiFi.mode(WIFI_STA);
esp_now_init();
esp_now_register_recv_cb(onReceive);
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(0, 0); oled.print("Waiting..."); oled.display();
}
void loop() {
if (fresh) {
fresh = false;
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(1); oled.setCursor(0, 0); oled.print("Remote sensor");
oled.setTextSize(2); oled.setCursor(0, 20); oled.print(lastT, 1); oled.print(" C");
oled.setCursor(0, 44); oled.print(lastH, 0); oled.print(" %");
oled.display();
}
delay(50);
}
Check the MAC address in the sender, and that both boards use the same Wi-Fi channel (leave both on channel 0).
This is written for ESP32 core 3. On core 2.x the receive callback is (const uint8_t* mac, const uint8_t* data, int len).
Check the sender's power and that the DHT22 still reads.
No. ESP-NOW talks board to board.
Yes. Add an ID field to the packet and handle each sender.
Not in this sketch. ESP-NOW supports encryption with a key if you need it.
5 parts: 2 × ESP32-WROOM-32 38-Pin Development Board, DHT22 AM2302 Digital Temperature & Humidity Sensor, 0.96" OLED Display 128x64, 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 advanced project and takes about 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (espnow_sender.ino and espnow_receiver.ino).
About ₹1,113 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Finding a board's MAC address; Sending a struct with ESP-NOW; Receiving it with a callback.
Ideas that reuse this build: ESP32 MQTT temperature dashboard. 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.