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

Any chance we can get a version of this with a hidden beacon instead of the hidden strobe?

Is there a standard beacon? I’ve never used a light with one. How long on, off, how many flashes etc?

I’m not aware of any sort of standard beacon, but there are a few I find useful… one is what I call a heartbeat beacon, which flashes in the following pattern:

  • On 5ms
  • Off 245ms
  • On 5ms
  • Off 745ms
  • repeat

Another I find useful is a looping battery check mode, which flashes once for each 25% of the battery’s current charge, then pauses and re-checks and repeats. It’s more like 100ms on-time with 400ms between, and 2-3s between cycles. If left on for a long time, the number of flashes will decrease until the light eventually shuts off.

One more thing to consider is the brightness. A signal beacon should be pretty bright, but a “find the light indoors at night” type beacon should be dim. For the latter, one popular approach is a short (~3ms) flash at a moon or low level every 2s.

The one I use the most is a stutter beacon, used on a head light or tail light while biking or skating. It stays on all the time, but changes brightness to make itself more noticeable. The pattern I use there is:

  • High 5ms
  • Low 65ms
  • High 5ms
  • Low 65ms
  • High 5ms
  • Low 65ms
  • High 5ms
  • Low 65ms
  • Low 720ms
  • repeat

So, 4 brief high-brightness blinks and then it rests at low, and repeats at 1Hz. As for the levels to use, I’ve found that 40lm / 400lm works well, or 7lm / 150lm. There must be a pretty big difference between high and low.

This is what i was thinking.
Although would have to check the timings to see if they are suitable.

Do you want a hidden beacon instead of the strobe? Or a bunch of “strobe modes” including beacon modes, accessible after activating the strobe?

I was after a hidden beacon and no other flashier.

quick and dirty:

static void inline pwm_strobe()
{
while (1){
PWM_LVL = 255;
_delay_ms(20);
PWM_LVL = 0;
_delay_ms(90); // change the parameter 90 to up to 65535(ms you want the light to be off)
}
}

Ahhhh that’s great I’ll try that out after work! Thanks!

You would have to move the pwm configuration code up a bit as well, since you are using pwm here. You could just call strobe2(on, off) instead, with the values you want.

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?