ESP-NOW Protocol: Establishing Communication Between Two ESP32 Devices - How to Use It

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video we will try to learn how to use ESP now ESP now is communication protocol which is made by espressive and it is used for simple wireless communication between two esp32 devices communication can be in both or in single Direction there are many tutorials on internet how to use ESP now but most of them are using serial monitor to show data we will use use displays so I have two esp32 devices L go to display S3 and one device will send the data and this one will receive so I made this simple sketch where I can choose some value for example like 4 54 and now I can send and it says fail why because my receiver is turned off so let's turn it on and now receiver said waiting and let's dial I don't know another 50066 7 and send and receiver received correct number yes I probably spended too much time programming this example which only sent one number but I hope some of you will use this design for for your own needs code is in description but for a learning purpose I made another basic example and I will use that basic example to to explain code and to show you how this works so let's start sorry I will be there I promise I will be there I will be there soon I finish my coffee I love you too bye the sponsor of this video is PCB way they know how much I love coffee so they send me this mug in the past few years they have helped me in many useful and useless projects so if you need a PCB PCB way can make fun for you on their site you can find many other services such as 3D printing or CNC Machining link is in the description in this uh tutorial we will will do only simple one way communication so One ESP 32 cents message to another to send message we need to know Mac address of receiver you can see that Mac address of this receiver is shown here but how to get address of this receiver in description you will find my examples you will download them and extract them and in folder there will be this example my Mac is so you will open this example and you can see that this is a really short example which basically just prints MAC address on display you will upload this example to your receiver board when uploading is done this will be results you can see now your Mac address and you can write this or you can memorize it I will write it on paper now you will go back to my folder and let's upload basic example so you will open example for board which will send data and now you will edit this line now you have your Mac address and you will put Mac address of your receiver here these data are my keep in mind that you need to put this uh in this hexad decimal format so what is happening here we need to include ESP now header file and Wifi Library both of them are included in uino ID so you you don't need to download anything we need receiver address we need to registrate pier and in setup function we need to in our board and Screen this part is used to set brightness of the screen we need to init VII ESP now and register function which will be called when data are when a data are sent so function name on name of that function is on data sent and we can see that function here so basically when we send data it will just check if is um delivery successful or is it fail and it will call our draw function which will just draw content of our screen and in Loop function we will only increment this data which is basically integer we will increment it send it every two second so number will be incremented sended this sending will also call this function on data send and on data send function we'll call draw function and update our screen you will upload this sketch to your sender and now you can plug it off and you can in basic folder you can open receive folder and plug in your receiver and receive sketches even simpler we have still need ESP now and Wi-Fi headers tspi Library we have data but now we have on data receive function in setup we will also init our screen brightness and register our on data receive function and on data receive function will only copy re received message in data variable and it will call draw function which will again draw content of our screen Loop function is empty so when board receive message it will draw content on the screen it will draw data and we will see on sender and uh receiver that message is delivered and now when you have both sketches uploaded sketch for sender and for receiver you can play with these devices for example you can place this one in some room in house and with one you can walk around and test range and very soon you will find out that range is great with ESP now I I can cover my whole house and even my backyard then nearby places and later you can find fence example in my folder here it is so we can upload it and play with it with this button you are choosing value with this you can change D or you can choose send button and send something and value is sent to this reer when I started with ESP now I used the tutorial from random nerd site I will post post link there that is a great site with lots of good content and there you can um examples which can send larger data for example struct of data in my simple case I'm sending just one integer but you can send lots of data people are also sending uh parts of images or whole small pictures ESP now can send I think 250 bytes in one message thank you tell me what you think tell me did you learn something tell me did you know this tell me whatever you want to tell me if you are first time here please subscribe yes I forgot to said ESP Now work on any esp32 board ESP 32 S3 S to Pico it will work my examples will work on any board that have TFT screen built in or you can add your own thank you and have a nice day don't forget subscribe like and everything else and if you want you can buy me coffee bye
Info
Channel: Volos Projects
Views: 43,419
Rating: undefined out of 5
Keywords:
Id: wKs2BjljM3E
Channel Id: undefined
Length: 11min 3sec (663 seconds)
Published: Wed Jan 24 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.