Driver for XM-L2 U3, controlled by Arduino - Need advice

Hi,

Im making a headlamp with two XM-L2 U3 LED units. The lamp will have a Atmega328 microcontroller that controlls the lights.
Do you guys have a good way of controlling the XM-L2`s from the Arduino microcontroller?
Battery will be 7.4v 8000mAh. The headlamp will also have a few 1W LEDs. How can I power these?

Im makeing a circuitboard for all the components, so if I could make the LED drivers myself (and add them to the board), that would be nice.

Thanks

the most simple method is PWM, arduino already implement PWM for you, but i think you should change the pwm frequency by modifying some timer register, stock pwm of arduino is very low frequency, 480hz. An important thing is your voltage is quite high, so u need to connect 2 xm-l2 in series

another method is constant current

Thanks, migh use PWM.
For driving the Crees what is the best solution? Buck converter, IC LED driver, a MOSFET?
Also the two XM-L2`s will operate independently of each other. I will connect a push button to the microcontroller. One push is the first XM-L2 at 50, second push is 100, third is second XM-L2 at 50% and the firs one at 0, then forth press is second SM-L2 at 100 and so on. Lets say that the fifth press is both at 50% and the sixth is both at 100%

Found this on eBay:

https://www.ebay.com/itm/2-pieces-LED-driver-LDR-23-2-4A-2-4A-DC-5V-27V-for-CREE-XHP50-XHP70-XP-L/113382682345?hash=item1a66226ee9:g:zjQAAOSw37BaUyIW:rk:1:pf:1&frcectupt=true

Could this be the driver Im looking for? This can be controlled using PWM?

Are you going to mod an existing headlamp? If so, may I ask which one? Or are you designing your own headlamp casing?

If you are set on XM-L2 LEDs and a 7.4V battery you will need a buck driver . XM-L2s are 3.7V LEDs, feed 7.4V to them and they will burn. Because you want to control them individually you can’t wire the LEDs in series.

The driver you linked to on Ebay appears to be a buck driver, not sure though, I don’t have any experience with buck drivers. It looks like it can receive an external PWM source so maybe you can use one of these drivers per LED and control brightness from your Arduino?

I’ve made a few dual LED channel headlight driver boards myself but they are not buck drivers. I use 3.7V batter for XM-L LEDs and 7.4V (two 3.7V batteries in series) for MT-G2 LED:

Thanks Mike.
Im making a headlamp all from scratch. Going to make a circuit board and housing, but it is the driver part for the LEDs im missing.
I see you have made your own driver board in your projects, and you also use a microcontroller? Can I ask what parts you used for that?

Interesting. Are you aiming for one of the LEDs to be a spotlight/thrower and the other one a flooder? Been interested in making casing myself but I’ve settled for modding existing headlamps because I think it will take me way to much time and money to have my own headlamp casing fabricated.

Yeah, making my own driver boards and firmware has been a hobby for quite some time now. The micro-controller I use now is the ATtiny1634. It’s small, has 16kb flash memory and 17 usable IOs. ATmega is too big for 17mm flashlight drivers. I don’t use buck/boost topology (not yet anyway) so I’ve been using current regulators like AMC7135 and CAT4104. AMC7135s are fixed current, CAT4104s are set by external resistor so I’ve used a digipot to adjust current from firmware.

Thanks a lot.
Yes, one high power spotlight and one high power flood/trower. Also a RGB, emergency LED (low power) for low battery use, and five smal 0603 LEDs for battery indication.
This will be a caving light for use underground. If you search for “Pulsar cavelight” you can see the type of lamp I want to make.

BTW: How do you controll all the AMC7135s from the microcontroller?

I’ve seen those pulsar lights, the Nano model is interesting. I build my lights to use underground also, here are a bunch of my photos I’ve taken from underground adventures: Exploration photos with my flashlights
How far have you come in terms of case fabrication? If you intend on selling a case or two once you are done I might be interested. I could design a dedicated driver board for it.

AMC7135s have an enable pin. Just route a IO output to the enable pin on the 7135s and turn on that IO pin, either constant on or use PWM.

Wow! Your photos are amazing! The mines you visit are mostly in Sweden? I do explore mines myself. If you want, you can see my photos on Instagram: https://www.instagram.com/hans_magnus/. Also have a few photos of the cavelamp project there. I work with voluntary work in a mine in my hometown Drammen, not far from Oslo.

