Communication schemes
This page is intended to be a big-picture view of communications schemes used between microcontrollers and computers, with a particular focus on the JeeNode. In the diagrams below, JeeNodes are used for simplicity. They could just as well be replaced with JeeLink or JeeUSB modules.
Open Loop Communications
Figure 1
In this scheme, JeeNode2 broadcasts at a regular interval, or perhaps when conditions or data changes. JeeNode1 listens continuously for data and when it receives valid data, forwards it on to the desktop computer for storage. This is the simplest way to send data and in some respects is the most reliable.
It is called "open loop" because there is no feedback from modules and computers receiving data downstream. Sending module (JeeNode2 in figure 1) does not know if message has been received. so cannot retransmit if necessary.
Advantages
Simple, easy to code
JeeNode2 can go into "low-power" mode between transmissions, saving its batteries. JN1 is powered from the Computer so has a larger power supply, to listen all the time.
Disadvantages
Laptop or Desktop (Computer in figure 1) has no idea if JeeNode1 or JeeNode2 has failed, if communications cease
Requires constant transmission from remote computers so may involve lots of transmission when data is not needed by the computer
Sending module (JeeNode2 in figure 1) also does not know if message has been received. so cannot retransmit if necessary.
Example sketch:
Closed Loop Communications Among JeeNodes
Figure 2
In this scheme, JeeNode1 tells JeeNode2 that it requires data, perhaps on a timer. JeeNode2 reads the sensor requested and sends the data back to JeeNode1
Advantages
Computer can tell whether JN1 or JN2 has failed, in case of a failure. JeeNode2 doesn't have to broadcast when no data is required, saving radio bandwidth
JeeNode2 can ask for delivery receipt (acknowledgment), when vaid data is received so JeeNode1 can retransmit lost data if necessary.
Disadvantages
JeeNode2 must constantly listen for transmission ("calls") from JN1, so it must remain in high power mode more of the time, shortening battery life.
Requires constant transmission from remote computers so may involve lots of transmission when data is not needed by the computer
Sending module (JeeNode2 in figure 1) also does not know if message has been received. so cannot retransmit if necessary.
Example sketch:
Closed Loop System
Figure 3
In this scheme, the entire system is closed loop with the computer acting as the master and both JeeNodes requesting and then returning information when it is provided, either from sensors or from another JeeNode. This is similar to the scheme that Firmata uses with the Arduino, where the slave node doesn't really do anything until it is requested by the master. The benefits of this scheme are that the coding is simplified (and perhaps stabilized) on the slave so that all the coding is done in the host computer's addressing application. Like the scheme above this cuts down on radio traffic too, if sensors do not need to be read continuously. The downside is similar to figure 2 in that JeeNode2 must always stay on to be listening.
Advantages
Code on microcontrollers (JeeNodes) is stabilized - moving most user coding to the calling application
Computer can tell whether JN1 or JN2 has failed, in case of a failure.
JeeNode2 doesn't have to broadcast when no data is required, saving radio bandwidth
JeeNode2 can ask for delivery receipt (acknowledgment), when vaid data is received so JeeNode1 can retransmit lost data if necessary.
Disadvantages
JeeNode2 must listen constantly for transmission ("calls") from JN1, so it must remain in high power mode more of the time, shortening battery life.
JeeNode2 is dumb without any initiative of its own. System latencies may effect timing if precise timing is needed for events
For some applications call and response may increase radio traffic since computer must request information from slaves
Example sketch:
- charlie - The JeeNodeIoCommander is an example system implementing this "closed loop"
(From ProjectForum - Created by pbadger)