This sample shows how to collect data transmitted from low-power devices, employing the simplest power management strategy. There must be one and only coordinator, and the rest of nodes must be configured as end devices. At least 2 nodes are participating, but up to 8 nodes (coordinator and 7 end devices) can be engaged.
For simple node identification, define unique logical addresses by DIP switches. When setting 8 possible DIP combinations, keep in mind that:
Node | DIP switches | ||
---|---|---|---|
SW4:1 | SW4:2 | SW4:3 | |
0 | OFF | OFF | OFF |
1 | ON | OFF | OFF |
2 | OFF | ON | OFF |
3 | ON | ON | OFF |
4 | OFF | OFF | ON |
5 | ON | OFF | ON |
6 | OFF | ON | ON |
7 | ON | ON | ON |
To start the application and to initiate the network push SW1 button on each node, starting with coordinator. Green LED is switched ON if the network is started successfully.
Coordinator organizes the network with its own 'unique' PAN ID which is determined by its MAC address (considering the 16 least significant bits). Besides, user can set PAN ID in flash memory or EEPROM. In order to join, end devices are scanning the network.
End device measures temperature each 10 seconds and sends data to coordinator if the absolute increment of the measured value exceeds 0.5°C. Flashing red LED indicates data transmission, while receiving data is labelled with yellow LED. After the transmission is completed, the end device falls asleep. Unconditionally, the current temperature value is also sent if SW2 button is pressed on an end device, regardless the current node mode (sleeping or active). Do not abuse the device with quick series of multiple clicks, since this may cause unstable work.
Coordinator never sleeps; it keeps sending the received temperature data to UART via USB (see connection settings).
In order to help understanding the application code easier, two different image files are supplied, intended for programming the coordinator and end device, correspondingly.
Parameters valid for all devices: | |
---|---|
APP_CHANNEL_MASK | Specifies channels to be tried by nodes for network operation |
APP_COORD_UID | Coordinator UID; is used as coordinator MAC address and extended PANID. Must be similar for all devices in a network |
TIMER_STARTING_NETWORK | LED blinking interval during network start (ms) |
Parameters specific for end devices: | |
APP_USE_APS_ACK | Indicates whether the APS level ack will be used or not |
CHANGES_THRESHOLD | Threshold for temperature difference (values above that should be reported to coordinator if observed) |
APP_SLEEP_PERIOD | Interval between regular wake-ups and temperature difference checks |
The source codes for coordinator and end device
of Low Power Test application are located at