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 Espressif's direct board-to-board radio protocol. Two ESP32s can talk to each other in a few milliseconds without joining any Wi-Fi network, which makes it ideal for an alarm that still works when the router is off. The sender watches a PIR motion sensor and transmits a one-byte message. The receiver sounds a buzzer for a few seconds. You first read the receiver's MAC address, then put it in the sender's sketch.
Use the alarm for convenience only, not as the only protection for people or valuables.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
Run both boards from USB chargers or power banks.
sender.inoVerify & upload in Electrolark#include <WiFi.h>
#include <esp_now.h>
uint8_t receiverMac[] = {0x24, 0x6F, 0x28, 0xAA, 0xBB, 0xCC}; // put the receiver's MAC here
const int PIR_PIN = 27;
unsigned long last = 0;
void setup() {
Serial.begin(115200);
pinMode(PIR_PIN, INPUT);
WiFi.mode(WIFI_STA);
if (esp_now_init() != ESP_OK) { Serial.println("ESP-NOW failed"); return; }
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() {
if (digitalRead(PIR_PIN) == HIGH && millis() - last > 8000) {
last = millis();
uint8_t msg = 1;
esp_now_send(receiverMac, &msg, 1);
Serial.println("motion sent");
}
delay(100);
}
receiver.inoVerify & upload in Electrolark#include <WiFi.h>
#include <esp_now.h>
const int BUZZER_PIN = 25;
volatile bool alarmOn = false;
// ESP32 Arduino core 3.x signature; on core 2.x use (const uint8_t *mac, const uint8_t *data, int len)
void onReceive(const esp_now_recv_info_t *info, const uint8_t *data, int len) {
if (len > 0 && data[0] == 1) alarmOn = true;
}
void setup() {
Serial.begin(115200);
pinMode(BUZZER_PIN, OUTPUT);
WiFi.mode(WIFI_STA);
Serial.print("My MAC address: ");
Serial.println(WiFi.macAddress());
if (esp_now_init() != ESP_OK) { Serial.println("ESP-NOW failed"); return; }
esp_now_register_recv_cb(onReceive);
}
void loop() {
if (alarmOn) {
digitalWrite(BUZZER_PIN, HIGH);
delay(5000);
digitalWrite(BUZZER_PIN, LOW);
alarmOn = false;
}
}
Check the MAC address bytes in the sender are exactly the receiver's, and that both boards run the same ESP32 core version.
Keep it away from heaters and sunlit windows, and let it warm up for a minute. Turn the sensitivity screw down.
The receive callback signature changed in core 3.x. The sketch shows the 3.x form; the comment gives the 2.x form.
No router is needed. The boards use Wi-Fi radio hardware but talk directly to each other.
Typically 20 to 50 metres indoors and a few hundred metres in the open.
Yes. Any sender that knows the receiver's MAC can transmit to it.
5 parts: 2 × ESP32-WROOM-32 38-Pin Development Board, HC-SR501 PIR Motion Detector Sensor Module, 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 (sender.ino and receiver.ino).
About ₹934 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How ESP-NOW addresses a peer by MAC; Sending and receiving small packets; Debouncing a PIR sensor.
Use the alarm for convenience only, not as the only protection for people or valuables.
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.