One set of source code is complied with different flags to generate the three different flavors of executables: 1) Anchor, 2) Pager and 3) HandCleaner.
If you need to recompile the executable (to change the radio channel or power level, for example), go to the HandHyg/SourceCode/mote directory and type one of the following three lines:
make -f Makefile.handcleaner telosb
make -f Makefile.pager telosb
make -f Makefile.anchor telosb
All three of these create an executable in the build/telosb directory. You need to move the six files that are generated to the appropriate storage place. To do this, type (if you made the handcleaner version):
cp ./build/telosb/* ../../Executables/HandCleaner/
That will copy the six files to the appropriate storage directory.
To load the executable onto the mote, go to the HandHyg directory and type:
./freshprog HandCleaner 91
That will load whatever executable is in the Executables/HandCleaner subdirectory onto the mote and designate the mote as number 91.
You’ll need to have one Pager number 1 to act as the driver for the other motes.
Behaviors:
You can tell the pagers are being loaded with a program because the small green LED near the USB flashes whenever it receives information and the small red LED flashes when it sends information. When it is being programmed both lights flash very rapidly.
All of the motes start with the red light on. This means that it is not time synched. Generally, the motes don’t start operating until they are synched. They can synch from another synched mote, but obviously, until one is starts the synching process, they’re stuck. Pager 1 will show the initiative to start the synching. When a mote is synched it turns off its red LED.
Thereafter, when a mote receives a message it turns on the green LED.
Pager:
Immediately after it is programmed, the pager is inactive. To activate it, you need to push the user button once. It will then “glow” which means that all three of the LEDs on the side turn on, then cycle off red->green->blue three or four times.
The pagers periodically send a communication (a “beacon”) announcing their presence. When they do this, they flash their red LED for one second. Typically the other motes hear the message and flash their green LED.
Handcleaner:
When you press the button on the puck (not the user button) the blue LED comes on and a message announcing the press is sent 1/8th of a second later. The blue light stays on until it hears a message from one of the other motes or BUTTON_REFRESH time passes. Regardless of when the blue light turns off, the button has an inactive period of about 8 seconds after the last press (I think — this needs to be figured out a little better).
To listen to the messages generated by the motes, you need to load basestation onto a mote and connect it to the USB. You can load basestation by going to the tinyos/apps/BaseStation directory. Then type
make telosb install
(Actually, I used “make -f Makefile.channel25 telosb install” because that makefile was modified to specify that we wanted to use channel 25)
You should see the red and green LEDs flash as the software is loaded on the mote. Then it just looks idle. It is listening to radio broadcasts and waiting to transmit them to the USB port.
To get a program to listen to the USB messages, use the copy of SerialListen (called sf) saved in the HandHyg/SourceCode directory. To run the program, type:
./sf 9001 /dev/ttyUSB0 115200
The 9001 is the port that serial listen sets up for other programs to connect to it. /dev/ttyUSB0 is the device location of the mote. For the particular value on your platform, check “motelist” The last number is the baud rate — 115200 is what the mote expects. Leave this program running in its own window. You won’t see any activity until you connect to the port with another program.
Now you can connect to the stream of messages read by the BaseStation with one or more other programs running in other windows. A very handy one is the spy program modified by Chris Hlady. Go to the HandHyg/SourceCode/IAtsynch directory. Type:
./T2spy-Hlady -t
It should say “log opened successfully” The window running sf should now say “clients 1, read 0, wrote 0″ Chris’ program parses the binary messages received by the BaseStation, which overhears all the radio traffic among the motes. It outputs the time (in seconds since some arbitrary point), whether the message is a communication or a relay overheard from some other mote, and some other stuff (to be figured out later). You can leave this running in a window. The program is also logging all this information, which can be parsed later to see what happened (including when pucks were pressed, for example).
Finally, if you want to see the raw messages, you can type in its own window (assuming that you are in the HandHyg/SourceCode/pc directory):
./sflisten localhost 9001
This program gives you the binary output of all the messages that BaseStation is receiving.
At some point we’ll have to provide the details for how to save and restore from the flash, but for now, here’s the notes I saved from our meeting with Chris.
To save the data to the flash, go to the source code for the motes
in HandHyg/Source
in Makefile Pager, Anchor and allow the data to go to flash
in the root directory run getdata. This is a script. The parameter
specifies the file, so that “getdata 1″ saves the
