Building a better bike tail light

I dig runtime too. If my numbers are anywhere close to correct, I think I should get 30+ hours of tail lighting on a 550mAh 16340 battery. That’s using what is probably the brightest flasher mode I can without bothering people.

I’ll have to get actual measurements when the firmware is closer to finalized.

That would be some trick.

I cannot even get close to that with 3400mah 18650 at only 1.05A.
I was only getting 6 hrs in default strobe mode at 1.05A on XTAR 2600mah cells.
It’s been a while since I did the runtime tests, but the increase in cell capacity has helped.

If you are running the light at 700ma that equates to about 2.52 watt/hr; 0.7A x 3.6V*).
The cell capacity is 2.0 watt/hr for the 16340 cell (0.55A x 3.6V*) so that means you can only use a 6.7% duty cycle to achieve 30 hours.
A 6.7% duty cycle means you have about 4 minutes (240 seconds) of on-time per hour (ref: 60 min x 60 sec = 3600 sec/hr *.067 = 240 sec)

  • I am using 3.6V as the average available voltage before driver fold-back warning.

Out of curiosity, is this line of thinking following your calculations?

So, if it’s running at 3.5 lm and flashing up to 19.6 lm once per second (5 brief flashes, very short), it’s running at 2.0% to 11.3% of its maximum power. It spends about 95% of its time on the lower level though, so the overall power draw is about 2.49%. Apply that to 700mA and I get 17.4 mA average. With a 550mAh cell, that gives me 31.5 hours of power.

3.5 lm is a bit high compared to most bike tail lights, and IIRC someone said 20lm is obnoxiously bright. So, those two seem like good level choices if it only pulses briefly at the “obnoxiously bright” level.

For now I’ve only got guesses instead of actual tailcap measurements… But I suspect the guesses are at least within a factor of 2, which satisfies my intent to give it a minimum runtime of 15 hours on a useful level.

Understood. I can’t quite follow the math but the limited output makes this more logical.

My goal is daytime output where you compete with sunlight and dropping into the shadows.

Annoying is very much related to LUX rather than lumens. Superflash lights for instance are seriously annoying but only when you are in just the right spot. Change the angle by a few degrees and these little monsters disappear in daylight. Given that they are white light, you get the full force of an aligned TIR from a 2 watt flash. Point is simply how you are planning to lens the light.

I have done the 1x 7135 constant on and add 2x 7135 strobe. In daytime, this nearly made the flash disappear. But at night, it made the light much more tolerable. One of my favorite P60 does this for a night time helmet light.

I am looking forward to seeing exactly what your signal looks like. I think I get it but I am not sure. I guess I got lost where you are applying the 700ma other than calculating the duty cycle (2% and 11.3%).

Nightspy- since you called me out I went ahead and set up a more precise little test. The other times I tested at 120mA it was by ramping one of my built lights down to a lower level (therefore lower PWM). This time I built a constant current source (read NON PWM) and set it to ~200mA (by the math, actual measured output was 221mA) I didn’t have the right resistor values to set it at 120mA.

I mounted the emitter on a Noctigon and screwed that to a 2# block of 6061. Measuring the voltage over the emitter after 30sec (the CC circuit was powered by a constant 5v source) I measures 2.835Vf.

Before doing the test I allowed the emitter to run 2 hours total at 2A (in 30min increments with 5 minute rests to allow the heatsink to cool) to do a burn in. Perhaps that’s the source of the difference between my test and the graph but I can 100% assure you I know my shit and I know how to take simple (but accurate) voltage and current measurements.

Thanks CK. I didn’t mean to call you out; just trying to wrap my head around the data. I certainly know you know your stuff.

This just throws my development numbers in relation to specs out the window… which as a designer is maddening :ghost:

Page 9 here says the current should be going through the roof at 2.8V
http://www.cree.com/~/media/Files/Cree/LED%20Components%20and%20Modules/XLamp/Data%20and%20Binning/XLampXPE.pdf

Now I’m going to have to write Cree!

Seriously, thanks for confirming the real-time readings.

edit: I guess I should add XP-E2 specs… page 8 still has a huge disparity specifically for the red emitter.
http://www.cree.com/~/media/Files/Cree/LED%20Components%20and%20Modules/XLamp/Data%20and%20Binning/XLampXPE2.pdf

As long as the emitters are on good copper stars and thermal management is adequate, you can easily push the emitters beyond the specs shown on data sheets, guys here routinely hotrod them w/o issue…albeit the heat produced goes up faster than lumen output, unfortunately, once you get past the spec sheet data of course :wink:

I understand that, Warhawk, but the discrepancy here is the Vf at a lower current. According to Cree, the Vf is only 2.65V for a 1A draw. At 350ma, the Vf should only be 2.2V. The only logic for why an XR-E2 red emitter would run at 2.835V at only 200ma is that a 2A break-in period fundamentally changes the specification of the emitter.

