Graphing ti ez430 Chronos watch data in Processing

Thanks to a helpful comment on my previous post Graphing ti ez430 Chronos watch data in Linux Sean Brewer posted the help I’d been looking for to get the chronos working with processing.

Following on from the sample code posted by Sean (pastebin or my mirror) I have made the code into a more conventional processing style and added simple graphing functionality in processing to allow the simultaneous graphing of xyz data and my updated code can be found below.

Using processing seems to perform slightly less well than python as it is slower and less data arrives marked as valid (any thoughts on why this is would be appreciated as always) but still provides a workable system. It does seem to be linked to problems I was having implementing this, where the data appeared jumbled, at that time I wasn’t aware of the validation byte.

Code

chronosgraph.pde – sketch to take data and graph it

chronos.pde - original  sketch which just gets data (Sean Brewer)

Graphing ti ez430 Chronos watch data in Processing

  1. John Stout says:

    Thanks for this. I’ve managed to get it working on my laptop (Windows 7), but it does seem to take quite a long time to get started. I think this is due to the enumeration of the serial ports.

  2. Aaron says:

    Thanks for this code. It is immensely helpful. I have noticed that the communication is very slow and that most of the serial packets are being ignored and contain useless data. Is there any way to increase the throughput? I’m trying to track movement, so I need fairly high resolution.

    Thanks!

  3. Tim says:

    Hi, thanks, this helped me. I notice that the data values seem to get interpreted as integers, so that when they go below 0 they jump to 255 instead of going negative. This is probably obvious, but I reckon it’s a bit easier to deal with the data later if you do something like:
    if (x>127) x -= 255;
    for each channel.
    Thanks again, Tim

  4. malt says:

    Thanks for the post. Pardon my ignorance, but is Processing (+ the USB RF dongle) the only thing needed to read data from the watch?

    I’m trying to get this running on a Mac…

      • matt zb says:

        Cheers Oliver,

        With a bit of rejigging I worked it out using your code. There were two stumbling blocks:
        1. addressing the correct port.
        2. sending the right handshake to the device

        The first I worked out simply by trying all the available ports (trying different indexes in the list):

        void setup() { 
          println(Serial.list()); 
          port = new Serial(this, Serial.list()[0], 115200); 
        } 
        
        void draw() { 
          if(port.available() > 0) { 
            println("port " + port1.read()); 
          } 
        } 
        
        The second I cribbed from your code:
        
        int startAccessPointNum[] = {255, 7, 3}; 
        int accDataRequestNum[] = {255, 8, 7, 0, 0, 0, 0}; 
        byte startAccessPoint[] = byte(startAccessPointNum); 
        byte accDataRequest[] = byte(accDataRequestNum); 
        
        void setup() { 
          ... 
          port.write(startAccessPoint); 
          port.write(accDataRequest); 
        } 
        
        void draw() { 
           if(port.available() > 0) { 
             ... 
           } else { 
            port.write(accDataRequest); 
           } 
        } 
        
        

        Thanks again. I would have been utterly lost without your post.

Leave a Reply