ESP32-to-ESP32 Simplex Communication via ESP-NOW

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in my previous videos the esp32 controller was used as a web server using ajax and websocket technologies to broadcast sensor measurements to receiving clients in this video espnow protocol is used to enable esp32 controllers to communicate with each other without using wi-fi the esp now protocol developed by espressiv allows multiple devices such as the esp32 to communicate without wi-fi pairing between devices is required and the connection is secure and it is peer-to-peer and no handshake signals is required this protocol allows either simplex or duplex communication between devices and the communication can either be unicast or multicast no broadcasting is supported by this protocol this protocol is ideal for smart light control and remote control of devices and sensors for more technical information about this protocol please refer to the user manual available at the expressive website in this video unicast's simplex communication is established between two esp32 controllers this being the transmitter and this being the receiver on the transmitter side of the system we have a pot connected to analog line a0 and on the receiver side we have a ola screen connected to the i squared c bus of the controller on the transmitter side the analog input through the 10k pot is translated to 12-bit digital values between 0 and 4095. these values are then transmitted using esbnow protocol to the receiver and displayed on the oled screen finally to establish pairing between the transmitter and the receiver the receiver mac address must be known and stored within the esp32 transmitter and now for a quick demonstration let's have a quick look at the sketches used in this project first we'll start with the espnow transmitter sketch which was referenced from the website randomner tutorials we need to include these two header files one for the esp now and the other for the wi-fi next we need to store the mac address of the receiver within this one-dimensional array and we can get the mac address by using this sketch next we define this structure and within this structure we will declare this integer variable pod value to store the potentiometer values and then we will declare this structure variable to be sent using espnow protocol next we need to define this function on data sent which is a callback function that is executed every time the esp32 sends a packet to the receiver and here within the function the status of the transmission is indicated whether the delivery is a success or a failure inside the setup function we enable the wi-fi mode of the esp32 and then we check the initialization status of the espnow protocol next we need to register on dataset callback function with now and then we need to pair the transmitter esp32 with the receiver esp32 given the receiver mac address and this part of the code confirms the pairing between the transmitter and the receiver is successful or not inside the loop function we get the pot value and stored in the structure variable send data of member pot value and then we sent this structure variable using esp now protocol and then we check whether the transmission was successful or not now a quick look at the receiver sketch for the esp now again the reference is random nerd tutorials we need to include these libraries one for the esp now one for the wi-fi one for the wire i squared c communication and also two libraries for the oled display next we declared this object so we can access the oled display and then we define this structure which should match the transmitter structure and we declare this structure variable so that we can store the received data into this structure variable next we need to define this callback function on data receive so that the receive data can be stored in the structure variable we have declared inside the setup function we initialize the oled display and then we enable the wi-fi mode and then we initialize the esp now and then we register the callback function with the esp now protocol finally within the loop function we continuously display the received potentiometer values on the oled screen in a future video esp now technology will be used to allow two esp32 controllers to communicate in duplex mode thank you for watching
Info
Channel: Anas Kuzechie
Views: 6,550
Rating: undefined out of 5
Keywords:
Id: GzugxHEzB0g
Channel Id: undefined
Length: 6min 30sec (390 seconds)
Published: Tue May 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.