I also noted that MTN Electronics sanctions (loosely stated here) 1.9A on a Noctigon with adequate heat-sinking. Again, I am not questioning the findings. Awareness here definitely deserves more study on my part. And trust me, Cree will be in the loop to get to the bottom of this. To date, I have not seen such a huge discrepancy in their product line.

I had to go look at the source code again, but what I’m using now is:

  • Bright for 5ms, then dim for 65ms.
  • Repeat the above 3 times (4 blinks total).
  • Dim for 720ms.
  • Repeat the whole process at a rate of once per second.

So, it’s bright for 20ms total and dim for 980ms, meaning the duty cycle is actually (0.02 * bright) + (0.98 * dim). Both are using PWM at 19 kHz, so a 5ms bright flash is actually 95 individual pulses (0.005 * 19000) at a speed too fast to perceive.

On my S7-219B, I find this sort of flasher works well as a handlebar light, alternating between levels 3 and 5 (med and max, 42lm and 342lm). Those modes run at 187mA and ~1800mA, resulting in an overall draw of 219mA ((0.98 * 187) + (0.02 * 1800)). With a 3100mAh cell, that gives me just over 14 hours of run time on a mode which is extremely visible. My alternative would be to run on mode 4 all the time (155 lm, 745mA), which would give me a bit over 4 hours of run time.

The main difference for the tail light is that it’s red, pointed backward, and running at lower levels. Plus, it has even more diffuser film to make the beam wider.

What is the rise time of each pulse? I’m guessing you are not reaching full output in the 5ms bright modes with this high frequency rate (19kHz)?

Rise time is one of the variable difficult to account for in the runtime equation. It actually increases runtime but lowers output if clipped.

I can see how the S7-219B remains distinctive. My brightness ratio was closer to 3/1 which washed out the flash too much. You have a near 9/1 ratio. 14 hours is still an impressive runtime!

I will have to retest my police mode against a 3100ma cell (or new 3400mah cell since all my 3100’s are well used). I have a 1.4A and a 1.05A XM-L light I can test. The frequency of the police mode is 5 fast flashes per second (approx.) and no reduced on-time.

Rise time of each pulse? Heh. 5ms is way more than enough. My true strobe modes have a duty cycle of 0.3ms, and even that is plenty.

TL;DR: The rise time for a common attiny+7135+emitter setup is roughly a millionth of a second. Ish.


First, some measurements for reference:

On my Convoy S7-219B host with 5x7135 (380mA), or 1900mA total… with a Nichia 219B and a reflector which rides too high (loses like 20% of its output due to that)… I got the following readings:
|. Mode |. Lumens |. PWM |. Current |. Runtime on 3100mAh cell |. Efficiency |
| Moon: |>. 0.14 lm |>. 6 |>. 2.6mA |>. 49.6 days |>. 54 lm / A |
| Low: |>. 7.3 lm |>. 14 |>. 36mA |>. 86 hours |>. 203 lm / A |
| Med: |>. 42 lm |>. 39 |>. 187mA |>. 16.5 hours |>. 225 lm / A |
| High: |>. 155 lm |>. 120 |>. 745mA |>. 4.16 hours |>. 208 lm / A |
| Higher: |>. 342 lm |>. 255 |>. ~1800mA |>. 1.7 hours |>. 190 lm / A |

My S7-219B has a 0.14 lm mode and a 7.3 lm mode, running at efficiencies of 54 lm/A and 203 lm/A respectively. Based on the difference in efficiency I think the moon mode (0.14 lm) runs into rise-time limitations, but the low (7.3 lm) mode does not. So, let’s use that to work out the approximate rise time.

The maximum mode is 342 lm, and I’ll use the relative outputs as an approximation of the duty cycle. So, 0.14 lm is a 0.04% duty cycle and 7.3 lm is a 2.13% duty cycle. Both are running at 19 kHz PWM. So, the pulses happen every 19000th of a second. 2.13% of that is 1/890,000th of a second. But what about the moon mode? 0.04% of 1/19000 is about one 46.4 millionth of a second.

So, based on this I’m guessing the 7135s and emitter can emit short pulses somewhere between one millionth of a second and one forty-millionth of a second. A 5ms pulse is no problem whatsoever.

Going from specs instead of measurements, the attiny13a runs at 4.8 MHz. Its 19 kHz PWM mode has 256 individual “frames”, and non-coincidentally, 19000 * 256 = ~4.8 million. I’m using a PWM level of 6 for the moon mode, meaning it’s on for 6 frames then off for 250 frames. However, the output is 0.04% while the “on” frames are 2.34% of the total. Quite a difference. For the 7.3 lm mode, it’s a PWM level of 14… so, 5.47% of the frames are on, but the output is only 2.13% of the total. From this, I’m guessing that the full output takes about 9 or 10 frames to achieve. … and I just sanity-checked that against the next-brightest mode, and that checks out too.

So, going by that… I think the time to rise to full output is about 1/500,000th of a second. Again, 5ms (1/200th of a second) is no problem.

