DIY Apple Clock
OK so there’s no such thing as the Apple Clock.
However, you can make your own retro-style bubble display clock in an Apple earbuds case.
I’m going to show you how to do that just sit tight.
You’re going to need some parts for this project.
- 1x PCB (not shown)
- 1x Apple earbuds case (not shown)
- 1x 74HC595 shift register
- 1x ATTiny44 or ATTiny84
- 1x 16MHz crystal oscillator
- 1x 1N4001 or 4007 power diode
- 1x USB B mini port
- 1x Li-Ion rechargeable battery
- 1x bubble display
- These two bags of nuts and bolts I bought at RadioShack and I don’t know what to call it but its in the pictures
- 2x pushbutton switches
- 3x 10 kohm resistors
- 4x 330 ohm resistors
You’ll of course need some tools like a soldering iron, home PCB manufacturing tools, saw or dremel, drill, screwdrivers, etc.
If you just want to build the project this step isn’t too necessary. I’m going to be talking about how the code and hardware work.
I’m going to go through the code line by line now 😀
The ATtiny24, 44, 84 series only has 1 external interrupt (INT0) [Page 48 of the datasheet]. This is the interrupt that we are most familiar with using on the Arduino. You can simply use this interrupt by saying “attachInterrupt()”
While it only had 1 interrupt, I wanted to have two buttons on my clock: one button to increase the time and another to decrease the time. Looking back on the datasheet, the ATtiny has two Pin Change Interrupt ports: PCINT0 and PCINT1 [Page 48].
The difference between External Interrupts and Pin Change Interrupts is that an External Interrupt has its own ISR (interrupt service routine). PCINTerrupts share one ISR for all pins on one port. This means that with Pin Change Interrupts we can make any pin be an interrupt, but then we have to go through the trouble of determining which pin caused the interrupt on the port.
Here are two really good articles to read. This is how I learned:
Each of these variables determines what number is displayed on each of the four digits on the bubble display.
I declared them volatile because they will be changed in the interrupt routines.
Setting them to 0 means when I turn on my clock, the count will start at 00:00 (12:00 AM).
Physical pins 8(A5), 9(A4), and 10(A3) will be used with the 74HC595 shift register.
The shift register will allow us to control segments a, b, c, d, e, f, g, and dp with pins Q0, Q1, Q2, Q3, Q4, Q5, Q6, and Q7 respectively.
To display each digit, we will be multiplexing.
For more detail: DIY Apple Clock