Jump to content

Newbie need help... MSP430G2553 Stopwatch with datalogging

Recommended Posts

Hi All


I have recently joined 43oh and have been literally almost studying this site.


I am currently a university student in South-Africa and we have just received our final projects last week. I am completely new to MCU and have very VERY little knowledge about them. We are only starting to study them now, however my final project requires an in-depth understanding.


I have done a lot of research on the MSP430G2 Launchpad (as we were supplied with these). My project is described as follows...


I must build a stand-alone unit with the following features

  • Must display a real-time clock
  • Have a stopwatch feature (start,stop,reset buttons)
  • Must log each batch with the batch number, actual time, laptime (from stopwatch)
  • Device must be connected via Ethernet to local network for uploading of logged data to a PC (Not limited to Ethernet)

At the moment I feel like this :huh: :huh: :huh: :unsure: :unsure: :unsure: !!!!


Any help in this matter will be MUCH appreciated. I was also supplied with CCS as a software package.


Through my research I am proposing the following idea:

  • Use MSP430G2553 MCU for coding real time clock, stopwatch
  • Connect a 16x2 LCD display to my MCU (Not sure if I must use serial LCD or Parallel - Lecturer advised serial?) Need to purchase
  • Make use of CC3000 Booster Back to generate a WiFi connection, instead of Ethernet, to send the data. (Here I am still unsure about how this communication will send my required data and to receive and log it on the PC side) Need to purchase
  • I also found Rob's Ethernet Booster pack, on the site, and wondered if this can maybe also work?
  • I saw a SDcard reader Booster pack and though that this might be an additional to store information as a backup

Please, ANY help in this project will be much appreciated.

Link to post
Share on other sites

There are certainly some good RTC libraries on the site - I used one for my clock project that I think was created by oPossum.  TI has some getting started examples for the CC3000 for the MSP430G that should be a good base as well.  Do you know if you need a webserver example or if you need to push data someplace?  

If you need an LCD - parallel could be an issue because of pin count.  Depending on the type of LCD you're looking to use - there are again tons of examples.  Check out the 43oh store for some examples.  You can also use the HD44780 (parallel) if you just need text.

Your biggest problem may  be pins - start adding too many peripherals and you'll run out.  You'll also need to look for pin contention among boosterpacks - several SPI devices is fine, as long as they use different pins for select, interrupt, etc.

Link to post
Share on other sites
Well, that's a healthy, robust and challenging project for a newbie! 
How much time do you have to solve this?
Do you have any team mates to help out?

RTC, Stopwatch, LCD and WiFi are topics that have been solved by folks here on the board so, I am sure that you will find excellent guidance here.


I recommend the first thing that you do is create a block diagram of all the functionality that your customer has requested (your Prof).


Then, fill in all the little details for the features: For example:

- What resolution does the stop watch need to track or display?

- What information should the LCD show?

- How much information should the device record?

- and so on ...


Then, figure out all of the hardware requirements. For example:

- What is the complete list of peripherals?

- Is a simulated RTC sufficient or do you require a dedicated external RTC chip?

- Does the G2553 have enough IO pins to drive all the peripherals?

- Can you interface to all of the peripherals over one type of serial bus? ie: I2C vs SPI vs Bit Banged, etc...

- and so on ...


Then, figure out a process flow diagram. What do you have to do?


List out all of the functionality that must be implemented. Try to organize the tasks by priority or importance. Attempt to draw a diagram of all of this activity. Don't worry. The first draft won't be perfect but it gives you something to visualize, contemplate and refine.


If you can explain to someone else what you want to do, then realize this, you have succeeded. You will have your road map in front of you and it will be just a matter of doing the work to complete the project.



@@cubeberg, you meant "good" RTC libraries, right?  :wink:

Link to post
Share on other sites

Thanx guys for all the help so far.


I have really spend a week just reading and reading and the more I read the more I don't know where to start, but Im really enjoying this because it is so interesting.


Cubeberg: I will have a look to see if I can find the RTC libraries. With my data logging they did not specify in which way. It can be over ethernet or any way, just as long as I can log processes and have it available for viewing. As I mentioned, the data logging looks really difficult to me?


