Friday, 19 September 2014

Simple battery powered, LCD clock / calendar

In a similar style to the battery powered LCD clocks I made a while ago, I have been asked to make some LCD calendars.
The desk clock used an 8x2 LCD, but I went for something different for this, the display from an Nokia 5110 phone. These are 84x48 graphical LCDs using the Philips PCD8544 controller. These is a simple interface, but it runs at 3,3V. I followed the guides on the Adafruit site to use a 4050 as a level converter and drive this from an Arduino Uno.
The plan for this is to run from 2x AA batteries, so the 4050 will not be required, and the LCD can be connected directly. As usual with these things you can't have everything, so it's 'cheap, lower power, accurate - pick two. In this case, it's cheap and low powered, so I'm running the ATmega328P with it's internal 8MHz RC oscillator, divided down to 1MHz, As with the previous clock, I'm using a 32768Hz watch crystal on a timer interrupt to count seconds.
The crystal is hidden under the chip socket, and that's all that's required for the final unit, one display, the watch crystal, 4 buttons and one 100nF decoupling capacitor on the back. The switches and display lines are wired to the nearest pin on the ATmega328P, as usual switched to ground and using the internal pullup resistors.
I've used a three pin connector for power, the centre pin is the blue backlight which isn't currently used, but could be wired up if required, obviously reducing battery life
Normally it just shows the date, but the yellow button switches into date / time mode so the time can be set. The other buttons increments day/month/year or hours/minutes/seconds, depending on mode.
I also build a portrait version, to be used on a different project.
So far testing has shown this may be out by a few seconds a day. That's not ideal for a clock, but this is to be paired with an analogue clock movement, so will mainly be used to show the date. In which case, it should be fine as long as it changes date around midnight and not at three o'clock in the afternoon.
Since there is no battery backed real time clock, it will not remember the time. I've added a function to write to the EEPROM when it changes at midnight. This is checked on power on, so the date will be correct and just the time will need to be set when the batteries are changed. The EEPROM has a limited life of 100,000 writes, so storing the time would wear it out too soon.