Im hoping to make 5-10 cases so that I can make more lamps for friends and so on, but that depents on production costs ofc. Will let you know when I get to that part.

I will take a look at the AMC7135s. 8 of them could power one XM-L2 U3 then at 2.8A, but then I need the Vin to be 3.3V (for the XM-L2s)?

Thanks! Only been down in Swedish mines so far. I know that Norway has some nice abandoned mines but so far I’ve only been climbing over there, and the occasional visit to abandoned buildings:

The AMC7135s do not operate so well above 6V, and as the LEDs you have listed are 3.7V, so you need to lower the voltage. I don’t really see why you are looking at using 7.4V batteries. And at 8000mAh it sounds like your battery pack is going to be pretty big. I prefer smaller and lighter, and carry replacement cells with me. Currently I use 18650 cells for all my lights, headlamp or hand-held.

An alternative if you are set on using 7.4V battery pack is to use LEDs that take that voltage, like XHP50, XHP70 or MT-G2 (MT-G2 won’t give you a good spot beam though), and a regulator that can handle the higher voltage. A705NGT is a direct replacement for 7135 when using higher voltages, I’ve use them in a few drivers and they work well.

I see the board design for your headlamp project. Are you going to have the LED driver ICs on a separate board? Or is that just a current version which will be modified? I put everything on a single board myself. Maybe not the best in terms of component head management, but it works well enough for me.

Aah, nice!

Okey. I have a batterypack from MagicShine thats on 7.4V (Six 18650s. Two and two in series, then in parallel) that I could use, and 220V charger for this pack. Also have many singel 28650s that I want to use.
Mabye I should use 3.7V insted. The microcontroller needs 3.3V, so that wouldn`t be a problem. But when the batteryvoltage drop form 4.2 (full) to 3-3.3V (“empty”), the light will dim down?
When using a 7.4V batterypack, I could have full brightnes even at 6.6V (“empty” batterypack)?

Aha, the micro-controller needs 3.3V? I use the 1634, it only needs 1.8V. I guess your options are limited with the Arduino platform though. I prefer writing firmware in C using Atmel Studio, my Arduino is collecting dust and I aim to keep it that way.

I think that is the advantage with buck drivers. Because you want to use the MagicShine pack I’d say buck driver is your best option. Someone else should chime in here though, I don’t have any experience with buck drivers at all.

The Atmega328 can run on 3.3v or 5v. 3.3v and it will be 8bit, 5v and it will be 16bit. Want to use the Atmega328 for all the IO pins:

- Battery indicator: 5 0603 LEDs (5 IO pins)

- Battery level measure: 1 IO

- RGB: 3 IOs

- Two XM-L2s: 2 IOs

- One emergency LED: 1 IO

  • Two push buttons: 2 IOs
    Total: 14 IO pins.

I will only use the microprosessor on the dedicated circuitboard and not the other parts of the Arduino

Its a dilemma. 28650s in series will give high voltage, but “half” amperage, 28650s in parallel will give low voltage, but good amperage and “double” the batterylife compared to barreies in series

Because I don’t use buck drivers myself I would go for cells in parallel, but that’s only because I find working 1S easier for driver design.

The latest driver I’m designing for that Gemini project I linked above uses 17 IOs. For battery level measure you actually don’t need an IO pin if you are running on 1S voltage levels. You use MCU voltage as voltage reference, and then connect internal 1.1 ref voltage to ADC and measure it. Because internal 1.1V is constant it is easy to calculate MCU VCC. Of coarse, if you have input diode you have to take voltage drop over it into consideration. I do voltage measuring this way myself, it works very well.

I guess you are going to do development and testing in Arduino environment? That’s why you will be using ATmega 328?

Anyhow, if you get close to completion with the cases I would be interested in checking them out. Only interested in casing though, I’ll always use my own driver boards for my own lights.

Hi Hans, I am currently also building a caving light, very similar to what you are designing.

I am modifying a A17DD-L FET +1 driver and use the FET channel for the spot led and 7135 (adding one more 7135) channel for the flood.

If you are interested in my project PM me.

Cheers Yuval.

I know nothing of Arduino, so I won’t be any help. I do like the looks of the lights your trying to make.
I have thought of trying to make one like the Nano, but use 2 drivers,switches, leds, optics etc, 2 lights in one housing.



TaskLED has a dual driver that can be used to control 2 LEDs using only one driver and one switch.

Yes. There are ways to control 2 leds with 1 driver. But if there is a driver failure? I was thinking more for redundancy.