ESP-NOW: Difference between revisions

From Helpful
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
Line 3: Line 3:




ESP-NOW is a simple protocol that uses the ESP's WiFi radio (It coexists with the WiFi stack, also if active),
ESP-NOW is intended as for ESP-to-ESP communication, based on WiFi but not requiring association.
meaning it works regardless of there being an AP involved.


It lets ESP devices send (small, unACKed) packets to other ESP devices
: directly (without an AP)
: coexisting with the regular WiFi stack (but there are practical footnotes)


also meaning


Some explanations mention that you pair with a peer,
and will automatically recover after restart.


Some explanations mention that you pair with a peer, after which it will automatically recover after restart.
...which seems to be a fancy way of saying that it's stateless,
 
that you need to send to a specific MAC,
...which seems to be a nice way of saying "you need to send to a specific MAC you have to know and will probably hardcode"
that you have to know and will probably either hardcode or somehow discover"


There is also a note that you can actually use broadcasts, in which case you don't have a peer limit.
There is also a note that you can actually use broadcasts, in which case you don't have a peer limit.






Limitations:
Limitations:
- it will use the same channel as WiFi, so _follow_ that if you switch to a specific AP, probably not what you want
* it will use the same channel as WiFi
- different peer limits exist in Station mode and in AP mode or AP+Station mode
:: so if you switch to a specific AP, ESP-now will _follow_ that, which probably not what you want
- can't receive if in modem sleep.
  - You might want to do do an occasional poll to something central-and-powered.
 
- you will receive whatever is sent to you.
  - You need to figure out that message is for your type of device,
  - and that it is a type of message you want to respond to


- no encryption in a practical sense


- Fire-and-forget - No ACKs (like UDP-like).
* Fire-and-forget - No ACKs


- Assume the sending rate is no faster than 1Mbps
* 250 bytes of payload, because it uses Action Frames
- Up to 250 byte payload (at a time).


- power savings
  - (when AP is connected, will it effectively get TIM??)
  - there are some other things in STA mode, see e.g. esp_now_set_wake_window()


* can't receive if in modem sleep
** note: it can make sense to have one ESP stay awake and have others poll it between sleep, though at this point it's not too differrent from that being a real AP - in fact might you get TIM on a real AP)
** there are some other things in STA mode, see e.g. esp_now_set_wake_window()




* different peer limits exist in Station mode and in AP mode or AP+Station mode


adds peer (by MAC)
* Assume the sending rate is no faster than 1Mbps ''at best'' but usually slower.
send data




* you will receive whatever is sent to you.
** You need to figure out that message is for your type of device,
** and/or whether it is a type of message you want to respond to


This makes it useful for ESP-to-ESP communication
* no encryption in a practical sense




-->
-->

Revision as of 14:38, 22 June 2024