After reading Eric Schlosser's Command and Control: Nuclear Weapons, the Damascus Accident, and the Illusion of Safety a year ago and searching related topics, I found myself watching the video Rocket Sled Impact Test In Slow-Motion from Sandia National Labs. In the background of a couple of shots in this video, a large digital clock in the background caught my eye:
My initial "oh, that's cool" thought turned a few days later into buying a bunch of 1.8" 7-segment digits. When these arrived a month later in April 2018, I put together a frame in Fusion360 to mount them on the wall (sans any other plan, which is typical for me). The resulting 28 x 8cm design was far too big to print in one go, so I split it into 6 pieces joined with dovetails:
After printing in ABS, test fitting and bonding the joints using acetone, I gave the frame a quick sand and a paint job:
The initial results weren't ideal; the digits fit perfectly, but the dovetail joints were too obvious for my liking. I did another round of sanding and paint, then the frame and digits sat on my bench for a few months:
In July I had another go at sanding and painting the frame, this time using painters gap filler to fill in the gaps around the part joints. This worked much better:
With the frame looking more polished, I wired up the displays using a home-made wire-wrapping tool:
For the next while, this project lived on my desk driven by an STM8S and MAX7219 on a breadboard. Initially this only counted seconds (roughly) from the power on time, but later I calibrated the timing to have a semi-accurate clock that maintained the time given at compile+flash time. Code for this STM8 prototype is on Github for reference.
At this point I replaced the STM8 with an ATTiny13A and plugged in a NEO-6M GPS to read the actual time from. I'd worked out the Tiny could just support the number of I/O I needed, and some tinkering proved that the required C program could comfortably fit in the 1KB of available program space.
Working with the ATTiny13A for this was a bit of fun as it lacks hardware UART (for the GPS) and hardware SPI (for the MAX7219). Additionally, the NMEA sentences sent by the GPS are up to 79 bytes, which won't fit into the tiny's 64 bytes of SRAM.
The code has a routine to find RMC ("Recommended Minimum") sentences in the GPS's serial output and extract time and date information with only a 2 byte buffer for converting the numbers represented in ASCII to 8-bit integers.
After turning the clock off for a week, my girlfriend mentioned that it'd been useful to have a clock (even if it looked like "a bomb timer from a movie"), so I thought I'd finish it off.
I didn't like the look with a single piece of acrylic across the front, so I broke that filter into smaller pieces and recessed them:
In the final schematic, there's a bit of pin sharing:
- MISO for programming and the software UART RX use the same pin. These signals have to be isolated from each other as the programmer pulls the line high when connected, and the GPS transmissions step on the signals being sent during programming.
- The light dependent resistor for automatic brightness control shares a pin with a button as I needed a way to toggle daylight saving time without reprogramming. The button brings the line to GND, while the LDR can only bring it to the offset voltage (200mV)
I laid out the board with the intent to etch it myself from the start (hence the huge vias), but got carried away with the silkscreen anyway:
In reality there was no silkscreen:
..and I messed up the bottom copper exposure, so the bottom side of the PCB became one big ground plane instead and the top became very bodgy:
I'd normally get boards made at a fab, but I really only wanted one of these. It was just slightly too many connections to bother wiring all point-to-point, but it's all hidden in the final product:
At the time of writing the code still needs a bit more work to be feature complete, but the project is in a working state and in use:
- Time zone button isn't connected. I have until April to implement this or at least patch in a daylight saving start/end lookup for New Zealand.
- Automatic brightness is currently not implemented (done ). In the STM8 prototype I used a table setting the brightness for each hour which worked ok. A fixed brightness of 80% works fine during the day, but illuminates the room with a red glow at night once the lights are off.
Update (8 April 2019): Both of these features have now been implemented, so the project is complete!
The timezone is changed by holding down a button that pulls the photo-resistor to ground. When the ADC reads lower than a set threshold, the timezone is incremented every 0.5s until the button is released.