On this device, it’s about 6 frames to get any light at all, or about 9 frames to get full output. Not sure what’s happening in those first 5 frames (7135s warming up?), but the last 4 frames account for 1/1,216,000th of a second to go from zero to max.

I don’t know the true number for the rise time. At 9 kHz PWM I can get a useful moon mode at a PWM level of 1… which gives a shorter estimate than the results from 19 kHz PWM. But I’m pretty sure the rise time is somewhere in the ballpark of a millionth of a second, plus or minus a factor of three. And since I completely ignored fall time, it could be off by another factor of two. But it’s easily close enough for my bike-light-and-party-strobe purposes.

This is only valid for an attiny13a using 7135 chips and a Nichia 219B emitter; I don’t know what the actual limiting factor is. I think the numbers are nearly the same for recent Cree products though, at least for XM-L2 and XP-G2 and XP-E2. Original XM-L seems to have a significantly slower rise time.

Sorry for all the math, it was a good question and I wanted to figure it out in public.

:slight_smile: rise time per PWM pulse, not the on time.

I suspect the rise time is a 7135 limitation rather than the MP and I am not sure what that is. Comfy had posted some good images of a scope reading I need to find again. edit: post 6 here… FETs and gate resistors - scope images

The emitters will take a few frames to “warm up” and that residual heat is cumulative in the high rate pulses. This is fairly straight forward and will change from one emitter version to the next.

Nice work on the characterization, BTW. :beer:

Ah, yes. For my true strobe modes, I use PWM=255… so the PWM rise isn’t really an issue. For the bike flasher, it uses a PWM level which may or may not have individual pulses. The handlebar light spikes to 255 so it’s not affected, but the tail light spikes to a lower level and thus has the 95 individual pulses in every 5ms flash.

Thanks! It’s good to see some more direct measurements. Going by the graphs he posted, it appears the actual rise time is about 1/220,000th of a second. That’s toward the outer edge of my guesses, but still within the error margin I was expecting. Not bad, for a cheap DMM, a cheap lux meter on a milk carton, and some napkin math.

(20 microseconds per 78 pixels, ~18 pixels from zero to max output, so about 4.6 microseconds for full rise)

Yep, and that varies with the circuit too.

Just for grins I put 3.95V on one of my SuperFlash road-salvage lights. It is a red “brand X” emitter driven to ~200ma and 1.85Vf across the emitter and that is with a 2R0 resistor inline. there is definitely signs of PWM on the light as you can see strobing when I move the light around on the wire or move my hand in front of it. It has no heatsinking to speak of except the robust copper traces on the fiberboard. According to Planet Bike, this is a 1/2W LED that is now being driven at 0.8 watts. And yes, it is a bit warm but touchable. I’ll see if the characteristics change on this one through a burn-in.

I suppose I should try to measure the emitter voltage next time I build a bike light or take one apart. I haven’t actually done it before, but it seems simple enough… I just need a third and maybe fourth hand to hold everything in place while measuring.

Correction… my 1/2 watt emitter is actually driven to 0.37 watts (1.85V at 0.2A ). That mean somewhere in the circuit I am loosing ~.43 watts. No inductor in this circuit so it has to be linear.

And yes, this thing is painfully bright in my dark lab.

I am seeing how long this thing will manage regulation. It could take a while. It is just now down to 3.83V :weary:

Much better practice to solder DMM leads directly to the emitter pad’s than to try to hold probes on it.

Now this is interesting… input is down to 3.57V and the Vf on the emitter rose to 2.0V and the total current is now at 180ma 0.36W across the emitter and only a 0.28W loss across the rest of the circuit. The output is still quite intense.

Edit: now there is some wild variation that can only be explained by thermal characteristics. This morning the cell rested back up to 3.6V under load and the turn-on current is still 180ma but the Vf is only 1.56V.

Edit: 3.31Vin at 120ma and 1.65Vf. Thermally much more stable and notably cooler than 4.0Vin. These lights are optimized for 3.0Vin and less. I’m surprised I didn’t blow something at turn on.

Final numbers is 3.0Vin at 105ma and 1.54Vf and notably dimmer and much easier to look at.

This would almost make a nice direct drive emitter on a 1.5V alkaline cell.

ToyKeeper,
Just wanted to let you know I used your code in two pair of L2M’s I built. I disabled the LVP (simply pulled the resistors) and am running 1x 7135 each to the XP-E2 (one each Red and one each Amber). These are emergency lights I keeps in me and my wife’s cars. After having to tow my sister’s car home (with a strap) about 4 miles a few months ago after dark with absolutely zero power (so no brake / tail lights, used my H52 to have something back there) I had been looking for a solution to keep in the cars. These give me the option of a red or a yellow flasher and at such low current (and no LVP) they run several hours from a single CR123.

LVP as in low-voltage protection?

I think you could just remove the “#define VOLTAGE_MON” line to disable that. In any case, I’m glad it’s working and useful for you.

I still need to build the other two tail lights, and fix the firmware on the one I’ve been using. And I might (maybe) even have time soon! :stuck_out_tongue_winking_eye: