alexvh's firmware. Update: Hidden strobe, Ramping and optional mode memory added.

Late to the party, but great find alexvh and DrJones! This would actually work the majority of the time for me as I usually set the OTC to around 500ms. I still have a roll of probably 100 capacitors, so I'll just stick with the "traditional" method, but this is a sweet solution.

Thought I’d update this thread with some info… This brownout method for short presses works a little differently with some of the low voltage MCUs and the “standard” 10uF input capacitor. It takes a lot longer for the memory to decay. Seeing this on the 84V and 85V.

It can be useful for retaining data during long presses with off time cap, but a little annoying when function testing firmware.

tested on ak47a and now this is my favorite firmware. Love the hidden strobe. Can you add a battery voltage indicator ? and maybe a step down when voltage low :bigsmile:

I registered here to thank you for this awesome firmware.

Again confirmed working on AK47A .

A minor code correction, strobe2(uint8_t on, uint8_t off) should use uint16_t or else the compiler gives a warning.

I like this beacon timing: strobe2(10, 1000)

:smiley:

The 16-bit int is only necessary if you want to “strobe” slower than 4 Hz (meaning one of the parameters is larger than 255).

I added these features, available here mk2_FW_mod-20150608

Includes:

  • low-voltage monitor; 4 sec low light warning and shutdown at 2.9V
  • battery check mode
  • 7 modes + hidden strobe: moon, low, med, max, batt, beacon (10/1000ms), ramp

I made a few FW versions for different applications:

1A driver for bike light

6 modes + hidden strobe: 2Hz-flasher, moon, low, med, max, batt

moon 7mA
low 50mA
med 240mA
max 1A

1A driver for EDC light

7 modes + 3 hidden strobes: moon, low, med, max, batt, 1s-beacon, ramp

moon 7mA
low 50mA
med 240mA
max 1A

3A driver for EDC light

8 modes + 3 hidden strobes: moon, low, med, high, max, batt, 1s-beacon, ramp

moon 5mA
low 40mA
med 200mA
high 600mA
max 3A

All FW versions feature:

  • off-time functions without hardware modification
  • low-voltage monitor; 4 sec low light warning and shutdown at 2.9V
  • battery check mode
  • memory is disabled because it is less relevant in off-time operation

Available here mk2_FW_mod-20150610

Thanks again to Alex and others for their source code.

ps
If you can’t flash high-amp drivers check howto: flash ATtiny with AVRDude and command prompt

I coded a hardware interrupt-driven “survival” beacon with 5ms of full power and 2000ms off-phase with current drain of less than 200uA which allows the beacon to run approximately 3 weeks on a fully charged 18650. It is possible to reduce off-phase current drain to less than 10uA if the R1/R2 resistors are increased. Has anyone tried higher values eg. 220k/47k? What’s the input resistance of PB2 itself?

From Table 18-8 on page 121 of the datasheet, analog input resistance is 100M. Giving less than 0.01uA, nothing to worry about.

Thank you, then I will use 220k and 1M and update ADC levels for the “battcheck” function.

What would be a simple way to add a turbo timer or high mode step down?