by QC
Posted on Tue, August 24, 2021 - 06:41:01 AM
ATTiny PCB cycling Arduino Eagle
If you're interested in this project, take a look at the github or the Tindie page to buy one, or just write a message or leave a comment.
The original light on the left, the new one on the right.
Schematics for v0.2.
The hardware assembly was mostly done by jlcpcb (unfortunately not a sponsor). I only had to do the battery and USB connector. The connector itself is a 90° micro USB which snugs in perfectly next to the battery and rubber protector. A great amount of measuring wnet into the correct positioning of the 6 red LEDs bedind the plastic reflector. This worked out surplrisingly well as the can be individually seen in the top photo.
Backside of the light while charging
PCBs to make more lights.
Charging indicators for the LiPo cell.
Programming an ATTiny10 was more challenging than expected. Although it is an Atmel microcontroller out of the AT* family it behaves quite differently than the ATTiny 84 or 85 for example. It does not feature a real ICSP programming input and can therefore not just be programmed with the Arduino IDE and a library. The programming protocol is called TPI (Tiny Programming Interface) and luckily technoblogy already worked that one out, big thanks to them! It only took me almost a week to find their solution and order the recommended "USBasp" programmer, so use this information wisely. After that is is quite straight forward, a lot of low level register magic combined with the incredibly low power deep sleep of the tiny. There are 4 different modes which are cycled through by pressing the button:
Screenshow of the code: source .
The most important question was the possible runtime of the setup. The battery used is a 3.6V 120mAh LiPo which drives the 6 LEDs at ~10mA each, the ATTiny draws 0.2mA while running. This means that in mode 1 it can do roughly 2h on a single charge. In mode 4, this runtime goes up to 65h, since it is only pulsing the LEDs.
Standby time can be calculated with the deep sleep current of the ATTiny of <0.1µA. This would result in 1.5 million hours standy time.. More realistically the rest of the circuit uses more current and limits this time. It still is an impressive number and will definitely be the clickbait in case I make a video about this.