On the LCD display, that is why I think the Lecturer said serial to reduce pin count. I only want to display text like welcoming and then the real time and the stopwatch that will be running.


You'll also need to look for pin contention among boosterpacks - This is where I'm also not sure which booster packs to buy to avoid this problem. Will I be able to run a LCD with a Wi-Fi module for example? Everything is new to me...

Link to post
Share on other sites

Hi Zeke


Indeed it seems like a mountain before me....


How much time do you have to solve this? - I have 9 weeks to do everything with documentation, demonstration etc (Program, Learn software etc) :mellow:


Do you have any team mates to help out? - Nope this is all individual projects


Thank you for all the guidance in planning out this project. I would really love to accomplish this task, I am just affraid that my time will be to little and the learning curve to steap as I have four other subjects that I need to attend to as well. There is a few other projects as well to choose from.


I dont mind the challenge...

Link to post
Share on other sites

@@zeke - nope - they're the REALLY good ones :)  


@@JapiMostert - regarding pin contention - you could always use jumpers/wires instead of stacking - that way you choose pins yourself.  The 9 weeks and shipping is probably going to be a problem with pre-made boosterpacks though.  You may need to see if you can find more local components (might start with ebay).  

As Zeke suggested - get organized first and make sure our objectives are clear - that will make selecting hardware much easier.

Link to post
Share on other sites

with launchpad and g series, I would use 2553 and serial for display, as there is a hardware serial peripheral on g2553, and the 32khz crystal for timebase. Use a HW counter to interrupt after 32768 ticks for counting seconds. Buttons would be interrupt driven. Note that debounce can be hard.


Ethernet: lots of options, and  I can't give advice.


Not limited to ethernet? might go serial? Easy, and faster than human trigger to stopwatch. Multiple serial is fairly easy: one HW, one SW using a timer..

Link to post
Share on other sites

All the help is much appreciated guys


Cubeberg - Im also worried about my time frame


enl - I also though to go serial first. RS232? and try to first get some data transfered (can always try at later stage to go to WiFi) But my question is how do I accept and log this data on the PC side now? Will I have to write some code or is the software for my application?



Link to post
Share on other sites

Hey Roadrunner84


HAHAHA.... Welcome to my world of studying engineering.


I thought you only learn to swim when you are a kid but with us and our university they like to teach us to swim every year. Last semester for process instrumentation2 I had to do a PLC S7-300 project connected to a SCADA system and we have never worked on ANY of those software packages or anything.


I am currently busy with a subject called DIgital Systems3 and there I touched a MCU for the first time in my life last week.... So my other subject Design Projects 3 requires me to do a project, I was looking into the stopwatch project, as my final project for my coarse.


This is why I really need help from 43oh, because I am completly lost.


Dont know if I should grab another project perhaps

Link to post
Share on other sites

I must build a stand-alone unit with the following features

  • Must display a real-time clock
  • Have a stopwatch feature (start,stop,reset buttons)
  • Must log each batch with the batch number, actual time, laptime (from stopwatch)
  • Device must be connected via Ethernet to local network for uploading of logged data to a PC (Not limited to Ethernet)

Well then, let's break stuff down, shall we?


Building an RTC is quite straightforward when you have a reliable interval handler (as is done in the RTC libraries mentioned earlier). For displaying you'll also need to choose an LCD or LED display panel and drive that correctly. For this also there are a bunch of libraries and example codes.

A stopwatch is basically a second clock which you can reset (or sample, in case of laps) at the push of a button, so you just have to think of the correct behaviour for your stopwatch. You'll also need to think about the buttons and how to make them work reliably (search for button debouncing to prevent a lot of frustration).

For logging you'll need a memory, either SD, flash or RAM (internal or external). The big drawback of SD cards is that you'll most probably want to conform to the FAT storage format, which introduces a lot of overhead. Using a dedicated flash or RAM chip will save you that trouble. Be aware that memory is always finite, so how much will you actually store (100 laps, 1000 laps, a million?)

