Project 44:
Multiple ESP32-C3s using ESP-NOW Protocol

 

 

Arduino IDE v2.3.4: ESP-NOW "Master" on left sends two ESP-NOW "Slaves"

(Click to enlarge)

     

 

 

Overview:

An ESP32-C3 microcontroller uses ESP-NOW in "Master" mode to transmit its BME280 sensor readings to WiFi MAC address "broadcast".  Two "Slaves" receive and display the "Master" data in their Arduino Serial Monitors.

 

Note: If the ESP32-C3 devices are too close together when testing in the lab, the receiver(s) will appear to not work. That's most likely because the transmitter's signal is too strong given the receivers' proximity. Either move them far apart (not likely during testing!) or add the code snippet below to the transmitter C3. 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.
Serial.print("Wi-Fi TX power: ");
Serial.println(WiFi.getTxPower());            // To verify TX power setting.
Serial.println("");

 

Microcontroller & Docs:

ESP32-C3 Dev Board: https://github.com/sidharthmohannair/Tutorial-ESP32-C3-Super-Mini/.

 

ESP32-C3 Arduino Code: 

My modified code is from Random Nerd Tutorials course, Learn_ESP32_with_Arduino_IDE_V3_0

 

Testing:

Use the BME280 sensor and run the Adafruit test file bme280test.ino

 

ESP-NOW Reference: https://demo-dijiudu.readthedocs.io/en/latest/api-reference/wifi/esp_now.html

 

Function Name and Description
esp_now_init() Initializes ESP-NOW. You must initialize Wi-Fi before initializing ESP-NOW.
esp_now_add_peer() Call this function to pair a device and pass as an argument the peer MAC address.
esp_now_send() Send data with ESP-NOW.
esp_now_register_send_cb() Register a callback function that is triggered upon sending data. When a message is sent, a function is called – this function returns whether the delivery was successful or not.
esp_now_register_recv_cb() Register a callback function that is triggered upon receiving data. When data is received via ESP-NOW, a function is called.

 

 

HOME

 

Updated 2025-04-19