# $5.00 Variable Brightness 7.4v pwm Driver



## moderator007 (Apr 4, 2011)

Well after being a member here for couple years I have come to love the knowledge this place possess. So i felt I should contribute part of my knowlege to cpf.

I have been searching a long time for a affordable PWM driver for a double 18650 maglite conversion (2D). I really liked the Dealextreme sku 20330 driver. I have used this driver in various maglite conversions. With a cree xm-l and a 2 paralleled 20330 for a sst-50. Thanks to ma sha1.

Driver details, Its constant current and constant voltage. Works great for 2.5amps for a single 20330 or 5amps for 2 paralleled 20330's from 7.4 volts in. Current can be changed by changing sense resistor marked r100 and r400. They are wired in parallel so it don't matter which one you change or add to. Calculations for output current is .2 divided by the total of the parallel resistors. Use a online parallel resistor calculator to find the total resistance. R100 is .100 ohms and r400 is .400 ohms. So this gives you a total of .o8 ohms. Divide .2 by .08 and you get 2.5 in amps out to the led. So if you want more current you add a resistor or change it out. I add a 1 ohm 1/4 watt resistor to them to give me a little more current. Gives me .074 ohms for 2.7amps. You can keep adding 1 ohm resistors to give you more current. If you add three 1 ohm resistors you get .0645 ohms for 3.125 amps and the driver will handle it. At least mine did! Gets a little warm. I have run lots of test on this driver. On the newer drivers, I have dx replaced the old Schottky diode (ss24) 2 amp with a (ss34) 3amp thats more like it DX.

I have to thank Manne over at dx forums for informing me of the ic's used on this board. All the boards I have ever received from dx had the part id numbers sanded off them. Manne had some that were not sanded off.

The main ic is a 6 pin QX5241 led driver with low and behold a dim input. So find the datasheet (you will have to use google translate) or look here or here look at pin #2 Dim, its a pwm input. All you have to do is unsolder the resistor marked 000. This breaks the connection back to Vcc at pin #4. So the dim pin is low so its turned off. There is a trace on the board that runs from pin#2 to U2 which is empty. If you look under a magnifying glass you can see it. Solder your pwm signal to the thrid pad down on the left where the trace leads to. Manne also helped me find this. I did not see it until i used the magnifying glass.

For the pwm I used a old trusted 555 timer circuit. It can be found here. Its the bottom circuit for leds. ONLY USE everthing to the left of the npn transistor as you are only after the pwm signal. Get the circuit working first, you can use one 5mm led with a series wired resistor just to make sure you have got your pwm circuit right. I didn't have a 50k linear pot so I used a 100k linear pot. The only modification I made was change the resistor r2 (1k) to a 47 ohm. It would not work with the 1k. Update! It may work now with the 1k resistor, now that the Vcc is not connected to dim pin. When i tested this i did not have the Vcc disconnected from pin#2. Which made the 555 timer and the QX5241 fight for high and low. It still worked but is was not the correct way to do it. This is why you remove the 000 resistor.

Yes the 8 pin chip is a fet. (AO4418) look at the datasheet here, this fet can handle upto 30v and 9.7 amps. Most all of the parts on this board will accept higher voltage than 7.4v. If you change the caps on this board for higher voltage ones I think you could go way beyound 7.4v. If you wanted higher current than 3 amps you could change out the ss34 diode for a more amperage one or maybe parallel another ss34. I may get around to testing that one day. 7.4 volts suits me fine right now. To parallel the driver you would have to run another pwm wire from one board to the other. I have not tested it but it should work. Update: Tested two 20330'S in parallel driving a sst-50 at 5 amps. Works perfect with pwm.

Cost of driver (buy 3 or more) plus the other parts under $5.00 depends on were you shop. Time to build it, priceless!I was having fun! I found a electronic parts store online that sells all the parts cheap and ships here in the usa cheap. My order arrived 3 days later. I am in noway affiliated with them. Just trying to help everyone. If its not stepping on anybodys toes here, I will post the site if its okay. Just let me know. Thanks to all that keep this place running.


----------



## moderator007 (Apr 5, 2011)

I thought some pics might help out. Finally got time to post them.







Here is the PWM board I built For about a buck$.





Here's the back





Test bed setup. Thats a p7 led on a computer heatsink.





It works! This is with the pot turned all the way down. Seems to me to be about 50 lumens. Doesn't look that bright in person. Notice the camera hasn't began to adjust for the light yet.





This is about a half a turn on the pot. You can see the camera starting to adjust for the overwhelming light.





With the pot all the way up, full blast. Seems much brighter in person. Now you can see the camera has adjusted fully for the vast amount off light.





Custom mag that I machined on my harborfrieght 8x14. Soon to be a PWM varible brightness cree xm-l Maglite.





This has become my favorite driver for maglite builds.


----------



