I finally got myself into PCB layout using EAGLE, and as my first project I developed a driver for an RGBW LED. It uses software PWM (at 2 kHz) to independently drive the 4 dies of an RGBW XM-L (or other RGBW LEDs). It uses 2* AMC7135 per die. (The back side holds another 4 AMC7135s, a protection diode and a small capacitor, and a center pad for a spring.)
I had made an RGBW driver before, a NANJG101-AK-A1 with cut traces, fine wires to get the additional connections and stacked AMC7135, but I was unhappy with that solution, as it's quite fiddly, and also I was unhappy with the UI possibilities with a clicky. So this driver uses a momentary switch for the UI (electronic switch). When off, the quiescent current is only 300nA (that's 0.3µA), that would theoretically take a thousand years to discharge a 2600mAh cell...
I modded a Small Sun ZY-T29 with it. I used multiple layers of d-c-fix diffuser to mix the colors.
The firmware got 'grown up' meanwhile and makes good use of the RGBW LED's possibilities I think. And then some...
The different main modes are accessed from off state, each with it's own click pattern. Each mode then has it's own click commands to change parameters etc. To change the main mode you have to switch it off first (with a short click).
In the following a "T" refers to a tap, i.e. a short click, while "H" refers to a press&hold. "TTH" for example then means two quick taps followed by a press&hold.
From off state, the following modes can be accessed using their respective click commands:
T (switch on by a single short click) -- color cycle
In this mode, H (press&hold) cycles forward through the chromatic circle (red>yellow>green>cyan>blue>purple>red>...), TH (short click immediately followed by a press&hold) cycles backwards, so you can easily set your desired color. There's a short pause at the pure colors (R,B,G) to make hitting them easier. TT (double click) starts or stops a much slower automatic cycling (direction can be changed by H / TH). Brightness can be changed down (TTTH, halves output) and up (TTH, doubles); not that the PWM resolution is quite bad in the lowest modes. T switches off. EDIT: New version now ramps continuously. Not that at the lowest levels the limited PWM resolution causes steps in the color transition.
H (switch on by press&hold) -- white
probably the most useful modes for everyday purpose (more for indoors due to only 700mA and the diffuser), just white (using the white die). H and TH ramp the brightness up & down, roughly visually linear and smoothly (except for the lowest modes). Low is quite low. T switches off.
TT -- simple modes and blinkies
This mode has several simple sub-modes, use H and TH to cycle through them forward and backward. The modes are red -- green -- blue -- EU yellow warning strobe -- EU blue emergency vehicle strobe -- US red/blue police strobe -- wild color strobe. T switches off.
TH -- full RGBW mode
This mode lets you change every die's brightness individually, so you can mix every possible color. H and TH increase and decrease the current channel's brightness. TT changes the channel (R>G>B>W>R...), TTT backwards; a short blink indicates the active channel. T switches off.
TTT -- lockout
TTT again to reactivate
TTTT -- battery level indicator
This mode also has 2 sub-modes (switch between them with TT), one displays the voltage simply as a color: 4.5V-white, 4.0V-blue, 3.5V-green, 3.0V-red, intermediate colors for intermediate voltages. The other mode indicates the voltage by blinking; red for whole volts, green for tenths, blue for hundredths, e.g. 3*red, 6*green, 2*blue means 3.62V. NOTE that the driver clearly does not have an absolute accuracy of 0.01V! It may actually be several % off! So that last digit is only good for a direct comparison etc. T switches off.
All of the above modes have their own memory, they'll start with the settings used last time.
There's an undocumented mode. The owner might try to find out him/herself what it does.
And then there are 2 quite special modes...
TTTTTTTT -- measure cell capacity
This driver can measure the cell's capacity (in Ah) and stored energy (in Wh) with a load of 700mA down to 2.9V. Insert a full cell, activate this mode. It will then run for a few hours till the cell is drained and go into sleep mode. Press the button and it will tell the capacity and energy in blinks like the battery indicator above, i.e. a short white pre-blink to indicate capacity readout, 2*red, 5*green, 1*blue -> 2.51 Ah (= 2510 mAh), then a green pre-blink to indicate energy, then 8*red, 4*green, 7*blue -> 8.47 Wh. Can be repated by another tap. Exit this mode by changing the battery. This is the only mode that can't be exited by T. The above notes about accuracy also apply here.
TTTTTT -- measure internal resistance (including contact resistances)
This mode allows to measure the internal resistance of the cell, but including the contact resistances. It will light up for ~10s, pause, and then show the resistance by some blinks in mOhm, e.g. 1*red, 7*green, 2*blue -> 172 mOhm. The measurement is repeated over and over, T to switch off.
The battery must have sufficient voltage for the measurement, the measurement will be aborted (some red blinks, then switches off) if the voltage is too low. This may also happen with full cells if internal and/or contact resistances are too high. You might want to improve the contacts; the success of such measures can be seen in the measurement results. The above notes about accuracy also apply here.
I'll test it a bit more and might later send some kits (PCB and all components) for self-assembly.
Edit: Works fine.
Edit: Changed nearly the whole post; before that it described a preliminary firmware with much less features (only color cycle and white modes).
Edit: Added lockout and changing brightness in color cycle mode.
Edit: Color cycle now has a smooth brightness ramp.
Available as 17mm board or custom board for Roche F6 or custom board for the Yupard 16340.
New: Also as custom board for the Skilhunt H02/H02R (H02R recommended).
Available as complete driver or kit for self assembly or bare MCU.