Project 45: |
Arduino IDE v2.3.4: ESP-NOW "master" on left receives data from one of three ESP-NOW sensor "satellites" on the right (Click to enlarge)
Video of Breadboard Operation (Click to enlarge)
Overview: An Adafruit Feather ESP32-S3 microcontroller uses ESP-NOW in "Master" mode to receive sensor data from 6 sensor node boards. The sensor nodes send their stats to the master periodically. The master shows the stats on its OLED display. The master controller also has an LDR to set the OLED brightness as well as a PIR to sense movement. An idle timer ensures the OLED is updated periodically if there is no motion.
Note: If the ESP32-C3 sensor nodes are too close together when testing in the lab, the receiver won't appear to work. That's most likely due to the transmitter's signal being too strong given the receivers' proximity. Either move them far apart (not likely during testing!) or add the code snippet below to all of the transmitters in the lab area. This setup() code will alter and show the TX strength.
WiFi.setTxPower(WIFI_POWER_2dBm);
// 2 = 8dBm, 5 = 20dBm. 0 to 20.5 in 0.5 increments. 2,5,7,19 work
with ESP32-C3.
Microcontroller & Docs: Master: Adafruit ESP32-S3 Feather Sensor Nodes: ESP32-C3 Super Mini Dev Board: https://github.com/sidharthmohannair/Tutorial-ESP32-C3-Super-Mini/.
Arduino Code: My modified code is from Random Nerd Tutorials course, Learn_ESP32_with_Arduino_IDE_V3_2 10_4_2_esp-now_many-to-one.zip contains master sketch (10_4_2_esp_now_many_to_one_Receiver_ID0_Timer.ino) and node sketches with ID1 to ID4 in the name (example: 10_4_1_esp-now_many-to-one_sender_ID1.ino)
ESP32 Forget: If your ESP32's cache of WiFi MAC addresses seems corrupt, run this file to hopefully clean it up: ESP32-C3_Super_Mini_Forget_Cache.ino If your ESP32 misbehaves, remember to press and hold RESET, press and hold BOOT, release RESET and then release BOOT, in that specific order.
ESP-NOW Reference: https://demo-dijiudu.readthedocs.io/en/latest/api-reference/wifi/esp_now.html
|
Updated 2025-05-18