[WIP] 17mm DD+single-7135 driver / single sided / Dual-PWM

I think these boards are pushing the envelope as to what they can do. Here is my response from OSH re: solder mask over the ground ring:

Not knocking Wight in any way. OSH is happy to fix their mess up. My boards got put on a “Super Swift Service” panel today.

Checked this afternoon and the order has gone to fab again.
Good response!

Virtually every board I have of Alex’s has most of the batt side ground ring covered up. I simply scrape em clean and move on. Some of them have way too much exposed at the batter contact, completely eradicating Alex’s name and the BLF statement as to the version number.

But they work. They just take a minute or two more to build. No biggie when you’re only doing a few at a time.

I need a simple firmare for this driver in a rear clicky light. I found tk-otc and it seems perfect. Here is what the description says:

* Generic clicky-switch-with-offtime-cap firmware.
* Expects a FET+1 style driver, supports two independent power channels.
* Similar to blf-a6.c but minus the end-user config options.

But, I downloaded the .hex and flashed it on the driver it does all kinds of crazy stuff. Sometimes the light flashes and it does not switch modes as expected.

Can someone point me to a firmware? I want it to be simple, I need no things like batcheck or strobe modes etc. It should use the otc and have a dual pwm function.

STAR Off-Time or ToyKeeper's Starry FW.

thanks, but with the starry fw I get an error if I try to build it

And the star off-time fw I don’t get how to get dual pwm to work properly. It says

What should I put here if I use the default modes? What does the number 8 says?

I would prefer a more inuitive method like in the tk-otc fw

finges, this might be helpful:

http://toykeeper.net/torches/finges/

I took starry-offtime and tk-otc and did very small modifications to them to do what it sounds like you want:

  • Turned off all blinky modes.
  • Turned off 3-level offtime (so, it only senses short and long presses, no medium).

This should also reduce the size by enough that you can rebuild them without any special options. I got 812 bytes (69.3) for starry-offtime and 562 bytes (54.9) for tk-otc.

If you need any help calibrating the PWM levels for the FET and 7135, the bin/level_calc.py tool can estimate what those numbers should be according to your specs and lumen measurements. For example, to get six evenly-spaced modes on a FET+1 with XP-L emitter (including moon mode):

> ./bin/level_calc.py
How many total levels do you want? (4) 6
Lowest visible PWM level, for moon mode: (6) 1
How bright is moon mode, in lumens? (0.25) 10
How bright is the highest level, in lumens? (1000) 1300
Use dual PWM? [y/n] (n) y
Second channel, lowest visible PWM level: (6) 4
Second channel, how bright is the lowest mode, in lumens? (0.25) 0.25
Second channel, how bright is maximum, in lumens? (140) 140
1: visually 0.63 (0.25 lm): 0.00/255, 4.00/255
2: visually 2.69 (19.39 lm): 0.00/255, 38.39/255
3: visually 4.74 (106.74 lm): 0.00/255, 195.26/255
4: visually 6.80 (314.48 lm): 33.39/255, 255.00/255
5: visually 8.86 (694.83 lm): 108.28/255, 255.00/255
6: visually 10.91 (1300.00 lm): 255.00/255, 0.00/255
PWM1/FET  values: 0,0,0,33,108,255
PWM2/7135 values: 4,38,195,255,255,0
On a non-FET driver, the last mode should be 255 on both channels.

You may also need to calibrate the CAP_SHORT value, depending on how fast your offtime capacitor drains.

wow great work, thank you ToyKeeper

I flashed tk-otc on my driver and it works good.

Now I only would like to reduce the number of modes, I don’t need 7 or 6 modes.

Where exactly can I find the level_calc.py tool?

It’s under bin/ at the firmware repo linked in my signature.

You can, of course, also adjust the levels manually. The tool just gets you some ballpark estimates to start with.

Ok thanks, found it. Yes I know that I can adjust the levels manually, but in previous drivers I had trouble to find the right values for a linear increase in brightness.

Anyway, I have another problem with this driver. I build another one but now with a zener mod for a light with a XHP50 and rear clicky.
I flashed the same firmware as on the non zener modded driver and now the mode switching is totaly buggy. It seems it switches at random, sometimes I need to half press the button like 10 times to get it to switch. It also sometimes starts in moon mode and stays on for around 10sec and than switches off. Sometimes it cycles through the modes high to low and sometimes low to high … and so on.

Do I need to change some values in the firmware for zener modded drivers?

Yes. And you may need to change some of the resistors too, if you want any voltage-related functions to work. Or it might need voltage-related stuff turned off entirely.

The PWM levels will also need recalibration for each type of emitter, since the relative contributions of the FET and 7135 change. A single-channel driver can usually get by with one set of levels for all emitters, but two-channel drivers need the firmware reconfigured/rebuilt for each.

(if a light maxes out at 4amps, the 350mA channel can handle 8.75% of the total, but the 350mA channel can only do up to 2.3% on a 15-amp light… and the relative balance should be updated in the firmware to account for this)

Ok, so I think I need to change the CAP_SHORT value, and I can use offtime-cap.c to calibrate it, am I right?

And to get the right resistor values, I use the battcheck firmware?

The offtime-cap firmware can give you values for CAP_SHORT; just half-press the button for the amount of time you want to set as the threshold between short and long presses, take a few readings, get an average.

As for resistor values, I can’t really help. Battcheck doesn’t provide resistor values; it only provides ADC values to use after you’ve already gotten the resistors worked out. You need to divide the voltage in hardware to get it completely in the range of 0.1 to 1.1V though. Battcheck can at least tell you if you’re getting usable values though; try it with a full battery vs a low battery, and if the values are too close to each other (or if any readings are 255), then the resistors are wrong.

Am I understanding correctly that all the components for this board are the same as the single sided FETDD board with the exception of the 7135 chip? I just piggy pack the zener on the 10uf cap, and flash with the dual PWM firmware?

Yes, and for the Zener see this post [WIP] 17mm DD+single-7135 driver / single sided / Dual-PWM

[quote=finges]
Yes, and for the Zener see this post https://budgetlightforum.com/t/-/31102?page=2#comment-716463
[/quote
]

Do you have a post#? Those links don't work for me, and depends on your posts/page setting. I'm interested in that too, and couldn't find it.

For zener info Look at posts 78-83. For 6v lvp you’ll need to swap out R1 for a higher value as well. Anything between 30k-40k seems to work fine.

Yes, thanx for the LVP tip too!!

I’m sure Tom knows, but I’ll add this for anyone else reading: the firmware lvp values will still need to be tweaked, even with the correct R1.

I may forget more than I remember Smile. Haven't done a zener mod in a long time, though I know it's a combo of the resistor and firmware values read in. Would the 30-40K work for 3 cells as well, and just tweak the values in firmware also?