ESP32 is a 32-bit microcontroller designed and manufactured by Espressif Systems, a Shanghai-based Chinese company. It is a successor to the ESP8266 microcontroller integrated with Wi-Fi, Bluetooth and Bluetooth Low Energy (BLE). ESP32 is a low-cost and low-power microprocessor that is available to a number of popular modules and is appropriate to IoT systems that require remote connection and Internet access. 

ESP-NOW is a connectionless communication protocol developed by Espressif that enables multiple ESP devices to communicate with each other without using Wi-Fi. Payload is limited to 250 bytes and transmission range can go up to 220 meters (722 feet) in open field.

  1. Install the Arduino IDE from the following URL: https://www.arduino.cc/en/software
  2. In Arduino IDE, go to File> Preferences
  3. Enter the following into the “Additional Board Manager URLs” textbox and click the “OK” button: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  4. Go to Tools > Board > Boards Manager
  5. Search for ESP32 and press install button for the “ESP32 by Espressif Systems”
  6. For more details, refer to the tutorial: https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

To communicate via ESP-NOW, pairing is required between devices. The MAC address of the receiver should be known to pair boards successfully. This address can be obtained from the function WiFi.macAddress(). Click the link if you want to learn more about it.

In this project, we deployed the ESP-NOW to perform realize remote monitoring and control. One board is configured as master which sends out commands and the other board is configured as slave that transmits sensor readings to the master. The sketches of both the master and the slave include the following items:

  1. Initialize ESP-NOW;
  2. Register a send callback function and a receive callback function, which can show if the message was successfully delivered or not;
  3. Add a peer device by using its MAC address;
  4. Send or receive messages under specified circumstances.

The video below shows how ESP two-way communication works in this project and the codes can be downloaded at the bottom of this page. Besides, if you are interested in ESP-NOW with the ESP32, more examples could be found in the following URL: https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/

Slave
Master

About the Author

This page was written by Changxin Yu. Check out her personal page.