ESPNOW - Peer to Peer ESP32 & ESP8266 Simple Wireless Communication Between Boards

by RonFrtek in Circuits > Arduino

871 Views, 2 Favorites, 0 Comments

ESPNOW - Peer to Peer ESP32 & ESP8266 Simple Wireless Communication Between Boards

ESPNOW - Peer to Peer ESP32 & ESP8266 Simple Wireless Communication Between Boards

In this project you will learn how easy it is to send data between two ESP Boards using the ESPNOW - Peer to Peer Wireless Communication, you can use any ESP Board for this project.

Watch the Video!

What You Will Need

ESP-32S.jpg
NODEMCU-ESP8266.jpg
41015728-1.jpg
610eZbQEe7L._AC_SL1001_.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
breadboard.png
F5OFEUQJJ4ZYFKY.LARGE.jpg
  • 2X ESP32 or ESP8266 (It can be any ESP board)
  • DHT11 Temperature & Humidity sensor (or any other DHT sensor)
  • OLED Display
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino

Brought by PCBWay

2022-08-26_13-41-18.jpg

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.

The Circuit

2022-12-21_14-46-26.jpg
ESP32-DHT11-MicroPython-397x360.jpg

ESP32:

  • Connect DHT11 VCC pin to the 5V output on the ESP32 and connect GND to ground.
  • Connect DHT11 PIN S (Signal) to ESP32 Pin GPIO 5

NodeMCU:

  • Connections are fairly simple. Start by connecting VCC pin to the 3.3V output on the NodeMCU and connect GND to ground.
  • Connect the OLED SCL pin to the I2C clock D1 pin on your NodeMCU and connect the OLED SDA pin to the I2C data D2 pin on your NodeMCU.

Getting the MAC Address

2022-12-22_12-28-38.jpg
MAC.png
2022-12-22_12-32-44.jpg
2022-12-22_12-30-42.jpg

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Repeat this step for both ESP boards:

  • Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "ESP32" or "NODEMCU" Or any other ESP board that you use.


  • Connect pin MAC Address to Serial Pin [0] as on (Picture 2)
  • In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
  • Then click on the "Serial" Tab and click on the button "Connect"
  • You should see the MAC Address as on (Picture 3), In case you do not see it, click the "Reset" button on the ESP Board
  • Copy the MAC Address to your Notepad as on (Picture 4)

Sender ESP32: Start Visuino, and Select the ESP Board Type

FMW5CHBKFV47BP9.jpg
ESP32-BOARD.jpg

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "ESP32" as shown on Picture 2

For Sender ESP32 - in Visuino Add, Set & Connect Components

2022-12-22_12-51-03.jpg
2022-12-22_12-56-16.jpg
2022-12-22_12-58-30.jpg
2022-12-22_13-01-28.jpg
2022-12-22_13-05-48.jpg
2022-12-22_13-09-04.jpg
2022-12-22_13-08-29.jpg
2022-12-22_13-11-15.jpg
2022-12-22_13-14-27.jpg
2022-12-22_13-14-43.jpg
SENDER-ESP32.png
  • Select the "ESP32 Development Board" board and in the Properties window extend Modules>WiFi>ESP-NOW>Elements and click on the 3 dots Button
  • In the Elements window Drag "Device(Peer)" to the Left side and in the Properties window paste the MAC Address of the other Board in our case NODEMCU
  • Close the Elements Window


  • Add "Packet" component
  • Add "DHT11" component
  • Add "Analog To Analog Array" component
  • Select "AnalogToAnalogArray1" and in the Properties window set "Input Pins" to 2
  • Double click on the "Packet1" and in the Elements window Drag "Analog Array" to the Left side
  • Close the Elements Window


  • Connect "HumidityThermometer1" Pin [Sensor] to "ESP32 Development Board" Digital Pin [GPIO 5]
  • Connect "HumidityThermometer1" Pin [Temperature] to "AnalogToAnalogArray1" Pin [0]
  • Connect "HumidityThermometer1" Pin [Humidity] to "AnalogToAnalogArray1" Pin [1]
  • Connect "AnalogToAnalogArray1" Pin [Out] to "Packet1" > "Analog Array1" Pin [In]
  • Connect "Packet1" Pin [Out] to "ESP32 Development Board" Digital Pin [Sending]

Upload the Project to the Arduino Board (see the Generate, Compile, and Upload the Arduino Code step)


Receiver NODEMCU : Start Visuino, and Select the NODEMCU Board Type

FRWQB80K1RVKKV9.LARGE.jpg
2022-12-22_13-27-05.jpg

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "NodeMCU ESP-12" as shown on Picture 2

For Receiver NODEMCU - in Visuino Add, Set & Connect Components

2022-12-22_13-29-01.jpg
2022-12-22_12-56-16.jpg
2022-12-22_13-29-52.jpg
2022-12-22_13-30-19.jpg
2022-12-22_14-14-28.jpg
2022-12-22_14-14-49.jpg
2022-12-22_14-19-58.jpg
2022-12-22_14-20-17.jpg
2022-12-22_14-20-34.jpg
2022-12-22_14-21-37.jpg
2022-12-22_14-21-59.jpg
rec-nodemcu.png
  • Select the "NodeMCU ESP-12" board and in the Properties window extend Modules>WiFi>ESP-NOW>Elements and click on the 3 dots Button
  • In the Elements window Drag "Device(Peer)" to the Left side and in the Properties window paste the MAC Address of the other Board in our case ESP32
  • Close the Elements Window


  • Add "UnPacket" component
  • Add "OLED I2C" component
  • Add "Analog Array to Analog" component
  • Select "AnalogArrayToAnalog1" and in the Properties window set "Output Pins" to 2
  • Double click on the "UNPacket1" and in the Elements window Drag "Analog Array" to the Left side
  • Close the Elements Window
  • Double click on the "DisplayOLED1" and in the Elements window Drag "DrawText" to the Left side & in the Properties window set "Text" to TEMP and "Size" to 2
  • In the Elements window Drag "Text Field" to the Left side & in the Properties window set "Size" to 2, "X" to 65
  • In the Elements window Drag "DrawText" to the Left side & in the Properties window set "Text" to HUM and "Size" to 2, "Y" to 40
  • In the Elements window Drag "Text Field" to the Left side & in the Properties window set "Size" to 2, "X" to 65 and "Y" to 40
  • Close the Elements Window


  • Connect "NodeMCU ESP-12" board Pin Received [Out] to "Unpacket1" Pin [In]
  • Connect "Unpacket1" > "Analog Array1" Pin [Out] to "AnalogArrayToAnalog1" Pin [In]
  • Connect "AnalogArrayToAnalog1" Pin [0] to "DisplayOLED1" > "Text Field1" Pin [In]
  • Connect "AnalogArrayToAnalog1" Pin [1] to "DisplayOLED1" > "Text Field2" Pin [In]
  • Connect "DisplayOLED1" Pin I2C [Out] to "NodeMCU ESP-12" board Pin I2C [In]

Upload the Project to the Arduino Board (see the Generate, Compile, and Upload the Arduino Code step)

Generate, Compile, and Upload the Code

2022-12-22_14-27-30.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the ESP modules, you should start to see on the OLED Display the Temperature & Humidity received from the other ESP board.

Congratulations! You have completed your project with Visuino. Also attached are the Visuino project files for Sender and Receiver, that I created for this Tutorial, you can download it and open it in Visuino: https://www.visuino.eu