Determine active nodes on network

Started by overdrive, January 15, 2014, 02:59:44 PM

overdrive

Quote from: thinkpeace on January 20, 2014, 12:16:55 AM
The idea of sending a who's online broadcast is interesting.  A quick way to enumerate all the modules that are operating within range.  This would be useful if the gateway needs to quickly determine all the nodes that are online.

Is there some reason that you would need to determine very quickly which nodes are online?

I want to keep the solution as small and portable as possible (Nodes - Gateway - server software with uWebserver - client software/website). Having a list/database keeping track the whole time adds to complexity and the real time nature of what I want to achieve. It may also cause unnecessary rf traffic and I am not yet sure what the regulations are in my country. It would be convenient to ask who is out there (powered on) of a certain type whenever the user/s is accessing the settings/commands of a certain device type in the software.

I have started to implement a hybrid roll call registry on my server to keep track of active devices with targeted poll when the device is selected for command. I have a dynamic addressing system with optional device type addressing and manual user override. Most of my devices are always on home automation management devices and thus power is not an issue. Plugs, lights, led rgb strip lighting, security, irrigation and so on. My low power devices like soil humidity sensors are on a separate network segment and they are working as I like them to work and is excluded from the scope of my dilema.

The infrastructure and protocols are built and some basic UI, next steps are to complete the UI and fabricate the final devices I am busy designing (my prototypes are not that bad looking but it does not come close to what a professional board house can produce in size and looks  :P)

ColinR

Quote from: thinkpeace on January 20, 2014, 12:16:55 AM
The idea of sending a who's online broadcast is interesting.  A quick way to enumerate all the modules that are operating within range.  This would be useful if the gateway needs to quickly determine all the nodes that are online.

Is there some reason that you would need to determine very quickly which nodes are online?

This is the approach that I use

Sleepy module online status update

On my RF network, my modules periodically send status messages to the gateway, and the gateway keeps track of which modules are online.  This way the modules can sleep between status updates and save on battery power.  The gateway has a timeout setting which is used to determine which modules are online or offline.

Automatic node number assignment

I came up with a way that modules are automatically assined node numbers.   I assign a unique long ID to each module when I program it, which is reported with the status messages.  The gateway keeps in SD Flash a list of what node number each module uses.  When a node is added to the network, it initially will have a random node number.  When it reports to the gateway, if the node number is already in use by another module, the gateway will reply assigning a new node number.  The sensor modules know not to sleep for a brief period after sending a sensor message.  The sensors also know not to reply to messages that are addressed to a different long ID.   

Messages from the gateway to the modules

Whenever the sensor modules send a status updates, before going back to sleep none or more of the following can happen.

  • node reassignment is received from the gateway
  • digital output command is received from the gateway
  • set status update frequency message is recevied from the gateway

First, great conversation.

The above is more or less how I had this planned in my head. As the end goal is battery-powered sleeping nodes, all communication should be node initiated. For powered nodes, sleep time is zero. A separate report frequency determines how often to send data. If a sleep time is zero, the gateway knows the device should be online and responding. You can check this periodically by sending a ping-esque command. Each node can start with a sleep time of zero to be reprogrammed on first contact with gateway. To keep parameters (as stored in a gateway database, e.g. on an RPi in sqlite or otherwise) fresh in each node, you could set a refresh/check period. When a node checks in on wake (or otherwise), if it's time to sync parameters, do so. You could do this on each contact, but this would take more transmission, and depending on the parameter set, this could be significant.

On wake the device sends data a designated number of times. On acknowledge from gateway, the node is either instructed to go back to sleep or wait for commands, e.g. reprogram internal variables by gateway, followed by ok to sleep command.

As for node assignment, unless there is a limitation on number of nodes, the node number seems to be redundant. If you're going to alias a unique piece of hardware, do it with a permanent, human-friendly name attached to a 32 or 64 bit hardcoded serial or 1Wire 64-bit hardware serial number. Unlike DHCP, we're not stuck with 256 IPs to hand out.
CuPID Controls :: Open Source browser-based sensor and device control
Interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com