Each driver build seems to behave a little differently, especially if you change the components used to build it. However, the firmware should work if you do a little calibration on it. Or it might work without any changes.
I generally calibrate firmware for a few things on each light:
OTC values for ~0.5s and ~1.5s button presses.
Voltage detection hardcoded values for 4.2V, 4.0V, 3.8V, 3.5V, 3.0V, 2.8V, and 2.7V. Makes LVP and battcheck work.
Lowest usable PWM level, for moon mode.
Other PWM levels, if needed.
For the OTC, I flash offtime-cap.hex and measure a few button presses, then plug those values into my target firmware.
For voltage, I flash battcheck.hex and hook the light up to a variable power supply plus DMM, then adjust it to each desired level. It blinks out values I can plug into other firmwares.
For moon mode, I put my best guess into the target firmware, measure it, then adjust up or down and reflash until it’s how I want it.
For other PWM levels, I can usually just plug in some lumen estimates into level_calc.py and it’ll give me the numbers I need.
Stock store-bought drivers will probably “just work” with the default values, but custom-built drivers tend to vary more and need more calibration.
Wow…nice guide. Thank you! I will flash the driver tomorrow with offtime…maybe it works out of the box. If not, I do your hints step by step. But nice to know that there are different “tools” which help to customize the firmware.
If I recall correctly, this driver has an unused pin, pin 3 (a.k.a. PB4). At least, that’s the unused pin on wight’s FET+1 driver. I think he used the same pin layout here, except for not using the second PWM channel.
So, if you configure your firmware to put the switch on PB4, and solder the switch wires to pin 3 and ground, it should work without sacrificing the OTC.
In the OP, it shows pin 3 next to the “W” in “WELLS”.
Or, of course, if you don’t care about the OTC, use those pads instead. OTC isn’t normally used with e-switches, and this will make it a lot easier to flash the driver again later.
Which board revision are you building? You shouldn’t need two 10uF caps but I haven’t tried just one on wight’s board. I use RMM’s boards (from his MTN store) and you only place one 10uF.
The 36k resistor isn’t required if you already have a 22k. It just gives you more options with the ADC calculation for the LVP (low voltage protection). With the 22k and 2S (~8.4V) you end up being in the upper range of the ADC (limit of 255) with 6V LVP. If you wanted to have something higher for your LVP like 6.4V you would need the 36k resistor. You can see the calculations on RMM’s Google sheet that he so nicely shared with us before:
If you look, the 36k brings the ADC values more into the middle rather than the upper limit.
Does anyone happen to know what could be causing one of these drivers to change modes on its own?
I made 50 of these last batch and they all work fine normally. I had even used one of them with an eswitch in the past and it was fine. However recently I tried using JohnnyCs dual switch firmware with them and this is what I get.
https://youtu.be/vw5rxIBh7_M
It will just sit there and skip upward in modes at random on its own. I tried multiple drivers and even assembled a brand new one and the result is exactly the same. I tried both 6 and 12v configs too with no luck.
I tried using the default firmware from JC and TomEs eswitch one and they both skipped. I had used toms before too and did not have this issue so the only thing I can think is that I was shipped a bad batch of components. Problem is I have no idea which part could cause this :(