10 minutes
The goal of this exercise is to get you familiar with what a Sun SPOT device is. You will learn about the different parts visible and accessible on a Sun SPOT device.
Pick up one of the Sun SPOTs. There is a lid on the Sun SPOT, sometimes called a Sun roof. You will need to take the lid off to get at some of the switches and LEDs. To open the lid, press firmly on the lid, down and back, on the edge of the lid near the small raised dot. You can think of that small-raised dot as the fingernail-catching dot. The closer to the edge that you press, the easier the lid will open. See the illustrations below:
The opposite end of the lid will pop up. Grasp that opposite end to remove the Sun SPOT lid.
Now that you have opened it, you can see the LEDs and switches on the sensor board.
These are under Java program control, so they will act differently, depending on the application that is running. That fin at the top of the SPOT is the radio fin housing the antenna for the wireless communication.
See Figure 2 for the complete anatomy of a Sun SPOT.
The sensor board has the following sensors and input/output components (see Figure 3)
The Sun SPOT Main Board has the following components(see Figure 4)
The back of the Sun SPOT is where you will find various components useful to the functioning of the Sun SPOT (see Figure 5)
If you tilt the SPOT so that the fin is away from you, you will see the Control Button.
The Control Button is used to reset the SPOT, to put it to sleep, and to wake it up. If the SPOT is asleep, clicking once, briefly - just a tap - on the Control Button will wake the SPOT up. You may have to press hard, but you don't have to press long. If the SPOT is awake, clicking once on the Control Button will reset the SPOT and restart whatever program it was running. Pressing the Control Button down and holding it down for five seconds will put the SPOT to sleep. Let's try it out:
That's it! You have mastered the SPOT Control Button.
NOTE: If the Sun SPOT does not boot, if the LED to the right doesn't flicker when you tap the Control Button, the Sun SPOT probably needs to charge its battery. To charge a Sun SPOT battery, attach the SPOT, using the supplied USB cable, to the USB port on a working computer. The USB power will fully charge the Sun SPOT in approximately three hours.
Here is a little more detail on the LEDs that are on either side of the SPOT Control Button.
Those LEDs can be controlled by Java programs on the SPOT, but in ordinary circumstances, they are controlled by the operating environment on the SPOT. The LED on the left will tell you about the power status on the SPOT. Here are its most important signals:
Power LED Signal | Meaning |
Two red flashes | Powering down |
Slowly alternate between bright and dim green | Charging from USB; CPU active |
Slowly alternate between dim green and off | Charging from USB; CPU asleep |
Steady dim green | Attached to USB, fully charged; CPU active |
Slowly alternate between dim red and off. | Battery low. |
One short green flash | Resetting, restarting program. |
One bright green pulse, sharp on, soft off |
Powering up
|
The LED on the right is under application control. If that behavior is not changed, the system programs will use it to tell you about the communication status of the SPOT. Here are its most important signals.
Activity LED Signal | Meaning |
Rapidly flash green |
Searching for the host workstation on the USB connection
|
Flash green | Packets being received from the host workstation |
Flash red | Packets being sent to the host workstation. |
On the underside of the Sun SPOT device, you will find a sticker inside the upper radio fin housing, which specifies the last two numbers of the 802.15.4 MAC address of your Sun SPOT. The complete 802.15.4 MAC address is derived by combining "0014.4F01" with the 2 numbers found on a Sun SPOT device. If the sticker mentions 1234.5678, then the address is 0014.4F01.1234.5678.
If you are an attendee of the Java One 2007 hands on lab session, you will also find an additional sticker. This sticker is on the outside of the plastic case, directly on the bottom of the Sun SPOT device. On this sticker you will find a number, prefixed with "HOL". This number is used to identify the Sun SPOT devices allocated for the hands on lab you are attending.
After you have completed Exercise 1 , it will be important to distinguish between the two Sun SPOT devices you have. We will identify each one by attaching a logical label to each. After you have completed this exercise, we will logically identify each sun SPOT device as Bendy SPOT and device Servo SPOT.
<lab_root>/spot/exercises/Ex1-Identify
and get information about your Sun SPOT device with the ant info
command$ ant info Buildfile: build.xml -pre-init: -init-user: -init-system: -do-init: -post-init: init: -override-warning-find-spots: -prepare-conditions-for-find-spots: -find-shared-basestation: -run-spotfinder: -decide-whether-to-run-spotselector: -run-spotselector: [java] Please wait while connected Sun SPOTs are examined... [java] Experimental: JNI_OnLoad called. -collect-spotselector-result: [echo] [echo] Using Sun SPOT device on port /dev/cu.usbmodem0000103D1 -clean-up-spotselector-output-file: [delete] Deleting:/SunSPOT/sdk/temp/spotselector-1587561533 -spotselector-fail: -decide-whether-to-start-basestation-manager: -start-new-basestation-manager: -do-find-spots: info: -run-spotclient-with-optional-remoteId: -run-spotclient-with-script-contents: -run-spotclient: [java] SPOT Client starting... [java] Waiting for target to synchronise... [java] (please reset SPOT if you don't get a prompt) [java] [waiting for reset] [java] Sun SPOT bootloader (orange-070322) [java] SPOT serial number = 0014.4F01.0000.0292 [java] Application slot contents: [java] 0: SecRDDTestApp Ver: 115 Lib hash: 9074ea [java] 2396 bytes at 0x10140000 (next run) [java] 1: SecRDDTestApp Ver: 114 Lib hash: 9074ea [java] 2388 bytes at 0x101a0000 [java] Startup: [java] Squawk startup command line: [java] -Xmx:470000 [java] -Xmxnvm:128 [java] -isolateinit:com.sun.spot.peripheral.Spot [java] -MIDlet-1 [java] Not ignoring application suite at startup [java] OTA Command Server is disabled [java] Configured to run the current application [java] Library suite: [java] hash=0x9074ea [java] Installed library does not match current SDK library [java] Installed library does not match shipped SDK library [java] Current SDK library matches shipped SDK library [java] Security: [java] Public key on device does not match key on host [java] Configuration properties: [java] spot.external.0.firmware.version: 1.6 [java] spot.external.0.hardware.rev: 5.0 [java] spot.external.0.part.id: EDEMOBOARD_REV_0_2_0_0 [java] spot.hardware.rev: 5 [java] spot.powercontroller.firmware.version: PCTRL-1.77 [java] spot.sdk.version: orange-070322 [java] spot.secrdd.enable: true [java] Exiting [java] Experimental: JNI_OnLoad called. [delete] Deleting:/SunSPOT/sdk/temp/spot-temp-858636954 slots: BUILD SUCCESSFUL Total time: 3 seconds
ant info
command display a significant amount of information. For this exercise we are only concerned with one thing, and that is the SPOT serial number
. Search for a line the line above that has the following information on it$ ant info Buildfile: build.xml -pre-init: -init-user: -init-system: -do-init: -post-init: init: -override-warning-find-spots: -prepare-conditions-for-find-spots: -find-shared-basestation: -run-spotfinder: -decide-whether-to-run-spotselector: -run-spotselector: [java] Please wait while connected Sun SPOTs are examined... [java] Experimental: JNI_OnLoad called. -collect-spotselector-result: [echo] [echo] Using Sun SPOT device on port /dev/cu.usbmodem0000103D1 -clean-up-spotselector-output-file: [delete] Deleting:/SunSPOT/sdk/temp/spotselector-1587561533 -spotselector-fail: -decide-whether-to-start-basestation-manager: -start-new-basestation-manager: -do-find-spots: info: -run-spotclient-with-optional-remoteId: -run-spotclient-with-script-contents: -run-spotclient: [java] SPOT Client starting... [java] Waiting for target to synchronise... [java] (please reset SPOT if you don't get a prompt) [java] [waiting for reset] [java] Sun SPOT bootloader (orange-070322) [java] SPOT serial number = 0014.4F01.0000.0292 [java] Application slot contents: [java] 0: SecRDDTestApp Ver: 115 Lib hash: 9074ea [java] 2396 bytes at 0x10140000 (next run) [java] 1: SecRDDTestApp Ver: 114 Lib hash: 9074ea [java] 2388 bytes at 0x101a0000 [java] Startup: [java] Squawk startup command line: [java] -Xmx:470000 [java] -Xmxnvm:128 [java] -isolateinit:com.sun.spot.peripheral.Spot [java] -MIDlet-1 [java] Not ignoring application suite at startup [java] OTA Command Server is disabled [java] Configured to run the current application [java] Library suite: [java] hash=0x9074ea [java] Installed library does not match current SDK library [java] Installed library does not match shipped SDK library [java] Current SDK library matches shipped SDK library [java] Security: [java] Public key on device does not match key on host [java] Configuration properties: [java] spot.external.0.firmware.version: 1.6 [java] spot.external.0.hardware.rev: 5.0 [java] spot.external.0.part.id: EDEMOBOARD_REV_0_2_0_0 [java] spot.hardware.rev: 5 [java] spot.powercontroller.firmware.version: PCTRL-1.77 [java] spot.sdk.version: orange-070322 [java] spot.secrdd.enable: true [java] Exiting [java] Experimental: JNI_OnLoad called. [delete] Deleting:/SunSPOT/sdk/temp/spot-temp-858636954 slots: BUILD SUCCESSFUL Total time: 3 seconds
A
through F
, as well as digits. The first 8 digits will always be the same for Sun SPOT devices.
It is possible that this information will no longer be visible, simply scroll up slightly to find the line.
Bendy SPOT: | 802.15.4 MAC: 0014.4F01. . | HOL |
Servo SPOT: | 802.15.4 MAC: 0014.4F01. . | HOL |
The following scenarios are documented
-run-debugclient:
[java] Devel Library
[java] =========================================
[java] Native lib Version = RXTX-2.1-7pre17
[java] Java lib Version = RXTX-2.1-7pre17
[java] Waiting for target to synchronise...
[java] (please reset Spot if you don't get a prompt)
This indicates that the device is busy doing something else other than listening for commands from the SDK. The attention of the device must be grabbed in order for it to listen to new commands from the desktop.
-run-debugclient:This will happen if you have forgotten to plug in a Sun SPOT device, or that the Sun SPOT device was not properly recognized by operating system. Press the Control button to reset the Sun SPOT device.
[java] Devel Library
[java] =========================================
[java] Native lib Version = RXTX-2.1-7pre17
[java] Java lib Version = RXTX-2.1-7pre17
[java] Waiting for target to synchronise...
[java] (please reset SPOT if you don't get a prompt)
[java] [waiting for reset] <...>
[java] [waiting for reset] <...>
[java] [waiting for reset] <...>
[java] [waiting for reset] <...>
-main-find-spots:
[java] If the selection does not respond to
[java] input, cancel the build and set the
[java] property spotselector.noninteractive=true
[java] Sun SPOT devices found on multiple ports:
[java] 1. /dev/term/0
[java] 2. /dev/term/1
[java] Input your port selection [1-2] or 'c' to cancel:
This will happen if you have more than one Sun SPOT device connected at the same time.
BUILD FAILEDThis will happen if you have forgotten to plug in a Sun SPOT device, or that the Sun SPOT device was not properly recognized by operating system.
<lab_root>\sdk\ant\find-spots.xml:150: >
No Sun SPOT devices found. Connect a device
and retry or, if you know that one is already
connected, specify its port using the "port"
property (either in a properties file or using
-Dport=XXX at the commandline). This will force
the build scripts to use that port.
Total time: 0 seconds
$
-run-spotselector:This will happen if you plug in a Sun SPOT device which is configured as a basestation, and you are attempting to deploy to this device
[java] Please wait while connected Sun SPOTs are examined...
[java] No suitable SPOT is available
[java] Experimental: JNI_OnLoad called.
[java] Java Result: 255
-collect-spotselector-result:
-clean-up-spotselector-output-file:
-spotselector-fail:
BUILD FAILED
<lab_root>/../SunSPOT/sdk/ant/find-spots.xml:294: Spotselector failed or was cancelled
Summary:
In this exercise, you became familiar with the basic layout and functioning of a Sun SPOT device.