like everyone else, I finally built an alarm clock for my bedside table using an MSP430 which came with the TI Launchpad.
To get hold of the low pin count, I used a 74HC164 shift register for port expansion. Thus two pins of the MSP430 are used as shift register clock and data yielding eight outputs for the anodes of the 7-segment (plus decimal point) digits.
Another four pins of the MSP430 are used to time-multiplex the four common-cathode digits, using a variable time per digit depending on the LED count, the digit is using. This is done to get the digits equally bright.
The remaining two pins of the MSP430 are connected to push buttons for user interaction -- one pin serving double as input and output when playing the alarm tune.
A simple finite state machine is used for the control logic. I found the available 2048 bytes of program memory a bit sparse, needing to rewrite code sometimes to get a lower memory footprint. The program plus the data for the tune now use even the last available byte.
In normal standby operation the circuit consumes about 2 ÂµA -- yielding a theoretical lifespan of 10+ years assuming the 200 mAh AAA batteries won't die beforehand :)
The source code is attached below and a video can be found here:
nice use of that small msp :)
Nice clock !
I am willing to make one.
Do you have the schematics and the BOM?
Thank you in advance,
Most of the stuff came from my junk box. The 7-segment display is from ITead Studio costing just $2.00 (http://iteadstudio.com/store/index.php? ... cts_id=205 (http://iteadstudio.com/store/index.php?main_page=product_info&cPath=35_39&products_id=205)). How the shift register, the buttons, the display, the LED, the buzzer, and the debounce caps are connected to the MSP430 is described at the beginning of the source code.
Wow! So much crammed into 2K. Amazing...
Looks like your using P 1.6, and P 1.7 for double duty as well. SW1 and SW2 and speaker drive and LED is that correct?
I was thinking about using the MSP430G2452, which has 6 more I/O pins, should I be able to get by with out shift register in that case?
Thanks, great project,
Like in the original comment said: "one pin serving double as input and output when playing the alarm tune". More precisely, P1.6 is used as input and output. P1.7 is just an ordinary input.
Yes, you are correct. When I was building the clock, I did not yet have the new MSP430G2452. If you use this chip, you do not need the shift register. Also its 8 kB of code memory should make the coding much more relaxed :)
Thank you very much Markus !
Once again, congratulations for your clock !
nice build markus
[quote author="Rando"]should I be able to get by with out shift register in that case?
actually even w/ the 14 pin G2211 u can omit the shift register.
here is how i had it done.
for schematic and code, etc, google "3p4w clock", i am not able to post a link here.
Yes, actually I got inspired to build my own alarm clock by your excellent 3p4w clock (http://www.simpleavr.com/msp430-projects/3p4w-clock (http://www.simpleavr.com/msp430-projects/3p4w-clock)). It's very cool how you manage to get rid of most connection wires by placing the display directly over the MSP430. However, as you pointed out, this way the pins for an external crystal are already occupied, and to get a more accurate time base, you added an external RTC chip (http://www.simpleavr.com/msp430-projects/rtc-clock (http://www.simpleavr.com/msp430-projects/rtc-clock)).
For my project, I decided to not use an external RTC chip but connect a clock crystal to the MSP430 and instead add the shift register. Nevertheless, you were first, and your projects totally rock!
i have to say that u did an excellent layout, especially like the way u had the battery holder attached to a right size board. the 3p4w clock is not practical (losing time every day) and eventually i had the rtc chip added and i am really using it everyday. i might turn to a pcb / perf board constructions like yours as it looks really good.
[quote author="Markus Gritsch"]Another four pins of the MSP430 are used to time-multiplex the four common-cathode digits, using a variable time per digit depending on the LED count, the digit is using. This is done to get the digits equally bright.[/quote]
Hi Markus, do you use any series resistors for the LED display?
Of course not. The average current is limited due to time-multiplexing the leds.
resistance is futile :X
i can't compile source is there any way to get compiled code.
I'm using CCS on Windows, and the output directory does not contain any HEX file. There is an .out file, but I'm not sure if this of any use to you.
Has someone else here more experience with this?
i'll get it figured out. ccs and iar are not my cup of tea. i don't like windows either. thanks for your help.
by ccs you don't mean the ccs company that makes compilers ( http://www.ccsinfo.com/ (http://www.ccsinfo.com/) ) but that ti's eclipse based closed source code composer thingy?
Since the CCS company has only a C compiler for PIC MCUs and my alarm clock uses an MSP430, I think there is no ambiguity :)
I use a lot of CCS C (for pic) in last few days and when I seen you wrote CCS here I was super confused (as I don't remember they make compiler for anything but pic :D and I never seen code composer being referred as CCS). I tried code composer few years ago and decided that I'm not paying that much money for eclipse gui and gcc compiler when I can get those for free. I will *never* understand why hw manufacturers try to reduce their user base trying to sell dev tools for too much money... I understand 3rd party tools, but darn, both microchip, TI, motorola ... they all try to charge arm and a leg for a darn compiler .. not that I can use TI code composer to write program for PIC or vice versa :( ...
That is awesome,.. After seeing ur's i decided to do one with a slight modification. But iv just started learning to program a mocrocontroller. Fortunately i have an MSP430 Launch Pad Kit and also avr too.
Im trying to figure out your code from the scratch. i know its hard if im new to it. though im trying to split them down and identify jigsaw piceses at first then lately to put them together. at certain points i feel completely new/landed on a different planet. will work deadly on it to understand it.
i need help on schematic level like, how u'v connected the shift register to the MSP & crystal oscillator to the MSP & the pdb level layout if possible,.. im sorry if i trouble you by asking silly and dumb questions, but as i mentoned earlier im new to this microcontroller programming and also to build a bord that has a microntroller on it (essential connections to be made like crystal oscillator, capicators, resistors to the device and vcc/GND all etc,.)
As i mentioned at the very begining that a slight modification that clicked my mind, here it goes - known to me a pizo electric senser is aslo a buzzer right ,.?! im not sure its correct but just a sugesstion. pizzo buzzer has a pizo crystal in it - when faces electric field their structure gets disturbed and inturn produces "buzz" - it should also has a reverse process then - prodece some signal when there is a vibration right,.?!? if then cant we make it as an input device as well as output and make them to display time while the clock is in sleep mode by producing some king of sound or noice or any thing,.. I have a very little knowledge about circuits. I dont know that this is correct,.. can u help me to figure out this,..
Hello, I am a student and have taken interest in your project. When I tried to use your code to test out my clock, it turned out that I couldn't use it because you did it in C++. I tried to figure out how to make a C++ project but had no luck. Can you please send me or post a list of instructions to get your code up and running (I am using CCS v5).
When it comes to our comfort zone, bedside tables are a must. Books, glasses, eye-drops, beautiful alarm clock ect.
Looks great Markus, I might have to build this just to find out what the tune is.
Not sure it would help but perhaps replacing the modulo arithmetic might help the code compile smaller.
Good idea, thanks. I tried it, and your suggested change saves about 8 Bytes at each occurrence. Spoiler ahead: If you look into the source code, there is a YouTube link to the tune used :)