Data logging using ez430-Chronos watch (Part 1: Firmware)

November 6, 2010 at 1:37 am | Posted in ez430 chronos, MSP430, My Projects | 50 Comments

TI provides sample program for data logging using ez430-Chronos watch.
However, the code only logs ambient temperature and altitude.
It does not log the triaxial accelerometer data.
So, I modified TI’s data logger sample project (CCS) to record x-y-z data.
Go to the bottom of this post for the link to download the code.

A simple Windows application is also written to setup the watch: date-time, sampling period (1s), and the datalog mode (ACCELERATION + ALTITUDE + TEMPERATURE).
This same application also download the data from the watch, save into csv file and plot them in separate graph.

Special thanks to Wonderful libraries: ez430chronosnet to talk to the watch and zedgraph to plot the data.

Current issue:
The watch only have enough memory to store up to 20 minutes worth of x,y,z,temp, and alt with 1Hz sampling rate.

Below is the sample data collected from playing Badminton last week.

Go HERE if you want to download the source code for the firmware.

I will release the code for the windows application on my next post.

50 Comments »

RSS feed for comments on this post. TrackBack URI

  1. This is a good blog message, I will keep the post in my mind. If you can add more video and pictures can be much better. Because they help much clear understanding.🙂 thanks Heard.

  2. hiya.
    Thanks for your code. I am using 868 MHz version, will your code work with my model? could you tell me which file you that you modified? Thank you.

    • Hi Lucy,
      There are few steps involved:
      1. Copy the “868MHz – Limited CCS Core Edition” from TI Datalogger sample code to the “ezChronos-DataLogger” workspace directory.
      2. Then, in the CCS, go to Project –> Properties.
      3. Go to C/C++ Build.
      4. Change the Configuration from 915MHz to 868MHz.
      5. Then under “Tool Settings”, go to “Include Options:”
      6. Add the “${workspace_loc:/ezChronos-DataLogger/868MHz – Limited CCS Core Edition}” to #include search path.
      7. Click the OK button to close the Properties window.
      8. Rebuild the project.

      Have fun.
      Cheers!

  3. This article gives the window-pane in which we can look at the reality. This is quite nice a man and gives in-depth information. Thanks in compensation this nice article

  4. Do you know if there is any way to extend the memory to log for a longer period? I need to be able to log at 4 Hz for 60 minutes…

    • Jan,

      Yeah, there is not much memory available with the watch. I am also quite disappointed.

      You could try a few tricks, but I don’t know if it can help store for 60 minutes with 4Hz.

      1. Try storing lower resolution of the data, i.e. storing only few MSB bits instead of full 8-bits.

      2. Try storing the difference, i.e. (current value – previous value), into the flash memory.

      Good luck!

  5. Thanks! I guess we’ll try to do some filtering before storing the data + storing lower resolution of the data…

    • Let me know your progress. Cheers!

  6. Hey, I have a Matlab script that can read in and log acceleration data from the Chronos using the specific hexadecimal serial addresses. Unfortunately, I don’t know the addresses for request temperature/altitude data, would you be able to help me?

    The other option I have is to import the required library/headers from CCS into Matlab and call the C functions through that.. would you be able to tell me which functions you used? The only temp/altitude related functions I found were buried in the logic files in CCS.

    Cheers,
    Simon

    • Hi Simon,

      Have a look under logic/datalog.c.
      Check out the datalog_sm() and do_datalog () functions.

      Cheers!

      • Thanks for the reply Rudi,

        Would you be able to tell me the library that these functions are from so that I’d be able to call them through Matlab?

        Though at the moment we’ve found the addresses for various commands in BM_API in the source files and we’re looking at using them.. so at the moment we’re looking at taking the relevant bits out of the SimplicTI sync mode commands.

        The direct way is verrrry much preferable as that way I can use all the Matlab commands and don’t have to mess around with importing libraries.

        Also, how did you deal with the watch having to be in both acc and sync mode at the same time?

        Cheers,
        Simon

      • Hi Simon,

        In simpliciti_sync_get_data_callback( ) function under the Logic/rfsimpliciti.c file,
        you can see that the data is read/stored in the memory starting address DATALOG_MEMORY_START, which is declared in logic/datalog.h.

        // Data memory range: 0x8000 – 0x9DFF (7.5kB)
        #define DATALOG_MEMORY_START (0x8000)
        #define DATALOG_MEMORY_END (0x9DFF)

        I am just wondering, have you checked my C# downloader project?
        It might be easier to use the C# project as the reference for your matlab project.

        Cheers!

  7. @Simon: I’d be very interested in that matlab script. Is it available somewhere? Or could you send it to me by email (jan AT kocbach.net?

    • Hey Jan,

      This is the script that I grabbed: http://www.martindobrovolny.cz/vyuka/laboratore/zo/podpora_vyb/ez430/download/ez430.m

      since it’s for Linux though, you need to delete the Linux port initialisation and change it to

      s = serial(‘COM??’); %check what number ?? is in device manager
      d = icdevice(‘generic_agilent_33120a’,’s’); %hopefully you have this device, if not, try a different one

      connect(d,’object’);

      Since then we have used the base scripts to start building a GUI with graphs and fourier transforms.

      • @Simon

        Hi, I’m trying to do the fourier transform with the data too. What method did you use to filter the noise? and how did you do the fft? I try to use the fft function in matlab by the output is so strange.

        thanks

  8. Hi ruditronics,
    Thanks for your code. My eZ430 is 433 MHz version, I’ve modified config and path which you told Lucy before. But when I debug the project, it’s cause a lot of errors like

    “error: option –include_path is missing its parameter ‘dir’
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** [driver/vti_as.obj] Error 1”

    How could I do?

    thx.

    • Hi Loire,

      Check the include path if there is blank option.
      If the blank path is listed, you should delete it.

      Otherwise, remove all paths from include options and recreate again from scratch.

      Good luck.

      Cheers!

      • Thanks for your reply, ruditronics.

        I can log the accelerometer right now. Yeah!!
        But my 433Hz Chronos can stay in logging mode for 1 minute and when I download the data on PC, it show the data of 20 minutes!!!.
        ( I’ve clear an old data before the test )

        Did I miss something before the debugging?
        Thx.

      • Did you set the mode to the watch before you clear the old data?

      • No, I clear an old data before setting mode. Then I close Downloader program and open it again when finish the logging.

      • Sorry..
        I’ve forgot to copy the .settings folder. What a stupid mistake!!

        Now your project is work perfectly. Thanks much !

      • Hey, great contribution! I bought the clock (868) and I found your blog. It is very interesting. I hope to do something nice to share with you. I tried your code but I have the same problem here. I followed the steps that you gave to Lucy, but it is not happening.

        I do the following: ezChronos-DataLogger, right click “properties”, in “C / C + + Build” window “Tool Settings”. In “MSP430 Compiler,” will “Options include:” and I add the route for 868. What I can be doing wrong?

      • Hi Palomita,
        Try to re-create the options from scratch. Make sure there is no blank path listed.
        Cheers!

  9. Hello Ruditronics,

    many thanks for your code. I ordered a EZ-Chronos watch as well and I’m interested in datalogging acceleration data. Unfortunately I’m not yet very experienced in C-Code why I dare to ask, maybe a rookie question. My appoligies for that in advance. You posted data acquisition rate is limted to 1 HZ. I checked the project files and found
    #define DATALOG_INTERVAL (5u)
    in the datalog.h. I suppose this is the acquisition rate as you commented in the line above in seconds, meaning 5 seconds in this example.
    If I want to exceed the rate to 10Hz, 0.1 seconds, how to I implement this in the c-code for the datatype is limited to unsigned integer values, isn’t it?

    Many thanks!
    Marc

    • Hi Marc,

      To change the logging rate, you would need to modify the code.
      The way TI setup the logging rate is by using TIMER0_A0 which ticks every 1 second. This means, with the current setup, you can only set to minimum of 1 second or 1Hz.
      You may want to modify the code to possibly use TIMER0_A2 which can be setup to ticks every 1/10 seconds. Then, set the interval to 1.
      Try spending some time to look at timer.c file – under driver directory. If you look line 413 to 425, Timer0_A2 is currently commented.
      Good luck!

      • Hello Rudi,

        thanks, this was a good advice! I cut the datalog request instruction from the Timer0_A0 interrupt task and put it in the Timer0_A2 interrupt task. At the place of the stopwatch which in the datalogger example code is not used anyway, case 0x04, line 414ff. Instead of activating “update_stopwatch_timer()” I inrcemented TA0CCR2 += (32768/10), this value apparently fits 10ms, even if I dont understand this, why, .. but it worked. The only thing left is to initialise this TA0CCR2 and TA0CCTL2. Cos I didn’t know what I did anyway, I just put this in the function Timer0_init(void) accordingly to TACCR0 and TACCTL0.
        Said, was learning by doing with no background at all. Thanks for the help. Similar methode helps to fit the Dataloger.tcl script file (I couldnt find your executive on the sourceforge share) to extend set modes for acceleration, download and put into cvs format.
        Thanks again!
        Marc
        Thanks again

  10. Hi,

    I have a ez-430 868-MHz chronos watch.I was able to load your accn program to the watch using ccs(following ur instructions to lucy).But after I load the program on the watch,it is unable to communicate with the Access point(AP)….so after datalog,I am unable to download it to PC using AP and other standard watch functions like read watch,set watch have also stopped working..Pl.Help.Thanks in advance

    • Hi Rakshith,
      Can you provide more specific details of what you did?
      Have you checked Window’s Device Manager to see if the USB AP is enumerated successfully?
      Did you use the TI’s Chronos Data Logger or my downloader program?

      • sorry for the late reply…

        I loaded your data logger program into the watch and I tried data logging using TI’s data logger!! (realised that won’t work and had to use your downloader program)…so I removed your program and loaded the standard datalog program into the watch and it has now stopped communication..The windows device manager ennumerates the USB AP.

  11. Hi,

    I have another question.Is there any way to load the program in the watch(Flash of the watch) to some workbench(ccs or IAR)

  12. Do you know if you can pair 2 chronos watches together and if so how would you do it?

    • I guess you could, the other watch should be programmed to emulate the AP functionality.
      But I’ve never tried this before since I only have 1 watch.
      Cheers!

  13. Hi,
    8 months later….. I can not install the CCS software on my computer :-(…..

    large please,
    Could you put a “868 MHz version” available for download?

    many thanks
    tom,

  14. Hi Sir,

    sorry to bother you, am pretty new to programming such devices. I followed your advice on your blog yet am stuck at the following error, not sure how to proceed..

    “C:/work/TI/ccsv4/tools/compiler/MSP430 Code Generation Tools 3.2.3/bin/cl430” -@ccsLinker.opt -o “ez430_chronos_datalogger_915MHz.out”

    “../lnk_cc430f6137.cmd”, line 120: error: placement fails for object “.cinit”,
    size 0x16b (page 0). Available ranges:
    FLASH size: 0x6180 unused: 0x105 max hole: 0x105
    error: errors encountered during linking; “ez430_chronos_datalogger_915MHz.out”
    not built

    Thanks so much..

    Best
    D

  15. Hi Sir,

    Sorry, silly me, I was using a wrong file.

    Sorry again..

    It compiles properly now =)

    Best
    D

  16. Hi, I was working with the IAR Systems IAR Embedded Workbench.

    Now I should load the files into the CCS.
    I don´t know how to do.
    In IAR Systems there is always a Project file to open.
    How do I get all the files in CCS.
    Or how do put them all into one Project?

    Thanks

    • Hi Lieber,
      Sorry, I don’t have IAR on my machine. But, you could try the following.

      You could try loading the original TI’s DataLogger IAR project.
      Mine is at “Program Files\Texas Instruments\eZ430-Chronos\Software Projects\Chronos Watch\IAR\Data Logger”
      Then, update the .c & .h files from my CCS project to that project.

      Let us know how you do.
      Cheers!

  17. Hi, I am trying to use some of your code snippets for my own project. When reading out the watch, syncStatus always is SYNC_USB_DATA_EMPTY.

    Did you change anything in your project regarding that?

    Thanks!

    • Hi Flowschi,
      Have you tried TI’s project or my project to try if the USB is working?
      Cheers!

  18. Hi Rudi,
    Thanks for such an interesting/usefull blog. I am “playing” with my new ezChronos, and your post was quite usefull for me.
    Cheers!

  19. Hi!
    Could anyone post a link to the zedgraph plotter please?
    Thanks,
    Astateoftr

  20. Hi Rudi,
    Sir rudi, I know this blog has been present for a very long time but im currently working on a Project on eZ-430 Chronos. I saw your code and I would like to ask if I could increase the recording time if I remove the temperature and altitude feature of the watch? Thanks!

    Is there any way I could contact you in chat/email if your not busy? Thanks

    Ralph

    • Hi Ralph,
      You can modify the code to disable or remove the temp and alt recording.
      Doing that will certainly give you extra memory space. But, I am not too sure how much more space you gain.
      Cheers!

  21. Hi Rudi,
    I want to write a C or C++ code to get acceleration,temperature and altitude data from the watch. Getting the acceleration data is relatively simple since I have the necessary addresses to request data.However I could not find a way to do it for the temperature and altitude data.I know there is already a post about the same issue and I had already gone through the aforementioned header files but I am really new to programming these devices and I could not get my mind around how to do it. If you can be more specific and show me a way to achieve I would really appreciate it. Thanks.

  22. I loaded your project into CCS and all I get is a flood of 17 errors.

    “a value of type “int” cannot be assigned to an entity of type “u8 *”

  23. Hi,
    I’m doing a project using ez430 chronos watch and i need to save the data on the
    acc. Could anyone send me the link of the code that i need to download and the library files from the starting and steps to do that please.
    Thank You.

  24. Hello rudi,
    I am not getting any data to .csv file… It showing blank page…. but the hardware blinking i think the data received by the device… Thanks

    • Sorry, I am not too sure. Do you have the write permission to the file? Is there any exception raised within the project?

      • Accelerometer not working……all are idle no changen happens… please help me how to overcome….

  25. In all the tabs data is similar….


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: