Clem quite often used very powerful microcontrollers in his projects, maybe even too powerful for the job. This time, he is getting himself into shallow power waters by using an ATtiny412 to power his DIY wristwatch, or "dumb watch" as he likes to call it. Contrary to popular smartwatches, the dumb watch only displays the time, nothing more and nothing less.
Watch the Video
It does this in a unique way by shining a number of LEDs through an otherwise opaque watch face. The LEDs act like the hands of an analogue clock, but instead of pointing at numbers, the LEDs light up the hours and minutes. The lit-up LEDs form distinct shapes that are recognisable at a glance. Once the wearer gets used to the shapes, counting the LEDs is quickly replaced by just recognising the shapes to tell the time.
The ATtiny412 came with the convenience of an internal 20 MHz clock but also many restrictions. Only 8 pins on the SOIC package limit the number of available IO, and the 4KB Flash memory / 256B SRAM makes it clear that some corners need to be cut to squeeze all the needed routines into the little chip. Clem uses the I2C interface to connect the MCU to an MCP7940 real-time clock chip. This RTC will keep time even when powered off, thanks to a battery backup.
With limited IO, Clem once again has to get creative to address all 24 LEDs on the watch face individually. In previous episodes, we saw him utilise multiplexing and charlieplexing for such cases, but this time the complexity and number of available IO is not the only restriction. With multiplexing and charlieplexing, you basically trade IO pins for code complexity to address all elements of the matrix. The ATtiny412 does not have enough memory to do this while also interfacing with the RTC, so Clem's solution is to offload the task to shift registers.
The 74HC595 has been a very popular choice for decades for addressing IO, data buses, or driving a large number of LEDs. Three 74HC595 ganged up in series allow for a total of 24 LEDs to be driven, which is not coincidentally the exact number needed in Clem's project. Twelve LEDs show the hours, and twelve more show the nearest 5-minute increments, very similar to an analogue watch.
Mounting all the components within a reasonable timeframe was only possible thanks to Clem's new toy, a Pixelpump by Robins Tools, which was demonstrated during assembly. Picking up tiny 0603 LEDs and placing them in the right orientation is a nightmare with tweezers, but a breeze with the Pixelpump.
Clem's next challenge was getting the MCP7940 running with some code on the ATtiny412. If this was an ESP32 or Arduino project, Clem would certainly resort to a popular MCP7940 library built on top of the standard wire library (Arduino's I2C implementation), but the catch is again in the amount of available memory. Both libraries are just too big to fit on the tiny chip; the compilation always fails with a memory error. Clem combined a tutorial by Rheingold Heavy (linked below) and Technoblogy's TinyI2C implementation into a way to run a much smaller I2C implementation on the ATtiny and then address the RTC chip with the right commands. This was very tricky as the RTC I2C registers are a bit hard to understand for someone working with direct register addressing for the first time as opposed to using libraries.
A lot of trial and error, including a detour with the suspicion of broken RTC chips and crystals, led Clem to the frustrating realisation that he needed to do maths to set the registers correctly. Clem then found that one needs to binary add the configuration register settings and time setting with a logical OR function to get the right hex value, which can then be written to the chip. Cryptic yet logical and certainly confusing for beginners.
Once the device was working and displaying the correct time, Clem designed a 3D printable case in FreeCAD / Ondsel. The case is a 2-part friction-fit housing, 3D printed with MAYER MAKES Engineering Resin of Clem's own production to make it feel, look, and behave very similar to an injection-moulded part. After curing and sanding to a smooth finish, Clem used acrylic spray paint on the top to turn the watch face opaque black.
The sleek, monolithic watch face now shows absolutely nothing while the device is off. Once activated, the LEDs shine through the black surface and reveal the time in the form of bright, colourful shapes.
The idea is to only activate the watch when you actually want to know the time. The battery backup in the form of a rechargeable LIR2540 cell can keep the watch alive for a few days. In Clem's testing, the watch was able to keep time for at least 4 days, but on the 5th day, the battery was too drained to light up the LEDs anymore. A quick charge brought it back to life, with the time still accurate from its first setting a week prior.
In hindsight, a smaller unit might be a tiny bit more practical, but the already dense routing on a 4-layer board produced by Aisler was tough enough to get done in time. The ENIG-finished PCBs were a joy to solder and showed how important it is to have a reliable source for very dense designs with accurate solder masks.
Will Clem now get back to wearing watches regularly? According to him, probably not, but perhaps we’ll see him sporting this or another contraption at electronics events.
Bill of Materials
Product Name | Manufacturer | Quantity | Buy Kit |
---|---|---|---|
ATTINY412-SSN | MICROCHIP 8-Bit-MCU, AVR Family ATtiny412 Series Microcontrollers, AVR, 20 MHz, 4 KB, 8 Pin(s), SOIC | 1 | Buy Now |
MCP7940N-I/ST | MICROCHIP IC Echtzeituhr, Alarm, Jahr/Monat/Woche/Datum/Stunde/Minute/Sekunde 12h/24h, I2C, 1.8V-5.5V, TSSOP-8 | 1 | Buy Now |
74HC595PW-Q100,118 | NEXPERIA Schieberegister, Baureihe HC, High-Speed-CMOS, 74HC595, Seriell zu parallel, seriell zu seriell | 3 | Buy Now |
FT230XS-R | FTDI USB-Schnittstelle, USB/UART-Wandler, USB 2.0, 2.97 V, 5.5 V, SSOP, 16 Pin(s) | 1 | Buy Now |
MPJK-7L-32.768-7-20-70-C | MULTICOMP PRO Quarz, 32.768 kHz, SMD, 3.2mm x 1.5mm, 20 ppm, 7 pF, 20 ppm | 1 | Buy Now |
Other items and References | |||
PCB by Aisler.net | |||
Case 3d printed from MAYER MAKES Engineering Resin | |||
Spraypaint, Sandpaper | |||
Velcro Strap salvaged from cable tidy set. | |||
Top Comments