## moderator007 (Apr 5, 2011)

The soldering method has been updated for a better safer easier way. Special thanks goes to manne at dx forums for pointing this out.:thumbsup:


----------



## MikeAusC (Apr 16, 2011)

Thanks for writing up all your learnings - variable brightness Driver circuits aren't that common !


----------



## VegasF6 (Apr 16, 2011)

You haven't gotten a lot of feedback yet, great job on this. And thanks for sharing. I will put this on my to-do list. (after the other 75 things I still haven't done, hah)


----------



## moderator007 (Apr 19, 2011)

Thanks vegas and mike. Did some testing to see what this dealextreme driver could do in amperage. Seemed no one was interested so I never posted my findings.

Tested the sku 20330 to 3.37 amps and she kept on pouring out the power. At 1 min the amps had fallen to 3.3 and held that current up till about 40 min. This was with 2 black/flame trustfires. At 55 min she cut off. Still holding 3.25 amps until it cut off. All measurements were taken at the led. The batterys were depleted. She got pretty hot but is still working to date. I was going to try to push this driver even harder to see what would happen. But without some kind of heatsinking I felt this was about it. I would guess to say that in a flashlight it could be run at about 3 amps without any short term problems. Long term i dont know? Depends on the type of usage it was subject too. Not many people run there flashlight from fully charged all the way down to battery pcb turn off voltage in one setting like i did in the test.

I have built several maglites with this driver and the cree xm-l. The current on my builds were set at 2.7 amps by adding a 1 ohm resistor. None have returned with problems. Thanks again.:wave:


----------



## Chongker (May 27, 2011)

Thanks for the in depth look into this driver, have a couple on the way to me now for use in a 2*26650 host driving an XML. I think I'll probably change the 0.4ohm resistor for a 0.2 ohm one, which should give me 3A output? Thanks again for all the tips! Now if only getting stuff from DX was quicker...


----------



## Microa (Jun 2, 2011)

Excuse me. I have some doubt about the FET. I found the data sheet of SM5241 recommended the FET SPP3403 and SPP7407 are P-channel FET. But AO4418 is a N-channel FET. Would you please let me have your wiring diagram of the driver. I have just bought 5pcs each of QX5241 and AO4418 to start my project. Thanks in advance.


----------



## Microa (Jun 3, 2011)

Very interesting finding. The above thread links to LY5241 which uses N-Channel FET AP2306 or AP2310. The data sheet of SM5241 I have uses P-Channel FET SPP3403 or SPP7407. I need to find out whether LY5241, SM5241 and QX5241 are the same thing.


----------



## Microa (Jun 3, 2011)

I found the data sheet for QX5241 is the same as LY5241 using N-Channel FET AP2306.


----------



## moderator007 (Jun 4, 2011)

Hi Microa,
Sorry for the slow reply, my internet service has been down for a week. Seems like you found your answer to your question. The data sheets that i found were all in chinese. They were google translated. As for the ic used this was given to me by manne at dx. He had one that was not sanded off all the way. When i looked up the data sheet for the qx5241 i found a circuit that was almost identical to this board (dx20330). He had all the numbers for the FET visible AO4148. Now i cant be sure that they used the exact same ic and fet on all of the 20330 boards that they have made. As china manufactors will substitute componets from time to time.


----------



## Microa (Jun 4, 2011)

Hi Moderator, thanks for your reply.
I found that the LY5241 is supplied by ShenZhenShi LiYe Electronic Co., Ltd. the QX5241 is supplied by QX Micro Devices Co., Ltd. and the SM5241 is supplied by Semi Micro Co., Ltd. The marking 5241, The package SOT23-6 and the electrical characteristic are the same. So make sure you buy what you want. AP2306 rated 5A Ids is recommended for the reference circuit for 700mA driver. The manufacturer uses AO4418 which rated 11A Ids to handle the increased driving current of the 20330 boards. By the way, AO4418 is an obsoleted model. AO4466 is the recommended replacement by the FET manufacturer.


----------



## Microa (Jun 12, 2011)

If I am wrong, please correct me. The LY5241, QX5241 and SM5241 are the same IC. N-channel FET or P-channel FET are applyable to this circuit. In case of N-channel FET, the source is connected to the ground. For P-channel FET, the drain is connected to the ground.


----------



## moderator007 (Jun 12, 2011)

They do seem to be the same to me from what i got out off the china datasheets.


Microa said:


> N-channel FET or P-channel FET are applyable to this circuit. In case of N-channel FET, the source is connected to the ground. For P-channel FET, the drain is connected to the ground.


I believe you are correct.


----------



## Microa (Jun 18, 2011)

Many be I push it too hard with a 16V DC power supply. The FET and the inductor are very hot. I shall try to power it by 7.4V Li-ion battery to see if it is better.


----------



## Microa (Jun 18, 2011)

