Internal ATD TOS/Mica2 Hints
-
1. Description and Overview
- This is a simplified sheet to help show how to make and install the Tsoil Demonstration program on the Mica2 motes.
See Below Also:
How to Program a Base-Station-Mote
How to Run Procomm and Base-Station-Mote to watch RF data messages
How to Remotely Command and Initialize a Mote's EEPROM
How To Program a CME Tsoil Mote
NOTE, Code Repository: J.Militzer's pc (lodgepole) Originally code was to be jointly developed on this PC and on Linux machine rerun. Lynette was working on rerun and had trouble bringing the TOS release up to properly make the applications; whereas the Windows PC was up-to-date (as of ~April) and worked just fine so I simply kept going with that platform. to-do: port code / OS to rerun. CODE BACKUPS LIVE on ATD servers: ~militzer/ISA/TsoilApplication/JWM_TsoilRF/ Steps: 1) Logon to JM PC, lodgepole 2) Double click on 'Cygwin' icon This starts a bash shell terminal Note the ~/.bashrc startup sets several aliases and does a cd to tos and 'mores' the environment so you must Type 'q' to end more. 3) cdtsoil This aliased command puts you to the parent directory. 4) cd Version4 This is the working version directory for CME tsoils 5) cp TsoilMsg.h.OPSVERSION TsoilMsg.h This version of the .h file has the 30-second reporting of 20 'bursted' a/d readings and averaged together. 6) Prepare mote programming board: - remove power from MIB510CA - plug MIB510 into COM1 - install mote on MIB510CA - plug power cube into MIB510CA NOTE: only the MIB510CA serial programming version of the support board can be used. The older version, the MIB500CA had a parallel port and can be identified by the 25-pin centronics connector on the other side from the normal de9 serial port. 7) make mica2 install.xx ID=yy Where xx=mote number (ie. 18,21, etc) as written on the board. yy=tsoil string number. Originally all strings were numbered to be consistent with their mote number. However, one mote died (23), and it's string was put onto another mote this way: make mica2 install.18 ID=23 If it's an 'old' mote (ie previously initialized) you're done. If it is a 'new' mote it should have its eeprom set with a calibrated vref value as opposed to the default value. This isn't entirely necessary but advisable for this application. NEW METHOD: make mica2 install,xx mib510,com1 ID=yy 8a) Verify Mote is Programmed: Observe leds Every 30-seconds, the green led should come on briefly followed by a fast blink of the red led and the amber remaining on for 5 seconds. This indicates that the tsoil code was loaded and is working. 8b) Verify Mote is Programmed: Observe data See next section
RUNNING the Procomm script to Display MOTE Packets ...
There are 2 ways to observe the data: mote serial port, base-station mote RF 1) On JM PC, lodgepole, Double click on 'Procomm' icon This starts procomm and the remaining steps are with it. Base-Station-Mote RF: --------------------- 2) Connect base-station-mote to PC's USB serial breakout box, and power it up. Port COM6 is convenient for this. 3) On Procomm click settings 'Direct Connect-Com6' '19200' NOTE: On bottom next to the com setting 'DecodeTsoilMote' NOTE: On top bar, the pull-down menu next to the funky little guy with the 'A' 4) Watch data coming in on screen with 'decoder' aspect script running. Note: the funky little guy starts 'running' You can stop the script by clicking the funky little guy. EXAMPLE OUTPUT DecodeTsoilMote! Running Time typ grp/len id seq# ns np nch batt soil1 soil2 soil3 soil4 soil5 soil6 8/17/2004 13:55:29 10 65/28 10 2 1 20 7 2972 5572 5493 5486 5461 5450 5470 13:55:32 10 65/28 10 3 1 20 7 2972 5574 5489 5482 5455 5441 5463 13:55:35 10 65/28 10 4 1 20 7 2972 5577 5492 5482 5451 5435 5457 13:55:38 10 65/28 10 5 1 20 7 2972 5572 5495 5479 5452 5434 5455 13:55:41 10 65/28 10 6 1 20 7 2972 5578 5495 5482 5453 5434 5456
RUNNING the 'Command' program to Setup Mote Operating Parameters
1) Connect the mote programming board as above: Ie this means putting the mote on the MIB510CA and attaching it to COM1 as noted above. 2) On JM PC, lodgepole, Double click on 'Procomm' icon This starts procomm and the next step is with it. 3) On Procomm click settings 'Direct Connect-Com1' '57600' This is the same connection as what was used to program the mote, but this time we'll watch the serial messages coming from it as we command the mote from the base-station. You also may want to startup the procomm 'DecodeTsoilMsg' script as well which won't interfere with seeing the command reply messages. 4) Connect base-station-mote to PC's USB serial breakout box, and power it up. Port COM6 is convenient for this. 5) Shut-down any COM6 'Procomm' or else swap it to a different 'com' port 6) On 'Cygwin' window, Start Java SerialForwarder Application: sf6dot NOTE: this is one of the aliased commands which actually does this.... $ java net.tinyos.sf.SerialForwarder -comm serial@COM6:19200 & Observe 'gray' window pop-up and indicating that it's 'OK' NOTE: This program forwards any RF mote data received by the COM6 attached base-station-mote to secondary application programs listening on TCP/IP Port 9001, but for now we're not using that. 7) On 'Cygwin' window, Use the aliased commands 'cmd' as noted.... EXAMPLE SCREEN BROADCAST 'CMD' HELP: militzer@atd-lodgepole /opt/tinyos-1.x/apps/JWM_TsoilRF/Version4 $ cmd Usage: java net.tinyos.tools.BcastInject
[arguments] (optionals) where
and [arguments] can be one of the following: NOTE: all commands begin with 'moteid' where 'moteid'=0 means ALL Motes of this group adc_readings [id] [npoints] (#adc points/sample) adc_rate [id] [convert-mseconds] (binary as 32/64/128/256/etc) cmd_listen [id] [interval-seconds] init_eeprom [id] (-1) Initializes EE:ADC Cals Use (-1) to setup '#defined defaults' read_ee [id] [line#] Testing to readEELine reboot [id] sample_rate [id] [interval-seconds] samples_per_msg [id] [nsamples] set_cal [id] [adc# a0 a1 a2] set_output [id] [0=raw,1=mv,2=linear,3=poly] start_sensing [id] [nsamples] [interval_ms] (unimplemented) stop [id] (future use..../no DAQ) set_vref [id] [value] (mica2~=1.2 mica2dot~=.6 read_vref [id] read_output_flag[id] read_cal [id] (adc#) default=all chan. working array Use (-1) to see all chan. in eeprom militzer@atd-lodgepole /opt/tinyos-1.x/apps/JWM_TsoilRF/Version4 $ cmd read_cal 18 Sending payload: 27 10 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NOTE: this command is sent to mote #18 and the reply of this command from the mote will actually show up on it's COM1 port at 57600bps. NOTE: the 'cmd' program outputs what it is sending to the mote but at this time i'm not printing the decoded replies from the mote which is why we'll look at the COM1 port messages directly. $ cmd set_vref 18 1.227579 Example of how to setup the ref. voltage. NOTE: DON'T USE 'init_eeprom' at this time!!!
How To Program a Base-Station-Mote
All of the steps are similar to those for programming a mote except: 1) Attach a Mica2dot to the MIB510CA programming board and attach it to serial port COM1 on the PC 2) on JM PC: Make 'TOSbase' base-station-mote $ cd /opt/tinyos-1.x/apps/TOSBase $ make mica2 install.0 (base must be address 0)
- This is a simplified sheet to help show how to make and install the Tsoil Demonstration program on the Mica2 motes.
- Last modified: Aug 17, 2004