Custom RGBW driver (with some interesting features)

84 posts / 0 new
Last post

Pages

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany
Custom RGBW driver (with some interesting features)

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. 

 

Edited by: DrJones on 02/24/2015 - 16:18
totilde
totilde's picture
Offline
Last seen: 1 year 10 months ago
Joined: 12/27/2012 - 12:22
Posts: 1157
Location: spain

Very interesting news! Are you making a batch for sale?

Mooooooo

mattthemuppet
Offline
Last seen: 3 months 3 days ago
Joined: 01/04/2012 - 16:20
Posts: 1273
Location: WA

sweet! Congrats on your first foray into designing your own PCB. Looks like it was a success!

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

totilde: Not as complete drivers (I have no reflow equipment, and soldering a batch of these... I doubt I want to do that.), but maybe as kit to solder yourself. I got a couple of boards, not enough components though. Will order some next year Smile

mattthemuppet: Thanks! Yes, a success Smile . My second board is in the fab already, it's a 46mm driver board for King/Kung/T90 etc. I hope it'll turn out well, too.

MRsDNF
MRsDNF's picture
Offline
Last seen: 13 hours 25 min ago
Joined: 12/22/2011 - 21:18
Posts: 13455
Location: A light beam away from the missus in the land of Aus.

Nice work DrJones. I dont understand how you do your work but like it for what it is. Your driver in my OL light is full of magic surprises. Happy xmas and have a safe new year. Smile

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Helios-
Helios-'s picture
Offline
Last seen: 1 year 1 day ago
Joined: 01/18/2012 - 21:12
Posts: 2099

Very nice.


Counterfeit 18650s, 2,<a href=“http://

djozz
djozz's picture
Offline
Last seen: 13 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 17320
Location: Amsterdam

I missed this thread, very nice work. I just made myself a small AA zoomie with the xml colour and the 17mm intl-outdoor driver. I am happy with that UI, but being able to mix colours is much nicer obviously. I would be interested in a board+components when you make a batch of these.

The led I bought from led-tech.de by the way, they have the xml colour on a nice thick 20mm board ( that I sanded down to 16mm).

djozz
djozz's picture
Offline
Last seen: 13 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 17320
Location: Amsterdam

To share some thoughts....

I have played with rgbw lights for quite some time now and have thought about how a -for me- ideal UI would be. It would be operated with two switches; a reverse clicky (say: at the tail) and an electronic (side) switch. I do not have the knowledge how to implement it in an actual driver, and I guess it will not be possible with this particular driver without altering the hardware, it is a wish..

The clicky would cycle through WRGB (or whatever leds you connect this driver to, perhaps a quad board with leds in the four colours behind a TIR, that may solve overlap problems in the beam). When the next die is on, the last is off, like the intl-outdoor rgbw-driver without the blinkies. This way, if just the clicky is used, you can use the four dies/leds in a simple effective way separately.

But when one of the dies is activated by the clicky, you can use the electronic switch to ramp it down and up to set the brightness. As soon as you use the electronic switch for ramping, switching to the next die with the clicky leaves the last die at the set level, so it does not turn off anymore. This way you can adjust all four dies to a desired output.

I don't think I would want memory, I like this UI to be simple.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

I'm not planning a dual switch firmware.

But there will be a mode where you can increase or decrease the value for each die.

The white mode got much more useful meanwhile, upated OP. I even often EDC this light in the evening indoors, just for the white mode.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Added quite some modes (edited the OP). I'm quite happy with it now. Smile

MRsDNF
MRsDNF's picture
Offline
Last seen: 13 hours 25 min ago
Joined: 12/22/2011 - 21:18
Posts: 13455
Location: A light beam away from the missus in the land of Aus.

I wont repeat myself but orsm. Tongue Out

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

totilde
totilde's picture
Offline
Last seen: 1 year 10 months ago
Joined: 12/27/2012 - 12:22
Posts: 1157
Location: spain

amazing driver, those test modes are a must for all lights!

Mooooooo

djozz
djozz's picture
Offline
Last seen: 13 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 17320
Location: Amsterdam

(grin..) that has become one weird and very complete driver, I think it is huge fun to build a flashlight around it. I'm in for a kit when it is ready Smile

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Measured a quite old Trustfire Flame: 1.5Ah, a newer one: 2.2Ah, new Panasonic NCR18650B: 2.9Ah. Sounds plausible.