Is Ethernet a must have? Or is a serial (or serial over USB) connection permitted as well? If Ethernet is required, you may look into the boosterpack, but prepare for a lot of low level Ethernet thingies.

You could (albeit not as educative or fun) also use a Raspberry Pi (they do ship in SO-DIMM format these days) and have Ethernet and time keeping done all for you.

Link to post
Share on other sites

This is really breaking it down alot for me Roadrunner


I am greatful for all the help.


I thought that the RTC, stopwatch might still be achievable. Also wiring it to a serial 16x2 LCD display might also be okish? Buttons etc... These things I think I can maybe manage with alot of research and help still.


BUT.... The data logging is a very unclear matter. In a way I understand what you are explaining with this. I am not bound to Ethernet. Spoke to Lecturer and asked if I can maybe first establish it with serial (UART) usb? or Rs232? I don't know if this is easier? He said it is fine.


I get what you saying about storing the information on flash, RAM etc but please clarify my understanding about this process... because I think I got this process wrong? Do I first need to finish a lap like 00:12:45 for example, store this in flash or RAM for example, and then send this over serial (usb) to PC. How will the PC receive this information, do I need to write my own software and can I log each process on the PC.

Link to post
Share on other sites

Data logging to a PC should not be a frightening topic.


I would not bother trying to save data on the MSP430 because you can do something even more simple. You just create a package of data to be saved and then send it over the serial port and let the program at the other end do the saving.


I did a quick google search to find someone using python on a PC to log to a file. I found this project which would be an excellent starting point for your needs. 


Additionally, @@zlalanne shared with us his node.js based serial data gui. His example would get you very close to your project objective of being web based.



So, since you have no project partner (except all of us here on 43oh.com  :wink:) here is how I think about a new project. I would start by making lists of important details such as device drivers, data structures and command and control functionality.


Not to do your work for you but, here are some of my guesses for your project.


What low level device drivers will I have to create?:

1. A one millisecond timer (interrupt driven)

2. An LCD hardware + software interface (polled driven)

3. A button switch reading routine (interrupt or polled driven)

4. A serial port Communication interface



What data structures will be required?:

1. A Global Timer Tick variable

2. Time variables - hours, minutes, seconds, milliseconds

3. An RTC Event structure - elapsed time in hours, minutes, seconds, milliseconds

4. Some sort of LCD line buffer(s)

5. A serial port ring buffer(s)



What command and control functionality will be needed?:

1. An RTC engine (track milliseconds, seconds, minutes, hours at least)

2. An LCDisplay engine

3. An RTC Event logging engine



Please refine these lists for your needs.


What do you think? 

Link to post
Share on other sites

Hi Zeke


Thanks for this outline and list.


I will look into the links you gave me. I am starting to look into another project also, that I will post. (Deciding to switch over maybe). I am really worried about my time frame and my lack of knowledge and understanding...


I am really glad I found 43oh...

Link to post
Share on other sites

Hello @@JapiMostert,


I just read this thread and your questions. Since I just finished my masters degree, I can well imagine how overwhelmed you feel facing the requirements of your project. As it's already been said, try to draw a graph of the components, how they interact and which functions you want to accomplish. Don't try to overaccomplish what's asked. Try to find the easiest ways.


Don't be afraid of the term "data logging". If you just send the time of the stopwatch over UART, that's everything you need. On the MSP430G2 launchpad you have a UART->USB bridge (just in case you didn't know that already). On your computer you just open a serial console / terminal program like "hterm". Everything your MSP430 sends over UART will be on your computer screen. Actually that's allready some sort of "data logging". Then, you'll just save the output to a text file (hterm has a buttong "save output") and you're done. 


You don't need a dedicated RTC module. The launchpad has a watch crystal on boad (actually you maybe have to solder it on). I think that's the reason why your professor thinks this wohle project is logical and easy to do. 


Regarding the button debuncing: adding a capacitor would do the trick and will propably save you some headache with software debouncing.


Since you are using CCS you could also use "Grace" to configure things like UART peripheral, timers, button interrupts, clocks etc.




Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...