Sun SPOTs

Sun SPOT

Sun have finally started selling the Sun SPOT to US customers. I worked on this project until mid-2006 and I must admit I’m proud others will have a chance to use these devices. I’d like to highlight some of the great features of these devices, and some of the best things about being on this project.

Device highlights

  • SPOTs can form ad-hoc networks.
  • You can deploy code to a Sun SPOT over the IEEE 802.15.4 wireless network.
  • Code deployment is secured by elliptic curve cryptography (ECC) – SPOTs will only accept code signed by you.
  • The Squawk Java VM supports a lightweight process-like abstraction called Isolates. I think this has the potential to be a big step forward in the way we achieve concurrency in Java.
  • Mobile code: the entire state of an Isolate can be serialized, passed over the wireless network to another SPOT, deserialized and carry on running. Loads of these can be running on a given SPOT simultaneously.
  • You can build your own sensor devices and write drivers for them in Java fairly easily. All but the very lowest-level code we wrote in Java.
  • The combination of Java implementation and CPU power is fast enough to carry out some interesting tasks.

Project highlights

  • Working at home each day, pair programming with screen-sharing apps over broadband connections.
  • Somehow turning erroneous and misleading hardware data sheets into working Java device drivers.
  • Debugging my automated accelerometer tests using a spirit level. Debate had been raging in the team about whether the accelerometer would detect gravity or not. The accelerometer tests proved it is highly sensitive to gravity (hence to its own orientation); so much so that the tests were failing because my desk wasn’t absolutely level.
  • John and Dave’s continuing insistence that gravity is not an acceleration, even after this test.
  • Discussing quite seriously the possibility of running the radio stack tests inside earthed biscuit tins to prevent interference.
  • Doing radio range tests by walking up and down the street outside my house waving a circuit board in the air.
  • Bob, our hardware guru, revealing he’d had to use bigger resistors after discovering the blindingly bright multi-colour LEDs were actually illegal under US health and safety law.
  • The birth of build-o-matic – my entire contribution to that project was to come up with a retro-sounding name.

I’m particularly proud of the work I did to optimize the CPU configuration after the project moved to the ARM9. When the hardware first arrived, the eSPOT was slower than the older bSPOT. Switching on the memory-management unit, caches and configuring the bus gave a massive speed boost.

Also, my work on the deep sleep functionality. We literally power off the CPU and rely on a trickle current to keep the RAM contents alive. When the CPU is powered back up we have to restore the entire Java VM state, and then reinitialize every bit of hardware on the main board and sensor board back to exactly the state you programmed it into before deep sleep. And it all has to be transparent to the application.

Perhaps one day I will write about what it’s like to pair-program over broadband, and the experience of teleworking in general. Contact me if you’d like to prod me to actually get it written.