I put Andúril 2.0 on a Convoy M3

Hey guys,

I just finished putting Andúril 2.0 on a Convoy M3 and wanted to share the process with you (even if not greatly detailed, if you have any questions feel free to ask).

But first, here's a video:

Andúril really lifts this ~$30 light to a whole new level!

The boost driver in it looks like this:

I did some reverse engineering on the driver and all I had at hand was an ATtiny85, so I went with that. Without going into great detail, the drawback of this decision was, that the ATtiny85 only supports 8 bit PWM in hardware, which means 256 brightness levels. Sounds like enough, but really isn't, because we humans don't perceive light linearly but kinda logarithmic, which means especially in the lowest brightness settings there will be large, distinguishable steps in the otherwise beautiful smooth ramp. No good. Other flashlights like the Noctigon K1 solve this by simply using a larger MCU (ATtiny 1634, which also conveniently has enough pins for RGB aux LEDs!) which has a 16 bit timer/counter on board.

But I wanted to stick with the ATtiny85. So with a little food for thought from ToyKeeper herself, I got to work on modifying Andúril in a way to "fake" 10 bit PWM on an 8 bit capable MCU. Basically jumping back and forth between adjacent PWM values allows us to e.g. add two more bits of resolution by going through four "iterations" and jumping to the next higher PWM value between zero (0b00) and three (0b11) times out of the four iterations.So, for example if we wanted a brightness step right between value 130 and 131, we'd set the PWM value to 130 for two PWM cycles, then to 131 for two cycles, rinse, repeat. This is relatively easy to do with an interrupt that gets triggered every PWM cycle.

I actually put together a quick'n'dirty prototype with a button and LED to test my code on:

Unfortunately, the pinout of the ATtiny85 didn't match the existing MCU so I had to become a bit creative on the hardware side, bending the poor ATtiny's pins either down or up depending on whether the function of the pin matched the existing pad or not. For the those pins bent upwards I used enameled copper wire, which I also used to temporarily attach a pin header in order to flash the MCU (I also added longer wires to the LED and an external switch for convenience):

Apart from some flavor tweaks I did in Andúril, I mostly had to make sure to invert one of the enable outputs since it was going to a p-channel MOSFET, which is "active low" and calculate calibration values for the battery voltage readout (also had to change a resistor in the voltage divider used for this).

The boost driver also is slow, it wasn't able to switch fast enough for the party strobe to be effective (didn't turn on at all with reasonable on-times). I suppose I could've changed something about that if I tried hard enough, but it wasn't really worth it, so I just threw party strobe out of the rotation.

The remaining tactical strobe works fine up to a certain frequency. I'm quite annoyed I didn't catch this before re-assembling the light, but the output basically just vanishes if the strobe frequency is too high. If I ever decide to re-flash this MCU I'll make sure to limit the strobing frequency to reasonable values, too.

I hope this was somewhat interesting for at least one or two people on here, who disliked the simple UI of the M3 (especially the lack of soft-lockout and voltage readout) just as much as I did.

Take care!

Simon

3 Thanks

Wow. This is awesome thanks for the vid.

I hope to get to this level of modding one day. Great job!

Nice mod Streamtronics! That’s a lot of tiny wires soldered to the driver - impressive.

Wow! Looks like historical event! You made first Anduril boost driver ! :+1:
This mod can become very popular if you share more details.

Wow very cool mod! The M3 is a great light and having anduril running on it makes it even greater!

The light reports relatively high temperatures now even if only lukewarm on the outside, probably due to the boost IC heating up the driver quite a bit. Not quite sure how to improve that. There was a sad looking thermal pad just stuck to the boost chip, but not contacting the flashlight body due to the LED and switch wires above the driver, and also too small size. And even if it did contact the body, it's so thick it might not make a huge difference. But the chip has overtemperature protection so it'll shut off if it's getting too hot anyway instead of just dying.

Well I mean it definitely isn't the first Andúril boost driver, the Noctigon K1 with XHP35 HI has one, too - and I'm sure there's a bunch more. The principle is almost the same for Noctigon's constant current drivers, too. Those only use a single 10 bit PWM channel as well (or they might add a second direct drive channel, not sure if that's just the same channel). Basically I made a frankenstein out of the Andúril hardware definition file of the K1 12V (due to how it only uses a single 10 bit PWM channel) and the FW3A (due to that one using an ATtiny85).

You're right, I probably should share more information, but it's very tedious to e.g. draw a proper circuit diagram of the driver. But if anyone reads this thread maybe even in a year or something and is interested in also modding the M3, don't hesitate to ask ^^ Now that I know how to do it I probably wouldn't mind doing that mod for someone else either.

Although, I've heard there will be a new M3 version soon anyway, with improved UI and USB charging... let's hope it at least gets a lockout and a way to decrease brightness without having to veeery slooowly cycle through the highest modes like the original firmware does.

Hello Friend
can you share the firmware for the convoy m3?

Ow man, I was reading it like the lecture of (RIP) Steven Hawking about black holes.
Every third word was understandable to me. Huge respect for your knowledge and skills.

I can share the hex file and pinout for the MCU later this week if that's what you want. However you'll still have to get the ATtiny85 on there in the first place (pinouts don't match, it's a PIC-style pinout) and also modify the voltage divider for the battery voltage indicator to work right. I'm not sure how to share the source code and if it'll be compatible with future updates and how to merge with future code etc...

An ATtiny412 would be perfect for this but frankly I had no idea they existed. Somehow I assumed I'd need to use a PIC to get this pinout. Now I'm kinda annoyed I didn't just order some of those ATtiny412 and did "the right thing" of porting Andúril to it. The 412 also has 16 bit PWM natively btw.

Thanks, but it's nowhere near that complicated ^^ Once you actually know how the firmware works and how the microcontroller is structured, it's just a little tweaking. Kinda like adding some spice to a frozen dinner. But then calling ToyKeeper's work a frozen dinner would be quite the insult. So let's say I added chocolate chips to some already perfectly balanced and well thought-out cake.

1 Thank

good friends afternoon can you share the full firmware? I will not be able to finish it somehow. my friend can only flash

can you give me that firmware, please! toiladt7654321@gmail.com
Thanks so much

Planning on doing this mod on the M3-C, I assume it will be using the same driver and MCU?

Also is the pinout the same for the ATtiny412?

M3-C probably has a different driver altogether or at least one that’s modified and upgraded since it now has USB-C charging. But if I had to make a guess I’d say it’s the same MCU. I’m not sure about the exact pinout anymore but the t412 might actually go on without any special re-wiring lol. Not sure about the voltage divider, but with adjustments to the firmware to use a different voltage reference maybe even that isn’t needed. Always depends, basically you’ll have to do a little reverse engineering to figure it out on the new driver.

Do you still have the pinout of the original M3 driver MCU, and if so would I be able to have it?

Ok, I have found a photo of some notes I took back then, I’ll try to decipher them xD

Pin 1: Vdd (coming from a regulator, probably 2.8V or something)
Pin 2: Enable LED (P-FET, therefore active low)
Pin 3: Switch (towards GND, has external pull-up)
Pin 4: PWM out (I think stock was quite low frequency, just a few kHz)
Pin 5: Enable boost & op-amp (active high)
Pin 6: NC (I think)
Pin 7: Voltage divider, mine had 910k to battery positive, 390k to GND
Pin 8: GND

Ok so had a closer look at the M3-C driver PCB and turns out that it is indeed a different driver.

New MCU in a much smaller package (I think QFN20) which will be difficult to run bodge wires or probe for reverse engineering.