Battery powered LED PWM dimmer circuit - Page 1
Forum section: electronics / beginners

author: doublec4
author_rank: Regular Contributor
timestamp: May 22, 2019, 05:19:26 pm
content: Hi All,I have two LED modules that were designed to run at 12V. They consume ~200mA each. I would like to run my LED lights from 3 18650 batteries wired in series to produce a total of 12.6V peak and probably have a cutoff somewhere around 9V. When I hook up my LEDs to my adjustable power supply and run them down to ~9V there is no appreciable change in brightness.Therefore, I am looking to run them either full brightness (seems straightforward, run them right off the batteries...) or half brightness at the flip of a switch (think car tail/brake lights). The dimming part is where I am having some difficulty as I would like it to be efficient (PWM rather than constant current?) and simple. I have seen various circuits using 555 timer as the PWM pulse going to a transistor base but I'm not sure if this is efficient? I would like to get the most out of the battery life if possible.Any guidance on what to look for in terms of achieving efficiency or candidates for circuits would be helpful.Thank you!

author: mariush
author_rank: Super Contributor
timestamp: May 22, 2019, 06:08:09 pm
content: How about you use a proper LED DRIVER IC?Seehttps://www.digikey.com/products/en/integrated-circuits-ics/pmic-led-drivers/745for examples.Plain leds are not controlled by voltage, the brightness is controlled by varying the amount of current going through the LED. There is a minimum forward voltage required for the LED to turn on, and there's a very narrow region of voltage where the LED may not be fully turned on, like let's say between 9v and 9.5v but once you go outside that region you must limit the current otherwise the led would be damaged.The most basic way to limit current is by placing a resistor in series with the led, so that's what you may have on your "module".A led driver IC starts with a low voltage and slowly ramps up the voltage until the leds connected to it start to light up and current flows through the LEDs ... a resistor is used to monitor the current and the led driver will constantly adjust the voltage up and down to maintain the current flowing through the leds at the level set.Here's an example of a very efficient led driver IC :https://www.digikey.com/product-detail/en/diodes-incorporated/AL8860WT-7/AL8860WT-7DICT-ND/6226981See page 2 of the datasheet where you can see how simple the circuit is:https://www.diodes.com/assets/Datasheets/AL8860.pdfYou can set the maximum brightness by setting the maximum current (200mA) with a resistor, and then you can use the CTRL pin to adjust brightness easily.For example, for the chip linked above, the maximum current is set with the formula Iout = 0.1 / Rs ... so Rs = 0.1 / Iout.So, for 200mA you'd need Rs = 0.1 / 0.2A = 0.5 ohm, for 100 mA you'd need 1 ohm and for 50mA you'd need 2 ohm .... so you could have 0.5 ohm + 0.5 ohm + 1 ohm in series....50mA : leave everything as is100mA : use a switch to short out the 1 ohm resistor ... you're left with 1 ohm so you get 100mA200mA : use switch to short out 0.5 ohm + 1 ohm, leaving you with only 0.5 ohmOr, if you only need 2-3 thresholds/levels of brightness you can place multiple resistors in series which in total give you the resistance for the worst case scenario (maximum current) and then you can use a switch to short out particular resistors in the chain, reducing the overall resistance.Drive to voltage below 0.2V to turn off output currentDrive with DC voltage (0.3V < CTRL< 2.5V) to adjust output current from 0 to 100% of IOUT_NOMDrive with PWM signal from open-collector or open-drain transistor, to adjust output current.Linear adjustment range from 1% to 100% of IOUT_NOMfor f < 500HzSo for example the easiest super simplest would be to send a voltage on the control pin between 0.3v and 2.5v to adjust brightness.The cheapest LM317 or 1117 linear regulator can get you 1.2v ...2.5v which should translate to 55%...100% of maximum current.You can use a potentiometer instead of the adjustment resistor to set the voltage between 1.2v and 2.5v

author: Buriedcode
author_rank: Super Contributor
timestamp: May 22, 2019, 08:42:31 pm
content: In terms of efficiency, driving the LEDs at 50% means... 50% power consumption.. but would cost at least a bit of power for the PWM circuit. For a 555 timer circuit, which is cheap, will happily run from 12V, you're looking at ~10mA plus whatever is required for the switching element. Most 555 circuits have limited adjustment for duty cycle, but as "brightness" is non linear, the top 80-100% will pretty much look the same, and <20% would probably be quite dim.I would experiment with frequency and duty cycle to see what is acceptable. For low duty cycles, one can notice flickering, especially with the lights being the only light source in a dark area, or in peripheral vision, at 1kHz and sometimes higher. But at higher frequencies, >10kHz, using a MOSFET to switch the LED's uses up power just switching (google, MOSFET switching losses and gate charge). So its a compromise.Once you have an idea of the duty and frequency, then you can work on making it efficient. But even with the above setup, with 200mA LED's, run at 50% duty, thats an average of 100mA. +10mA for the circuit means <10% of the current draw will be the switching circuit. A CMOS schmitt trigger RC oscillator driving a MOSFET will be pretty low power, but again you're only getting an extra 10% battery life by optimizing that part, where-as if you find you can get away with a duty of say 20% then you've saved 80%.I don't know if you're a beginner, hobbyist or what, but if you are, I would start off with the 555, experiment, then optimize later.

