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

111 posts / 0 new
Last post
pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 9 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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

Pastebin                                      &nbs

alexvh
Offline
Last seen: 1 year 9 months ago
Joined: 05/28/2013 - 23:40
Posts: 29
Location: Canada

pyro1son wrote:
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?

My firmware for nanjg attiny13 flashlight drivers: https://github.com/alexvanh/basic_off_time_driver

Discussion: http://budgetlightforum.com/node/36932

Off-time mode switching on stock drivers (no off time capacitor mod necessary) and ramping withou

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 32 min 40 sec ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

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.

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 9 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

ToyKeeper wrote:

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.

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

Pastebin                                      &nbs

alexvh
Offline
Last seen: 1 year 9 months ago
Joined: 05/28/2013 - 23:40
Posts: 29
Location: Canada

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

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

My firmware for nanjg attiny13 flashlight drivers: https://github.com/alexvanh/basic_off_time_driver

Discussion: http://budgetlightforum.com/node/36932

Off-time mode switching on stock drivers (no off time capacitor mod necessary) and ramping withou

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 9 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I was after a hidden beacon and no other flashier.

Pastebin                                      &nbs

odd
Offline
Last seen: 9 months 1 day ago
Joined: 02/12/2012 - 16:17
Posts: 29
pyro1son wrote:
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)
}
}

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 9 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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

Pastebin                                      &nbs

alexvh
Offline
Last seen: 1 year 9 months ago
Joined: 05/28/2013 - 23:40
Posts: 29
Location: Canada

odd wrote:

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)
}
}


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.

My firmware for nanjg attiny13 flashlight drivers: https://github.com/alexvanh/basic_off_time_driver

Discussion: http://budgetlightforum.com/node/36932

Off-time mode switching on stock drivers (no off time capacitor mod necessary) and ramping withou

JonnyC
JonnyC's picture
Offline
Last seen: 1 month 2 days ago
Joined: 01/14/2011 - 19:12
Posts: 1145
Location: Green Bay, WI - USA

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.

Mike C
Mike C's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 01/22/2014 - 08:03
Posts: 2009
Location: Sweden

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.

ERDOS
Offline
Last seen: 11 hours 10 min ago
Joined: 01/30/2015 - 16:46
Posts: 14
Location: Milky Way

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:

mk2
Offline
Last seen: 3 years 4 months ago
Joined: 06/07/2015 - 09:37
Posts: 13

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)

Big Smile
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 32 min 40 sec ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

mk2 wrote:
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)


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).
mk2
Offline
Last seen: 3 years 4 months ago
Joined: 06/07/2015 - 09:37
Posts: 13
ERDOS wrote:
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 added these features, available here http://www.mediafire.com/download/up56daf8jg6l6u4/mk2_FW_mod-20150608.zip

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
mk2
Offline
Last seen: 3 years 4 months ago
Joined: 06/07/2015 - 09:37
Posts: 13

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 http://www.mediafire.com/download/huqfta48×9hkmdd/mk2_FW_mod-20150610.zip

Thanks again to Alex and others for their source code.

ps
If you can’t flash high-amp drivers check http://budgetlightforum.com/node/29684?page=3#comment-771123

mk2
Offline
Last seen: 3 years 4 months ago
Joined: 06/07/2015 - 09:37
Posts: 13

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?

alexvh
Offline
Last seen: 1 year 9 months ago
Joined: 05/28/2013 - 23:40
Posts: 29
Location: Canada
mk2 wrote:
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.

My firmware for nanjg attiny13 flashlight drivers: https://github.com/alexvanh/basic_off_time_driver

Discussion: http://budgetlightforum.com/node/36932

Off-time mode switching on stock drivers (no off time capacitor mod necessary) and ramping withou

mk2
Offline
Last seen: 3 years 4 months ago
Joined: 06/07/2015 - 09:37
Posts: 13
alexvh wrote:
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.

aw73
Offline
Last seen: 2 years 9 months ago
Joined: 08/01/2014 - 15:01
Posts: 84
Location: Magnolia State

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

Pages