ESP NOW for 8266

I learned ESP-NOW from


It's fast, using 802.11 Mac with proprietary protocol...
As usual, chinese chipset vendor does not make the document very well, It took me a while to understand how it's organized. Especially on the master and slave relation in espnow.
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_now.html
This video explain very well, only a little long...
The trick is that, the sensors side is master, the gateway side is slave. It's a little bit like bluetooth IOT...where sensor is master...
 2nd thing, the arduino lib is for esp32, when you choose your board to esp32,there will be examples for it, but if you select board to 8266, there is no examples of espnow.

But you do find some one has espnow on esp8266....
https://github.com/HarringayMakerSpace/ESP-Now
He made a very interesting sensor on web:
http://s3.eu-west-2.amazonaws.com/torntrousers/espnow-test1.html

I have esp-now example under ESP32, but if I choose esp8266, then, there is no more espnow examples...

there are some ways to make it work for esp8266, but this seems fine:

https://github.com/leonyuhanov/ESP-NOW-TX-RX
by

Elec Dash Tronleonyuhanovyou have to follow :

Setup Instructions FOR the ESP8266

this will add a small line and make it work...

the way he include lib:

#include <ESP8266WiFi.h>
extern "C" {
#include <espnow.h>
}

It seems that in arduino, there is a lib of espnow for 8266, but arduino did not include it...so the way above seems to tell arduino where to find the lib.


I tested both master and slave on my 2pcs of D1mini, it works well...
the response time is so fast...it took only 2.xx ms

The I try to compile the multi example of espnow lib for esp32 under the board 8266, it shows a lot of error...
I like the example, since it does the slave mac registration, it would make things very easy...

It seems that the library for esp32 and esp8266 are different, so functions of esp32 lib does not work for esp8266. So be very careful when copying examples...

For a device to work in ESP-NOW Slave(receiver, gateway,) so that you can receive data from esp-now and connect to internet, esp32 seems to be reasonable solution. Not only because the chip is more powerful, also because the lib is better maintained.

I did several test on 2 8266, it seems the lib of ESPnow on 8266 is not so clear and nor stable, so if you want to use espnow for kind of sensor net work, it would be better to use esp32.

留言

這個網誌中的熱門文章

Heltec ESP32+OLED+Lora, hardware testing

micro SD card for ESP32, on lolin32 with OLED and heltec 32 lora oled

Install Network Time Protocol(NTP) on BeagleBone with Angstrom linux and set local time zone