Sunday, February 6, 2011

Low Power LCD Clock

After my initial experiments with the MSP430 and a raw LCD screen, I've been looking for how to use these in a larger project.  The MSP430G2 chips I have lack anywhere near enough pins to drive the 28 segments of the display. Luckily, while browsing through the Dallas/Maxim site, I found the ICM7211 LCD drivers.  This driver chip handles all of the backplane-segment biasing needed for four seven-segment digits.
The obvious first project for a new display tech is another clock, of which I've already generated several.  Since the MSP430 chip is low power, and the LCD screen and driver are very low power, I realized that with some careful programming, I could get the total circuit power consumption low enough to be reasonably powered by only a standard CR2032 coin cell.


In addition to the four digits on the LCD, there is also several axillary segments such as decimal points and middle colon.  The ICM7211 driver chip has no provisions for these extra segments, so I had to build additional circuitry to invert the backplane signal to bias the colon segment.  To keep the power consumption of the invert low, I used a 2N7000 MOSFET and a very large (5MΩ) resistor.  If control of the segment is desired, a CMOS XOR gate can instead be used.  This would allow the signal to the segment to be selectively inverted from the backplane to darken it, or to follow the backplane voltage to keep the segment clear, by XORing together the AC backplane voltage, and a DC control signal.

The MSP430G2231 I used for the clock does not have enough pins to handle the 8 pin interface with the ICM7211 driver.  To solve this, I used the standard 74HC595 latching shift register to get 8 output pins from only three on the MSP430.  The LCD driver does come in a -M variant which only takes 6 pins, but I didn't happen to have ordered this part.  The driver also comes in either a hexadecimal or B-code variant.  I got a hexadecimal variant, which doesn't allow me to blank digits like the B-code does.

After soldering together the entire project on a piece of perf board, I was happy to see that my initial power calculations were not entirely off base, with a current consumption of roughly 12μA for the entire clock. Using a standard 200mAh coin cell, this implies more than a two and a half year battery life for the device, which isn't too shabby.
Parts list:
  • MSP430G2231 (DIP) (Digikey $2.17)
  • 74HC595 (Digikey $0.60)
  • ICM7211 (Not available in parallel hex code, B-code: Digikey $7.39)
  • Raw LCD (Halted $2.00) - I have not bought these myself, but possible replacements on Digikey: [1] [2] (Please let me know if you use these and they work.)
  • 2x Push button (Excess Solutions, $0.10)
  • 2N7000 (Digikey $0.40)
  • 5.1M resistor (Digikey $0.07)
  • 100k resistor (Digikey $0.07)
  • 32.768 kHz crystal (Digikey $0.30)
  • 100μF capacitor (Digikey $0.17)
  • CR2032 battery holder (Digikey $0.70)
  • CR2032 battery (Amazon 25 count @ $4.97)
  • 40DIP6 socket (Digikey $0.42)
  • 14DIP3 socket (Digikey $0.15)
  • 16DIP3 socket (Digikey $0.16)
