|HomeNet - A Wireless Network of Household Appliances|
The protocol through which these three elements communicate is extremely simple. Basically the nodes are organized hierarchically, with the PC at the top, and the receiver nodes at the bottom. No node in the hierarchy is allowed to send messages out until it has received a command to do so from a node higher in the hierarchy. So basically, the master and receiver nodes sit quietly by until the PC sends a command to the master node. At this time, the PC will not send any more messages until one of two events occurred. The master node responds to the PC’s message with some sort of acknowledgement, or a timeout occurs, at which time the PC considers the message lost, and will attempt to send the command again.
Once the master node has received a message from the PC, depending on the message, it will either directly respond back to the PC (if the PC was only asking the master node a question) or more commonly it will forward this message directly over the transmitter to the proper receiver node. Receiver nodes are constantly listening on the frequency of the network, but they ignore any message which is not properly formatted, and which is not specifically addressed to them, as specified by the node ID in the header of the message. If a receiver node hears a message that is addressed to it, it then runs code to interpret the message. Depending on the content of the message, it will perform some function, and then it will send an acknowledgement back to the master node. This is the only condition under which a receiver node ever sends a message. The message may vary depending on the command it received (for instance it may only be a simple acknowledgement, or it may contain state data), but the message is always addressed to the master node, and one is always sent after the receiver node receives a message intended for it.
The only time the master node listens for radio signals is after it has sent a message to the receiver nodes, and is waiting for a response. Just like the PC, if it fails to receive a response before a designated time out, it will send the message again. Until that timeout period is passed, the master node will not send any other messages to the PC or to the receivers, and it will not listen for PC communication. Once the master node receives a response from the receiver node it sent a message to, it stops listening for radio signals again. It immediately forwards the acknowledgement it just received back to the PC over the com port, and returns to its original state, listening for PC communication. Finally, the PC takes the acknowledgement, and interprets it in some way, before it potentially sends more messages to the master node.
Comments on network design and protocol
We chose the above network design and protocol for several reasons. The most important reason was that it is extremely simple, while simultaneously accomplishing everything that we need. Without having to explicitly program any functionality for it, we effectively created a type of “time slice” style network with central node arbitration where each receiver node has its own specific time when it can communicate. The design guarantees that there will never be network collisions, since only one node at a time ever communicates, and the proper nodes are always in a listening state when they need to receive messages. The various elements in the network were also designed so it is never necessary for a node lower in the “hierarchy” to communicate except when it receives a message dictating that it should. This of course means that it is not possible for receiver nodes to give warnings, such as low battery power, unless asked, but it is easy enough to set up poling such that the PC requests status reports from the receiver nodes on a routine basis.