Confirming node connected to gateway.
-
I was thinking of adding something to nodes so that when I reboot them I can see at the node if it has connected to the GW or not. Maybe a message on a small oled to confirm successful registration.
What would be the most reliable way to do this?
Can I get some value back from presentation stage?
Is there anything better to do (like get confirmation from the controller)?Maybe I missed the obvious here, but it's late and I have a cold.
-
@skywatch
I look for messages (e.g. presentation) at the gateway to diagnose connections at bootup. And I have a flow in node-red, which shows me, when a node didn't send for some time.You could use a led and blink codes on the node, if you really need a local indicator. A OLED would be a no go with battery powered sensors.
-
Thanks for the reply.
I really just need 'something' at the node so that when I power it on I know that it has successfully established communication with the gateway.
On mains powered units it could be a message on a display, on battery units it could be number of flashes of an led.
I do not know 'how' I can do this. Is there some response at the node that I can monitor/interrogate to find out if successful connection has been made with a remote gateway?
-
Here's an example from some of my code, specifically the SETUP function.
void setup() { Serial.begin(115200); // for serial debugging over USB. if(isTransportReady()){ Serial.println(F("Connected to gateway!")); }else{ Serial.println(F("! NOT CONNECTED TO GATEWAY")); } #ifdef HAS_DISPLAY mySerial.begin(115200); wait(1500); mySerial.print(F("CLR(0);")); mySerial.print(F("SBC(0);")); if(isTransportReady()){ mySerial.print(F("DCV16(115,1,w,0);")); } // Labels mySerial.print(F("DCV16(10,155,Barometer,5);")); // Barometer label // Wait icon mySerial.print(F("CIRF(120,239,35,3);")); // Circle as a background //mySerial.print(F("SBC(3);")); //mySerial.print(F("DCV16(105,230,wait,15);")); // Show while the forecast is not available yet. //mySerial.println(F("SBC(0);")); wait(400); #endif if(!bme280.init()){ Serial.println(F("! Sensor error")); #ifdef HAS_DISPLAY mySerial.println(F("DCV16(10,250,Sensor error,1);")); #endif } wdt_enable(WDTO_2S); // Starts the watchdog timer. If it is not reset once every 2 seconds, then the entire device will automatically restart. }
Personally I then display a "w" icon in the top-right of the screen if a connection has been made.
In the loop code it requests an ACK whenever it updates the sensor values to the gateway (once a minute). There is also a simple incrementing counter byte that increases by 1 every time there is no reply. As soon as this reaches 5 (meaning no response from the server for 5 minutes in a row) it prints an " " to the corner of the screen, to indicate the loss of connection.
If data once again arrives in the receive function, then a "w" is once again printed to the top right corner, and the incrementing byte is set back to 0.
-
@alowhum Thank you for sharing this! - This looks like exactly the kind of thing I was trying to achieve.
Hopefully I get some time at the weekend to test it out.
Cheers!
Suggested Topics
-
Update RF24 library to latest version
Bug Reports • 23 Mar 2014, 23:37 • andriej 24 Mar 2014, 22:52 -
No merge into master in the last 5 years, should we use development?
General Discussion • 23 Sept 2024, 17:48 • kiesel 5 days ago -
Why is the output of ACS712 current measurement module unchanged?
General Discussion • 19 Jul 2021, 09:09 • Tessie T 20 Jul 2021, 15:50 -
Meet in Malmö, Summer 2016?
General Discussion • 1 Feb 2016, 15:34 • bjacobse 26 days ago -
Running out of nodeId's
General Discussion • 3 Sept 2024, 07:33 • NielBierman 25 Jan 2025, 17:19 -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 13 days ago