Original URL: https://www.theregister.com/2010/04/05/chronos_ez430/

Chronos EZ430: An SDK packing watch for real techies

It's a timepiece, but not as we know it

By Bill Ray

Posted in Software, 5th April 2010 10:02 GMT

When does The Register take interest in a $50 sports watch? When it comes with an SDK and wireless connectivity, and packing a screwdriver.

The Chronos EZ430 from Texas Instruments is no consumer product, despite its appearance and low price. It's really a development platform designed to show off what TI's embedded sensor chips can do, and is sold below cost price. But for the software hacker who'd like some hardware to play with there's no better place to start doing fun stuff.

This isn't really a review of the watch - a review would require comparisons to similar products and discussion of how completely the product meets its design goals, but the Chronos has no design goals or similar products to which it can be compared, so we'll just stick to telling you what the Chronos can do and what we did with it.

Watch and assorted bits

The $50 package comes with the watch, a USB dongle with which it can wirelessly connect, a USB cradle for uploading new wrist-mounted applications, and the aforementioned screwdriver, along with a couple of spare screws. The screwdriver is used to dismantle the watch - necessary when fitting it to the cradle - and TI clearly expect you to lose a few screws in the process.

There's also quick-start manual, and on the accompanying CD there's the SDK and example applications including remote a control panel to demonstrate remote sensing, and an application for instructing the watch to create sensor logs.

Those logs can record data from any of the watch's sensors - which comprise a temperature sensor and acceleration on three axes, with the results gathered into an Excel spreadsheet for analysis.

The watch can also display the data from any of the sensors on its two-line LCD screen, but don't expect to be able to email messages on the limited screen. There's also a stop-watch, with lap timer and the usual time and date, but to use the really interesting features you'll need to connect the USB transceiver to your PC.

In Europe that transceiver operates at 868MHz. There's a US model at 915MHz and you have to specify which you'd like on ordering. Using the wrong one would be illegal as the frequencies concerned require a licence if used in the wrong territory, so if you're prone to pond hopping you'll need to order two or get hold of the soon-to-be-launched 433MHz model which can be used everywhere.

Once the transceiver is installed and the USB dongle connected you can connect the watch to your PC. It comes with three applications preinstalled: one to synchronise the time and date settings, a second which sends key presses to the computer which can then be mapped to desktop functions (the included software can be used to control a power-point demonstration, or iTunes playback), and a third which streams accelerometer data (and button presses) for more-interesting applications.

The Windows software supplied will plot the accelerometer data onto pretty graphs, and even link motion to the Windows mouse-pointer. The hilarity of trying to control Windows whilst holding one's wrist steady enough to press the buttons (mapped to mouse clicks) was well worth the $50 alone - not only for the user attempting it, but also for colleagues and those passing by who might catch a glimpse of a frantically waving hand as the user misses the "Mouse Off" button yet again.

Wavy lines

All that shaking is vigorous testing, not the result of a hangover

But hijinks aside it's the accelerometer mode which is most flexible, and what we used for our application.

Documentation is surprisingly sparse: there is a burgeoning community of developers and a good wiki, but for communications between the watch and the computer we were left with only the vaguest clues. The protocol isn't very complicated, though, and using HHD's Free Serial Port Monitor we were able to monitor communications with the watch and build a usable model of the communications process.

Having decided that what we really wanted was a music system controlled with a flick of the wrist - surely a common aspiration - we looked at the gathered logs and established that first we'd have to switch on the radio, then request updates, then poll for those updates every half second or so.

We used Java, because it was nearby, and opened up a serial port at 8 data bits, 1 stop bit and no parity, with a speed of 115200. Once open we sent a command to switch on the dongle:

0xff  0x20  0x07  0x00  0x00  0x00  0x00

To which we received a confirmation of success.

0xff 0x06 0x07 0xXX 0xXX 0xXX 0xXX

With "XX" being replaced with the serial number of our watch.

So we followed that with request to switch on the radio communications:

0xff  0x07  0x03

...to which we also, generally, received a confirmation:

0xff 0x06 0x03

But before we could start polling we had to run the preinstalled ACC application on the watch. Once that's running we can send a polling request and receive values for the X, Y and Z axis: one byte for each axis:

0xff  0x08  0x07  0x00  0x00  0x00  0x00

Which was rewarded with the data we're actually interested in...

0xff 0x06 0x07 0x01 0xc0 0x05 0xde

With the last three numbers being the attitude of the x, y and z sensors.

Having achieved a steady stream of data points, and amused the rest of the office by waving hands repeatedly above the desk, we set about determining a pattern of movements which would trigger our music playback to skip to the next randomly selected track. After some more arcane hand waving we decided the easily thing was a clockwise twist of the wrist after a period of holding the hand vertical.

Catching such a pattern was just a matter of spotting when the hand was vertical, and then noticing when the orientation changed at sufficient speed. For simplicity we're limiting ourselves to one axis, X, the attitude of which is held in the fifth byte received when polling (addressed as 4 given Java's preference for arrays indexed from zero). We count up the number of polls during which the hand is held vertical (between 0xd0 and 0xc0), and then check if the hand is horizontal (>0xf0) immediately afterwards:

if ((readBuffer[4] < 0xd0) && (readBuffer[4] > 0xc0)) {
  clockwiseCounter++;
  if (clockwiseCounter > 6) {
    clockwiseCounter = 6;
  }
} else {
  clockwiseCounter--;
  if (clockwiseCounter < 0) {
    clockwiseCounter = 0;
  }
}
if ((readBuffer[4] > 0xf0) && (clockwiseCounter > 1)) {
  System.out.println("Change Track");
  playNextTrack();
  clockwiseCounter = 0;
}

That was then used to trigger an HTTP request to our music software. We could have accomplished anything but in this instance we just request the next track be played.

It would be a lie to say that colleagues were unanimous in their admiration for such a creation. 'Admiration', in fact, is probably not the right word, but they were unanimous in saying they'd never seen anything like it.

Not that the Chronos is limited to selecting music to play back. Cleverer people have put it to work unlocking doors (using the accelerometers to tap out a pass code) or controlling a robot arm:

We'd like to get some applications running on the watch itself. The supplied SDK is limited to an application size of 16K and one has to pay real money to extend that, but it would be good to replace the buttons with taps with a view to a pocket-watch form factor. But even if all we ever manage is switching tracks with a flick of the wrist that's still worth $50 of our money.

Most people wouldn't be interested in paying $50 plus $16 postage just for the opportunity to make a fool of themselves by waving a loaded wrist in front of colleagues and friends alike, but we know that Reg readers aren't like most people. ®