How to detect lost ESPnow connection?

Vejlgaarden
Posts: 3
Joined: Fri Aug 13, 2021 3:40 pm

How to detect lost ESPnow connection?

Postby Vejlgaarden » Thu Feb 24, 2022 9:27 am

Hi

Im trying to make a system with 2 ESP32'es. On the master side is a Emergency button and on the slave side is a safety relay.
The thing i want to make is a system that turn on the relay if the emergency button is pushed (this i have done) and then also turn on the relay if the connection to the master ESP is lost (the thing i dont know how to do).

I hope you guys can help.

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: How to detect lost ESPnow connection?

Postby ESP_Sprite » Thu Feb 24, 2022 10:35 am

There's no such thing as an ESPNow 'connection' that can be physically broken, the entire thing is more-or-less stateless and a 'connection' more or less only encapsulates the configuration needed to send/receive packets from another node. As such, you'd have to manually send packets back and forth ('ping') to essentially see if the other party is still alive - if you don't receive packets for x time, the other side can be assumed dead.

Vejlgaarden
Posts: 3
Joined: Fri Aug 13, 2021 3:40 pm

Re: How to detect lost ESPnow connection?

Postby Vejlgaarden » Thu Feb 24, 2022 11:43 am

Thanks for the response. Ill look into it.

vanBassum
Posts: 68
Joined: Sun Jan 17, 2021 11:59 am

Re: How to detect lost ESPnow connection?

Postby vanBassum » Thu Feb 24, 2022 1:56 pm

No matter what you use thats the only way to detect this anyways. Things like tcp also send keep alive messages. If you don't keep polling you don't know if the other party can hear you. (And you them)

Who is online

Users browsing this forum: No registered users and 108 guests