ESP-Now support for ESP32 (and ESP8266)

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP-Now support for ESP32 (and ESP8266)

Post by davef » Tue Oct 05, 2021 7:03 pm

Hi napo7,

Thanks for the explanation. I am guessing that to achieve receive and transmit on the same WiFi channel (or frequency) on a WiFi device requires demodulation to baseband, re-modulation to RF and in different time slots. I'll hit Google as my signal processing experience is lacking.

As, I don't need simultaneous ESP-Now and WiFi I have built a test system that runs ESP-Now most of the time, ie 99.9% and then when I need the WiFi I shut ESP-Now down and fire-up WiFi.

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: ESP-Now support for ESP32 (and ESP8266)

Post by mattyt » Wed Oct 06, 2021 6:28 am

Just a quick heads-up: I heard on the recent Hackaday podcast that there was a robotics effort that used a PC to do all the processing and ESP-NOW to communicate to the robot.

The interesting part is that I wasn't aware of the project to implement ESP-NOW on Linux. The repo is Linux-ESPNOW. Thought this may be useful to test comms to devices using ESP-NOW.

Apologies if this is old news!

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP-Now support for ESP32 (and ESP8266)

Post by davef » Wed Oct 06, 2021 7:11 am

Hi mattyt,

I downloaded Linux-ESPNOW months ago but hit a snag trying to get it to work. If you get it to work, would you let me know. :D

I wondered why they would use ESP-Now ...
it was possible to get raw packets out to robot in about 1 ms
... ah. Thanks for the links.

napo7
Posts: 6
Joined: Wed Sep 22, 2021 7:14 am

Re: ESP-Now support for ESP32 (and ESP8266)

Post by napo7 » Wed Oct 06, 2021 7:19 am

mattyt wrote:
Wed Oct 06, 2021 6:28 am
aware of the project to implement ESP-NOW on Linux. T
Is there any requirements about hardware ? Wouldn't be surprised if this requires a raspberry or some specific wifi chip, so the raw frames can be sent ?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP-Now support for ESP32 (and ESP8266)

Post by davef » Wed Oct 06, 2021 9:07 am

When reading messages by iterating over the ESPNow singleton object can you use ESPNow.config(param=value, ...)

If I set timeout to 10000 (10 seconds) the program hangs (probably for the default 5 minutes) if there is no received msg. I verified that timeout was actually set.

Thanks.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP-Now support for ESP32 (and ESP8266)

Post by davef » Wed Oct 06, 2021 6:23 pm

Update to previous post:

- using ESPNow.irecv(), with the timeout set earlier in ESPNow.config(timeout=10000) works as expected.

Should the note in ESPNow.config()
Note: The recv buffer is allocated by ESPNow.init(). Changing these values will have no effect until the next call of ESPNow.init().
read:
Note: The rxbuffer is allocated by ESPNow.init(). Changing this value will have no effect until the next call of ESPNow.init().

User avatar
glenn20
Posts: 132
Joined: Mon Jun 04, 2018 10:09 am

Re: ESP-Now support for ESP32 (and ESP8266)

Post by glenn20 » Thu Oct 07, 2021 2:07 am

davef wrote:
Wed Oct 06, 2021 9:07 am
When reading messages by iterating over the ESPNow singleton object can you use ESPNow.config(param=value, ...)

If I set timeout to 10000 (10 seconds) the program hangs (probably for the default 5 minutes) if there is no received msg. I verified that timeout was actually set.

Thanks.
I just ran a test:

Code: Select all

e.config(timeout=1000)
for r in e:
    print(r)
As expected this prints (None, None) every second. The C code (espnow_iternext()) just calls the espnow_irecv() function so it should behave identically to calling e.irecv()

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP-Now support for ESP32 (and ESP8266)

Post by davef » Thu Oct 07, 2021 4:02 am

Your snippet works for me. I'll work out why mine doesn't.

Thanks

User avatar
Zoland
Posts: 20
Joined: Wed Jan 23, 2019 2:12 pm
Location: Russia, Altai

Re: ESP-Now support for ESP32 (and ESP8266)

Post by Zoland » Mon Oct 25, 2021 5:41 pm

Accidentally stumbled upon the Expressif ESP-NOW source https://github.com/espressif/esp-now

User avatar
glenn20
Posts: 132
Joined: Mon Jun 04, 2018 10:09 am

Re: ESP-Now support for ESP32 (and ESP8266)

Post by glenn20 » Tue Oct 26, 2021 1:05 am

Oooh - that's interesting. Thanks for sharing. Apache licensed and it looks like Espressif are adding a lot of functionality (although I don't yet understand why touch screen support belongs in a connectionless network protocol ;). Some interesting reading.

Post Reply