Guide: how to flash ATtiny13a based drivers (NANJG, QLITE, etc.) with custom firmware

Haven’t read any of the posts in this thread, just the OP, will catch up while I’m waiting for hardware to arrive.
I’ve avoided getting into this aspect of the hobby, told myself it would be too expensive or beyond my abilities.
It’s impossible to stay away any longer, I have too many lights that would be useful and fantastic were it not for their UI.
Yes, this is a total 1st world problem, but from what I’ve seen not only is it not expensive but smarter people have collected and posted links to tutorials and hardware that take all of the guesswork out of it.
Thanks to Hoop and all who’ve contributed!

Re-checked the wiring again. Applied the contact cleaner. It probably lubricates the contacts as now the clip slips off the chip.
Tried holding it against the chip, got the same error.

Can anyone please check my wiring please?…I’d like to make sure this is not the problem…


It doesn’t work for me either and I’ve concluded that it probably is the clip that sucks and doesn’t make contact. It looks very similar to yours. I tried to measure continuity from the lead to the MCU leg and I get nothing, though lead to clip contact surface is fine.

Not so keen on coughing up money for another clip. Still thinking about how to proceed…

It’s hard to see in those photos, but the white and grey wire on your clip look very close together. Are you sure they are not shorted?

Yeah, I hate clips. I don’t use them anymore.

The Pomona clip in Hoops guide seems to work the best for me. Its not perfect but is better than the other clip I tried.

Yes, I’m sure they are not shorted. Some distances between wires are smaller than I’d like, but not short enough to make me re-solder them. :wink:
The photo angle doesn’t do them justice. The closest distance is black-white really.

Well, to be honest your photos are crap in terms of checking wiring connections. You are using a flat ribbon cable between clip wires and USBASP. Who knows how you have connected things on the USBASP side, it’s not possible to verify your wiring connections with those photos. Get rid of that flat ribbon cable and connect wires directly into the USBASP like the photo below, then checking that the wiring is correct will be much easier:

If you are using that flat cable because you don’t have female connectors on the wires, then get something like this from somewhere: https://www.fasttech.com/p/1011800

The clip is fine. It works perfectly for what you want to achieve. To make it work, your cables must be good and the wiring connections are correct as clearly illustrated and explained in this thread.

Bad wires/wrong wiring or a defective USBASP programmer is normally the culprit.

Oh yeah, I forgot… Have you checked that jumper on the USBASP? It’s JP1 on my photo above. Mine has to be on 5V to work. If you’re sure the wiring is correct, try shifting the jumper.

Also try both possible voltages of the USBASP.

Sorry, actually I’ve seen they are not good, but only after downloading it. Which takes me 2 days (don’t ask). Decided to post anyway…
2 wires are at USBASP bottom, 4 at the top.

I’d rather keep using ribbon as the extra length makes it easier for me.

I tried filing the clip slightly to make it sit lower. It didn’t help.

I had the jumper set to 5V. Now I tried 3.3V, didn’t help.

I looked a TME to see what clips I could get from them (reasonable shipping costs, unlike DigiKey / Mouser).
They only have one in the store. And it looks just like mine…(just with wires factory-bent)

After reading this post I am considering doing the work necessary to reflash my Emisar D4 (hoping to receive in in the next week or so). Does the OP explain how to reflash the D4 properly?

Does the D4 use this chip, and if so is the chip relatively easy to get at? I am not interested in heating to break thread locker or things like that.

I am an EE by schooling and have done more than my share of soldering and assembly of electrical parts, but have next to no experience with programming or firmware. I have no hesitation regarding wiring up the electronics, but I have some hesitation in installing the SW on my windows machine and actually getting any commands that need to be typed executed.

Easy peasy or will I get frustrated? Is reading all the reference material required?

The D4 driver uses Attiny85 and as an electrical engineer (EE?) you should be able to do the flashing part. But be warned that it is NOT easy to get to the mcu. The driver cavity of this light is very narrow, and the wires used to connect driver and LED board are pretty short. You have first to open the head (should be no glue there) and unsolder the wires from the LED board. The driver board is glued in, so you probably have to press the driver board out with some hard stick through the hole for the LED wires. Be careful to press the board and NOT any electronic components on this board!
Then you can pull the driver carefully a bit - but beware, there are still 2 wires connected to the switch. These are ripped off the switch board easily and it’s a hard job to resolder them. I would unsolder this wires at the driver side and take the driver out of the light completely.

Then you could easily build a simple test circuit in order to check if flashing - and the firmware itself - work out. For sure you don’t want to disassemble and reassemble this light more than once!

Here’s a photo of a D1 with the driver removed to illustrate what Flashy Mike is saying about the switch’s two white wires. The D4 looks about the same.

I’ve reflashed three D4s, a D1, and a D1S without damaging anything or desoldering the white wires.

I desolder and remove the LED board as Flashy Mike describes, then place the D4 with the driver facing the table. This hopefully prevents the driver from being pushed out too far and yanking on the switch’s wires.

Look through the hole and find a blank spot on the driver board to push against. I use a shortened bamboo skewer and tap it with increasingly heavier taps to push the driver loose. Once the driver starts to move, you can pull gently on the spring and wiggle it out.

Three out of five of the Emisar drivers I’ve removed popped right out. Two were more stubborn due to a tight fit and/or excess adhesive.

Be gentle while manipulating the driver to position your SOIC clip for reflashing, and be careful not to pinch the white switch wires while reinstalling the driver.

Good luck!

Agro, have you made any progress?

I have a cheap clip that sometimes needs several attempts to seat it properly, but I’ve used it successfully dozens of times.

I pinch the clip open, place it over the chip with the ends touching the driver board, and slowly close it. The clip moves away from the driver board slightly as the pins attempt to engage with the chip.

I run a command to test the connection before attempting to push firmware.

Yes, EE = electrical engineer. I have recently been interested in the magic of firmware, so maybe this is a good opportunity to get my feet wet. Once I get my D4 I will see how it looks for my 55 year old eyes and hands to work on. I do have access to good tools and microscopes at work, which should be a big help.

Thanks for the tips and encouragement both of you!!

No progress, need more motivation.
I bought another clip, but didn’t solder wires to it yet….

It may also be worth filing down the edges of the driver a little, to make it easier to put back in. Sometimes the glue sticks out and makes it difficult to put back in as deep as where it originally was. I usually do this with a cheap diamond file, gently going around the edges, but not enough to remove a significant amount of material.

Also, once the glue is broken, it’s a good idea to keep the body tube tightened and only unscrew the tailcap. The body tube is effectively a giant retaining ring for the driver.

Well, I made the plunge in buying the parts to flash my D4. Maybe next weekend I will be able to give it a shot. Decided to buy a small board with a ATTiny85 on it to practice and get the setup right before I disassembly my D4. I would hate to get into this and have a multi day delay for some reason and have to leave the light laying around in pieces.