ATtiny85 Analogue Clock using the Sharp 96 x 96 LCD Memory Display.
You can't address individual pixels of the display; according to the description on the Adafruit site "the entire 96x96 bits (1,152 bytes) must be buffered by the microcontroller driver" which appears to rule out its use with an ATtiny chip, most of which have a maximum of 512 bytes of RAM . This sounded like a challenge, so I set out to drive my clock using the diminuitive 8-pin ATtiny85. You could alternatively drive it from just about any other ATtiny chip, or an Arduino board.
Adafruit make a really nicely designed breakout board for the display  which solves the problem of connecting to the display, and provides logic-level conversion from 5V to the display's 3V, but it's double the price of the display (the bare displays cost about £12/$20 from Mouser). I found a much cheaper alternative: the LCD BoosterPack in TI's MSP430 Launchpad series, which is £16 in the UK  or $20 in the USA , and that's what I used for this project.
I interfaced the display to an ATtiny85, using three of the five I/O pins to control the display via the SPI interface. To provide accurate time I generated the clock from an external 8MHz crystal, which used the two remaining I/O pins.
Unlike the Adafruit board, the MSP430 Launchpad board doesn't provide logic-level conversion (as the MSP430 is a 3V device), so I added an LE33CZ 3.3V regulator and a 74HC4050 Hex Non-Inverting Buffer. If you are powering the clock from a 3V battery you could omit these.
The push-button allows you to set the time. It is connected to the Reset pin defined as an analogue input, using the technique described in my earlier post: Getting Extra Pins on ATtiny.
I built the circuit on a piece of Veroboard, designed to plug onto the connectors on the back of the LCD BoosterPack. It's powered by a rechargeable Lipo cell.
Each pixel on the display has a 1-bit memory, so the display retains what you've written to it. You update the display via an SPI interface, and commands are available to write a single line, update multiple lines, clear the whole display, or enter a power-saving mode . To create the analogue clock face I wrote a routine that takes the current time, and draws the clock outline and hands using line-drawing commands.
I first experimented with using a memory buffer for only one line, which needs 96 bits or just 12 bytes. The point plotting routine wrote into the buffer only if it's plotting the current line. I then drew the entire clock face 96 times, once for each buffer line. Although this sounds wasteful, there's no need to update the clock more than once a second, so the only constraint is whether I can draw the clock face and output the line to the display 96 times within one second.
Using this approach I found that with an 8MHz crystal clock it took over 3 seconds to refresh the display, so I needed to speed things up by at least a factor of three.
The solution was to provide a 16-line buffer, requiring a total of 192 bytes which is still well within the 512 bytes of the ATtiny85. The clock is drawn six times, once for each 16-line slice of the display. This reduced the time to update the entire display to 750ms, giving us 250ms spare to play with.
where d is 1 degree in radians. The values of x and y are calculated using fixed-point arithmetic by storing them multiplied by a factor of 2^9.
Whether or not you're writing data to the display, you also need to refresh the display by toggling a signal called COM at a rate of between 1 and 60Hz; there's a good explanation of this on Richard Leszczynski's MakerDyne site . You can either do this by providing an external signal, called EXTCOMIN, or in software by toggling bit 1 in the command byte at the start of the display data. In the above routine I used the software approach, using the bottom bit of the number of the second to refresh the display at 1Hz.
Holding the push-button down initially increases the speed of the clock by a factor of 60, and this increases every second.
This adds an ATtiny85 @ 8MHz (external crystal; BOD disabled) option to the Board submenu. Select this, and choose Burn Bootloader to set the fuses appropriately using the Tiny AVR Programmer Board; see ATtiny-Based Beginner's Kit. Then upload the program to the ATtiny85.
You can get the full listing here: Analogue Clock Program.
For greater accuracy you could use an RTC module, such as the SparkFun DeadOn RTC DS3234 Breakout , available in the UK from Proto-PIC . Alternatively you could drive it from a radio time code module as in my earlier application: Radio Time Code Clock. In either case this would allow you to use the ATtiny85's internal 8MHz clock, freeing up two I/O pins.
It would also be possible to display other information on the clock face, such as the date or temperature.
^ SHARP Memory Display Breakout on Adafruit.
^ Atmel AVR ATtiny comparison chart on Wikipedia.
^ LCD BoosterPack on Farnell.
^ LCD BoosterPack on Newark.
^ Sharp LS013B4DN04 Datasheet on Adafruit (PDF).
^ Small Memory LCD Breakout Board Details on MakerDyne.
^ DeadOn RTC - DS3234 Breakout on SparkFun.
^ DeadOn RTC - DS3234 Breakout on Proto-PIC.