Source code:


  1. You have done a very good job! I am impressed by the simplicity and the efficiency of your system.

  2. Very nice job!

    Here is a comment. For the soldering of your protoboard, I would recommend that you solder all the wire on the back, so it look way nicer when you look at it from the top.

    Like this

    or this

    It's only aesthetic reason. People will say " that guys a pro!"

    Keep up the great work!


  3. Very cool. How accurate is this clock?

  4. @Bill: It's as accurate as the 20ppm crystal used for the MSP430 allows; it runs about a minute slow per month.

  5. Is the power consumption an estimate or did you somehow manage to measure the power consumption?

  6. @Greg: I ran the clock through my HP3435 amp meter with a low pass filter on it, so it's a fairly decent estimated measurement. I wouldn't expect pure calculation to give any better result than that.

  7. Hi Kenneth, great job! One question though: are there any other chips that we could use other than the MSP430G2231 ?

  8. @Electric Jesus: The RAM usage is almost negligible (6 bytes), so really ANY MSP430 chip that has enough program space for the code will work.

  9. Great Job Kenneth.
    why not using Low Power Mode 3 (LPM3)

  10. Good point... I guess I had just worked myself into a corner; arbitrarily picked SMCLK for the timer, then couldn't disable it...

  11. Hello Kenneth, Thanks for sharing all that really interesting stuff.

    In addition to the previous question about LPM 3 and SMCLK, don't you think we could use ACLK timed with the crystal.
    The following line should work?
    TACTL = TASSEL_1 + MC_1 + TACLR;
    with the correction for crystal capacity
    // crystal Cload capacitor adjustment - only one line of next four should be uncommented
    // BCSCTL3 = LFXT1S_0 + XCAP_3; // 32768KHz crystal, 12.5 pF
    // BCSCTL3 = LFXT1S_0 + XCAP_2; // 32768KHz crystal, 10 pF
    BCSCTL3 = LFXT1S_0 + XCAP_1; // 32768KHz crystal, 6 pF
    // BCSCTL3 = LFXT1S_0 + XCAP_0; // 32768KHz crystal, 1 pF

    what do you think of that?

    Do you think running an external crystal (in LPM3) draws more current than the internal clock (in LPM1) ?



  12. I'm not using the internal clock, it's not accurate enough. So yes, using ACLK sourced from the crystal and going into LPM3 might save the DC generator power used while in LPM1. I say might because I never explicitly enable the internal oscillator, so I'm not entirely sure if the DC gen is even running.

  13. im doing this ..... ty if it will work and ty if it won't work x)

  14. Hi
    Gread project I have idea how to improve your clock you can add a solar cell.But solar cell will be pointless in night.I find this gadget
    Which is make electricity from radio wave.
    Electricity from the air Crystal Radio

  15. @Anon: It wouldn't take much more than a basic storage device like a super cap to let it make it through the night, but yeah, there's all kinds of possibilities here.

  16. Hey,

    This project is really cool. I tried and failed something very similar before i really knew what i was doing.. good times. I had a sort of crazy thought for a slight twist though.

    Have you ever seen those radio-luminescent tritium keychains for sale on the internet? They run from 10$ to 45$ or so.

    I'm sure you're thinking what i'm thinking - a cheap tritium solar-cell sandwich? While i honestly have my doubts, it would be really cool if you could draw enough current to power this. It would be neat just to see what can actually produce.

    You'd also be the first person to try it to my knowledge. So there's that. :P

  17. Sir,
    do you know any lcd driver chip who can drive lcd with 4 common (backplanes) pins

    1. Not that I know of. I haven't seen any discrete drivers, but many modern mcus have LCD drivers built in, and they likely can handle multiple back planes. I just haven't looked too closely at them; if I'm trying to drive anything more than 4 digits, I just buy prebuilt modules.

  18. Hello! I have Launchpad MSP430G2553 and G2452. Can it work with them?

    1. Sure. This should work with pretty much any MSP430. Once you move above the 14 pin models, you don't even need the shift register any more.

  19. I've made clock, using RTC PCF8583 and MSPG2553 (but i use 7 segment display). I think RTC will be more reliable solution, because RTC can't hang up, as controller can do.

    1. Perhaps. With careful oscillator and code design, the controller should be perfectly fine by itself if you don't need any of the extra hardware features of a dedicated RTC. Quandary: If the microcontroller hangs, how much good does still keeping time really do you?

  20. Replies
    1. I still don't understand what the watchdog would help with. 100 lines of code is pretty easy to debug to the point where it won't hang. What is the failure condition that you're trying to recover from?

    2. uC is more complicated device than RTC, and more EMI vulnerable. Under EMI influence program counter can jump to a random memory address, resulting unpredictable program behaivior. I saw this effect using stm32 uC, placed not so far from huge contactor. Moreover, my device randomly clicked by relays, which was drived by stm32... and it was awfull, because this device should drive some inustry equipment with moving parts.

  21. Very very nice job! Just wonder - where I can buy the same LCD from Europe?

    1. Haven't a clue. I got mine from a local salvage shop.

  22. Hi Kenneth, Great work.

    Suppose my MSP430x2xx has enough pin outs, would it be possible to run TN-LCD without the LCD-Driver?

    Also, the Bias for this particular LCD is 1/3, would that affect feasibility of using just MSP430?


    1. You can run LCD segments directly, but I haven't found a solution to the multiple back plane issue for fractional biasing.

    2. one thing i noticed is that you reply to your messages promptly, and you did not fail to deliver this time around. i'd give you Reddit gold if possible. Thank you very much!

      although,.. Re: multiple back plane issue for fractional biasing.

      what issue? are you saying that the MCU skips the bias and just run on 2-voltage level (high/low) ? why is this a bad thing?

      i've been reading datasheets , and i dont see why there is a need to have a fractional bias. would you be kind enough to elaborate what you know about this?

      Thank you very much in advance!

    3. If you're driving an LCD with a single back-plane, then you can use the digital output pins of MSP430s. I thought you were referring to more complicated LCDs, which require multiple different voltages. The MSP430 can only output zero or the positive supply voltage. If that's all you need, then you're fine.