It is better now. Powered by 7.4V Li-ion battery pack, The temperature of the FET and the inductor are about 60 degree C at ambient temperature 26 degree C.


----------



## moderator007 (Jun 18, 2011)

You could also try 12 volts. 3 Li-ion's may be max.


----------



## Microa (Jun 18, 2011)

The inductor of the DX broad seems to be undersize. I use CD1005 size 22uH rated 2A and I set the LED current almost at 2A.


----------



## Microa (Jun 21, 2011)

Hi Moderator,

The PWM of my driver was tested workable. I would like to share with all the DIY folks in the forum. Excuse me for hijeting your thread.

The wiring diagram




The program for the MCU was borrowed from Tom. http://thebloughs.net/hobbies/electronics/bike_light/index.php
Because the original BuckPuck is OFF at logic Hi while QX5241 is ON. You need to modify the PWM duty cycle in decreasing order in bikeLight.C
PWM_HIGH 255
PWM_MED 190
PWM_LOW 60
PWM_OFF 0
something like that before you build the HEX files by the AVR Studio.


----------



## moderator007 (Jun 21, 2011)

Good work Microa. I think the attiny would be a much better choice than the 555 circuit for the pwm. I just havent crossed the hurdle yet of programming a avr. Do a google search for "How To Build a Flashlight With Perfect Modes" Tido's thread might have some great interest to you in taking this driver even further.


----------



## Microa (Jun 21, 2011)

I am a MCU dommy have just started to learn about it a month ago.


----------



## Microa (Jun 22, 2011)

Thanks Moderator. "How To Build a Flashlight With Perfect Modes" is informative and interesting. I have book marked the link.


----------



## Microa (Jun 23, 2011)

For those folks who don't need the pulse mode, my dirty hack of the codes is




[/URL]


----------



## Microa (Jun 24, 2011)

I changed the inductor to CD1005 10uH rated 2.6A. The maximum LED current was set at 2.1A with two 1206 R200 1/2W sensing resistors connected in parallel.

The component side of the PCB



The Attiny13A before hiden behind the push switch at the bottom side of the PCB



At OFF mode, the circuit consumes 1mA of current. You can see very dim lighted LED.



PWM_HIGH 255 at 2.1A



PWM_MED 60 at 510MA



PWM_LOW 20 at 180MA


----------



## Microa (Jul 19, 2011)

I have built a variation of this driver IC for Tido's LVD_0.4 program. The program which I complied was in 6 modes + last mode memory. It works prefectly well except that I have problem in complying PINSWITCH and MONITOR_BAT. It is fun to study and to look into his program.


----------



## moderator007 (Jul 20, 2011)

Hi Microa, Nice work. You come along way on this. Nice to see you have got the perfect modes up and running.
Do you program the attiny in circuit with a clip or do you program the attiny before you solder it on.
If you use a clip do you mind telling me which one or where to get it.
And which programmer do you use.


----------



## Microa (Jul 20, 2011)

Hi Moderator, I wrote the program to the chip before soldering it on the PCB. My programer is an AVRISP mkII clone and use AVR Studio 4.18 SP3 to comply the hex file and eep file from the source code.


----------



## Microa (Jul 20, 2011)

This is a program adaptor I made for Attiny 8S2 package.
There is a hole in the PCB beneath the chip which is used for pushing the chip out of the frame after the program is written.


----------



## Karl_MTB (Dec 2, 2011)

how shall I connect 555 with the LED driver
from R2 to "PWM in here" and pins 2?


----------



## moderator007 (Dec 2, 2011)

Karl_MTB said:


> how shall I connect 555 with the LED driver
> from R2 to "PWM in here" and pins 2?


I am not sure I understand your question Karl MTB. In the picture in my post. You will need to connect a wire at R2 from the 555 timer circuit to where it says "pwm in here" on the driver. This is the signal coming from the 555. "Pwm in here" is just a easy place to solder rather than soldering to pin#2 on the QX5241. There is a trace that runs under QX5241 up to the solder pad that says "pwm in here".


----------



## Karl_MTB (Dec 2, 2011)

:thumbsup:


----------



## nickscott18 (Dec 2, 2011)

Thanks mod007, just read this thread, and its very useful information on altering this driver, but out of interest, you mention that most of the parts will take a higher input voltage, but will require the capacitors being swapped out. Have you had a chance to try this yet? If not, I'll be ordering one at some point and trying it.
Nick


----------



## moderator007 (Dec 3, 2011)

Never got around to modifing any further. I was building a variable brightness hunting light for a friend. When I got done with the light I never tested the driver any further. Built one maglite, the one in that thread. Driving a sst-50 with 2 20330 drivers wired parallel and the signal wire wired to both from the 555 for a variable brightness 5 amp maglite. There was information on the capacitor swap at dx I think.:thinking:


----------

