September 7, 2019

New firmware for one of my Convoy S2+ flashlights

The first thing is to take the flashlight apart and gain access to the Atmel ATTiny13A microcontroller inside where the firmware lives.

Taking the flashlight apart is easy up to a point. You unscrew the head from the tube first. This is trivial and is what you might do to replace a battery (though most people do this through the back end of the flashlight). The next part is more tricky. If you look into the head, you see the spring for the battery mounted on a circuit board. A brass piece has two slots on the outside margin. What I have been able to do is to take a plain screwdrive and unscrew the brass "pill" with a bit of care. If the flashlight has really been assembled tightly you may need a spanner wrench, but I never have.

Now things get tricky. You have the brass pill in your hand and you need to remove the circuit board which is soldered in place. You can try unsoldering it. I gave up on this because the brass pill itself is an extremely efficient heat sink and you would have to get the entire thing so hot I cannot imagine things would not be damaged. I used a dremel tool with a small steel burr to grind away the solder. Working under a microscope I then used a needle to pick away a bit of remaining solder. This was fast and easy.

At this point you might want to unsolder the two wires (making sure you know where to solder them back on again. I was able to unscrew and then pop out my circuit board without desoldering the wires and voila!

My light had four 7135 current regulators on "top" of the board. Four more were visible once I got the board loose, along with the Atmel Tiny13A microcontroller.

I had purchased a test clip for the surface mount 8 pin Tin13A microcontroller, and it attaches like a charm!

Now let's burn firmware

So, I have the clip and I have a hex file, but what do I use between my linux computer and the ATTiny13A. There are many choices. You can read about many dead ends below when I tried to avoid spending the $5 for one of these.

By far, the best choice for programing AVR controllers is one of the USBasp devices you can buy for $12 or less from Ebay, AliExpress, or even Amazon. After wasting over a day trying other alternatives I have ordered several. You can get them for $2.50 on AliExpress, but you will have to wait a few weeks. I found a domestic Ebay seller and ordered two for $10 with shipping included, so these will cost me $5 each. You can even get them from Amazon for $6:

Why didn't I check Amazon first? With Prime shipping I would have it right now!

Things that don't work

I tried some other things, which didn't work, as follows. It is almost comical how terrible the state of things is.

ArduinoISP (did not work!) You can download the Arduino GUI, and if you have an Arduino laying around, burn the ArduinoISP sketch into it and allegedly it becomes an ISP programmer for AVR devies. This never worked. Burning the sketch is easy, but I could never get AVRdude to work with it using recommended procedures. Perhaps AVRdude in its present version has screwed up support for this. It certainly seems so. A research project to sort this out.

Bus Pirate (did not work!) I had a Bus Pirate laying around for such a day as this! Or so I thought. This also never worked. This is highly dependent on versions of AVRdude and the Bus Pirate firmware. I have newer versions of both of these, for which no compatibility is even discussed. It certainly does not work. Another dead end, unless you are looking for another project to make this work.

FASTUSBasp (did not try) The idea here is to use one of the $2 ARM STM32 "blue pill" boards as an AVR programmer. I have a box of those boards and like them a lot. I don't care how fast it programs the device, if it only will just work!

I like this idea a lot, but I am burned out after the dead ends above. I'll just wait for the mail to bring the USBasp I ordered.
Feedback? Questions? Drop me a line!

Tom's Light Info / tom@mmto.org