author: Zero999
author_rank: Super Contributor
timestamp: May 23, 2019, 10:20:01 am
content: A simple 555 timer circuit will do the job. You could use a potentiometer with a switch in series with the whole circuit to make sure it turns fully off, drawing no power.

author: doublec4
author_rank: Regular Contributor
timestamp: May 23, 2019, 01:51:03 pm
content: Quote from: mariush on May 22, 2019, 06:08:09 pmThanks for this!I guess one challenge is that my battery is 12.6V fully charged and goes down to 9V before cutoff. Therefore, the IC cannot step down the voltage to the ideal 12V as the battery level drops below 12V...I would have to find a higher voltage battery, or as I understand it would stress the LEDs but I suppose I could find the current at which they run at ~9V and set the max current to this value. Then the IC would maintain this current and drop the voltage to ~9V to the LED to make this circuit work.

author: doublec4
author_rank: Regular Contributor
timestamp: May 23, 2019, 01:55:32 pm
content: Quote from: Buriedcode on May 22, 2019, 08:42:31 pmThanks! I would consider myself a beginner on the subjective / relative scale of expertise. I've tinkered with electronics, built some basic things, programmed some micro controllers and made a few PCBs. Compared to the average person, I would think I understand more, but compared to many of you on here I am certainly a beginner. Lots to learn!I will likely take Zero999's circuit below and breadboard it and experiment a bit to start.

author: doublec4
author_rank: Regular Contributor
timestamp: May 23, 2019, 02:12:43 pm
content: Quote from: Zero999 on May 23, 2019, 10:20:01 amThanks!I'll give this a try first and breadboard it. I'll likely switch the pot to a single value resistor to find a suitable "dim" value.Now because I would like to use a ON-OFF-ON slide switch to achieve the discrete bright / dim modes, is it possible to use the switch to switch the GND points?One switch position would connect the GND of this circuit to the BAT- , and the other position would short the negative side of the LED to the battery GND, skipping the IRL540N so that it runs at full brightness? The middle position of the slide switch would just disconnect the BAT- completely from the circuit leaving everything completely off.It makes sense in my head but maybe I am probably overlooking some detail...

author: doublec4
author_rank: Regular Contributor
timestamp: May 23, 2019, 03:34:57 pm
content: Also, when it comes to the switching MOSFET, I'm assuming it is the sum of the turn on, rise, turn off, fall times that governs how fast these can be switched?The reason I ask is that I have a few of these MOSFET relays laying around on breakout boards:https://omronfs.omron.com/en_US/ecb/products/pdf/en-g3vm_61g_61vy1.pdfBut it seems that their turn on / turn off times are measured in ms whereas something like the IRL540N has its time measured in ns ... it would seem the relay is much, much slower and perhaps would not be a good choice to try and switch so quickly (all other parameters being ignored).

author: Zero999
author_rank: Super Contributor
timestamp: May 23, 2019, 09:23:19 pm
content: Quote from: doublec4 on May 23, 2019, 03:34:57 pmThe MOSFET relays are much slower than ordinary MOSFETs because they're normally a couple of MOSFETs, connected to a solar cell with an LED next to it. The solar cell only produces a tiny current, so the gate capacitance is charged very slowly. The off time is a bit faster because there's a circuit which helps to discharge the gate, when the LED turns off.I would not recommend using a MOSFET relay for a PWM circuit because they're normally not fast enough.

author: mariush
author_rank: Super Contributor
timestamp: May 23, 2019, 10:01:10 pm
content: Quote from: doublec4 on May 23, 2019, 01:51:03 pmThere are LED driver ICs which can work in SEPIC mode (step down or step up, as needed), here's a list that could be your starting point:https://www.digikey.com/short/p4fmdwHere's a good example from that list, 8v..40v in, but max. 150mA : allegro-microsystems-llc A8513KLYTR-Thttps://www.digikey.com/product-detail/en/allegro-microsystems-llc/A8513KLYTR-T/620-1441-1-ND/2812930Read datasheet on that page, it's full of details, including how to do analog dimming or PWM dimming.Another great example, 3 x 100mA driver : texas-instruments TPS61193PWPRhttps://www.digikey.com/product-detail/en/texas-instruments/TPS61193PWPR/296-47296-1-ND/7688306(3 channels, you can have one led or strings of leds per channel, up to 45v and 100mA)