djozz
djozz's picture
Offline
Last seen: 13 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 17320
Location: Amsterdam

DrJones wrote:

Measured a quite old Trustfire Flame: 1.5Ah, a newer one: 2.2Ah, new Panasonic NCR18650B: 2.9Ah. Sounds plausible.

It is a 'colourful dream discharger' Wink

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 1 year 8 months ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

What a great project.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

islisis
Offline
Last seen: 4 years 8 months ago
Joined: 03/22/2013 - 23:22
Posts: 352
Location: Tokyo, Japan

great thinking outside the box!
A question about the pwm: if you move the light quickly in any of the colour-mixed modes, do you see a line of R/G/B dashes, or a solid colour line?
I would still love to see an alternate firmware for clicky switches, even with just the basic modes.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Thanks Smile

2kHz gives a solid color line. 

musicmagic
Offline
Last seen: 5 years 9 months ago
Joined: 10/28/2013 - 09:53
Posts: 984
Location: CT
DrJones wrote:
There’s an undocumented mode. The owner might try to find out him/herself what it does.

I honestly have no additional mode ideas for this. Sure someone will come around saying “can you change this timing to this timing?”, but you went above and beyond on this one.

how much code space did you use/how much was left?

Edit: nevermind, I have a mode question: how easy would it be to implement brightness ramping in the color cycle mode?

If you can’t blind them with your brilliance, baffle them with your bullcrap.

The real currency in the world is not money, it’s trust.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Brightness ramp in color cycle: not that easy, mainly due to the limited PWM resolution at low levels, i.e. at low levels there will be much less available colors. I may try anyway though.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Just ordered another Roche F6 and designed an RGBW driver board for the F6. Waiting for the fab now. I hope I didn't make an error.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Got the AMC7135s now. Message me if you want a kit (17mm board, MCU, other components, 8*AMC7135, piece of d-c-fix diffuser film).

The Roche-F6 driver has not yet arrived.

 

 

 

djozz
djozz's picture
Offline
Last seen: 13 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 17320
Location: Amsterdam

PM sent Smile

B42
B42's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 03/07/2013 - 21:03
Posts: 1875

Could it be made to be used in a 4x SRK/Kung light for one each or tinted LEDs R, G, B and W?

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Yes, it can drive 4 individual LEDs, too. You might want to stack some more AMC7135 then perhaps.

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

The boards for the Roche F6 now also arrived; I populated and tested one, it works fine.

musicmagic
Offline
Last seen: 5 years 9 months ago
Joined: 10/28/2013 - 09:53
Posts: 984
Location: CT

why the f6? why not the convoy L4?

If you can’t blind them with your brilliance, baffle them with your bullcrap.

The real currency in the world is not money, it’s trust.

Mattaus
Mattaus's picture
Offline
Last seen: 2 years 9 months ago
Joined: 10/20/2012 - 23:51
Posts: 833
Location: Brisbane, Australia

Could I possibly design a board myself, and purchase a pre-flashed MCU from you (or perhaps just purchase the firmware to load myself)?

I want to build a RGBW P60 drop-in, and I just want to cycle through the colors in a set order at a fixed brightness for each so have no real need for a momentary switch operation. The mode order I'm thinking of is White > Blue > Red > Green > B/R > G/R > back to start.

The B/R and G/R mixes will be pre-determined fixed ratios.

Possible? What MCU you are you using in the picture in the original post? I have designed a 17mm P60 driver using the Attiny84 (haven't ordered it yet nor do I have the MCU either), but it is a bit bigger than the one used in the first post.

- Matt

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

F6 because it's small and EDCable and nice.

Not L4 because it's big and more of a thrower, and 'throwing' doesn't work well with color mixing. For color mixing you want a strong diffuser, so the big head is useless. BTW, the driver (probably) also fits into the Roche X3.

Mattaus: Such a simple clicky firmware could be done on an ATtiny13; sending a PM.

This driver however uses an ATtiny85.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 19 hours 4 min ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Ooh, I hadn’t thought about the Roche F6 as a compact host with a momentary switch. How hard was it to mod, and to get different guts into? Any easier/harder than the ZY-T29?

DrJones
DrJones's picture
Offline
Last seen: 4 years 6 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

Designing a specific driver for it takes some effort, but when you have that it's fine. The space in the driver compartment is quite small, so don't use long/thick wires with the RGBW.

Pages