author: sokoloff
author_rank: Super Contributor
timestamp: May 26, 2019, 12:42:39 am
content: Do these LED modules have their own driver circuitry already? If you can hook them up to a widely varying DC voltage and get a constant amount of light out of them, it seems likely that they do.What you might need/want to do is open the module, figure out what driver it's using and see if there's a PWM pin on the driver IC already and send a square wave (with the right duty cycle) for the half-bright setting and send an always-on for the full bright setting. If there is a driver IC module and some amount of local capacitance on the module, you might not be able to effectively dim it by just feeding the power input with a PWM signal.

author: tooki
author_rank: Super Contributor
timestamp: May 26, 2019, 06:40:08 am
content: As someone who is sensitive to flicker and finds many PWM-dimmed tail lights to beextremelydistracting when driving, I implore you to not use anything with a low PWM frequency (like under 10 KHz).IMHO, the easiest way (which I wish more auto makers would use) would simply be to have the LEDs electrically divided into two banks (e.g. 1/3 and 2/3) that you can switch on and off independently, giving you a few discrete total brightness levels while requiring no active circuitry whatsoever. You would just distribute the LEDs of the two banks evenly within your LED array.

author: doublec4
author_rank: Regular Contributor
timestamp: June 05, 2019, 05:50:03 pm
content: Just to follow up on this thread. I took apart the LED module and it appears to have 3 main components responsible for operation of the LEDs.1. There is a 5V regulator transistorhttps://www.diodes.com/assets/Datasheets/ZXTR2005Z.pdf2. The regular transistor (because of the low current) is likely powering the PIC chip that I identified as:http://ww1.microchip.com/downloads/en/DeviceDoc/41211D_.pdfThis chip is responsible for the pre-programmed flash patterns (single brightness, none of which are dim) that are selected by pulsing 12V momentarily to a third wire coming out of the module.3. There are two MOSFETS driving the LEDs identified ashttps://www.components-mart.com/datasheets/82/DMT6008LFG-7.pdfSo when I hook up the module to the PWM circuit, nothing happens as I'm probably just turning the PIC chip on and off really fastBut when I connect the LED module to my power supply and vary the voltage, the unit starts to dim noticeably around 9V and by 8V it appears ~50% brightness.Using the multimeter in series to measure current draw, the when the module first turns on there is a spike up to 400mA then it quickly settles around 190mA draw at 12VDropping the voltage, the current decreases with voltage drop. At 9V it reduces to about 100mA, then at 8V it is only ~25mASo in this case PWM is not working and varying voltage does, but I imagine I am stressing the LEDs this way?

author: doublec4
author_rank: Regular Contributor
timestamp: June 05, 2019, 05:52:31 pm
content: Quote from: Zero999 on May 23, 2019, 10:20:01 amAlso, I tried this circuit for fun with some regular 5mm LEDs that I had on hand... I could only get them to very faintly light and then ever so slightly dim. It seemed as if the adjustment range of the pot was extremely narrow.

author: Audioguru
author_rank: Super Contributor
timestamp: June 05, 2019, 07:25:09 pm
content: Which circuit is correct?Do these circuits both work?

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 07:21:11 pm
content: Audioguru, they look like the same circuit to me... the pot and diodes are flipped upside down but they should have the same effect, no? As for no inline resistor with the load, I put one in line with some 5mm LEDs and built this circuit. Worked fine although it seemed I had a very narrow range of operation on the potRevisiting this circuit... I can seem to find lots of info online with the "standard" 555 timer PWM circuit with some variability on the duty cycle and a fixed frequency. However, in the circuit posted here, how would I go about calculating the frequency?Thanks!

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 08:13:56 pm
content: To wrap up this thread, end result was as follows:I ended up with an acceptable dimmed state by using this calculator/circuit:https://houseofjeff.com/555-timer-oscillator-frequency-calculator/Put in my required 200Hz frequency... ended up with the following values because I had them on hand to breadboardC1:0.01 µF R1:56 KΩ R2:330 KΩ Period:0.005 sec. f:201.5363 Hz. Duty Cycle: 53.9 %Was still kind of bright... found this info here:https://electronicsclub.info/555astable.htmPut a diode in parallel with R2 and the dim state looks great. Looks like the frequency is somewhere around 300Hz + (have to scope it again) but it works...Edit: Thanks to all who helped!

author: Jwillis
author_rank: Super Contributor
timestamp: June 14, 2019, 08:33:14 pm
content: Quote from: Audioguru on June 05, 2019, 07:25:09 pmBoth those circuits will burn out the LED . A limiter resistor is still required for the LED to keep it below its maximum current tolerance.