LED control circuit, would appreciate feedback and suggestions. - Page 1
Forum section: electronics / beginners

author: doublec4
author_rank: Regular Contributor
timestamp: June 11, 2019, 03:58:33 pm
content: Hi All,I previously created this post here:https://www.eevblog.com/forum/beginners/battery-powered-led-pwm-dimmer-circuit/which I did not want to continue with as this is taking a slightly different turn.Background:Previous thread was with regards to dimming a 12V LED module I have. When I took apart the module it turns out that it has its own programmable controller (running at 5V) that uses mosfets inside to flash the LEDs in programmed patterns, but it has no method of dimming the LEDs (it has a bunch of other components for vreg for the controller, current limiting resistors for the LEDs etc). Before taking apart the module I thought perhaps I could PWM the 12V power and dim the LEDs but I no longer see this working as I will likely just be rapidly turning the programmable controller on and off very quickly and messing with the flashing patterns.So that brings me to this post.Although the module nominal input is 12V, when I drop the input voltage using my power supply, there is no appreciable difference in perceived brightness down to 9V (current also drops from ~190mA to ~100mA). Below 9V I would estimate a 50% brightness drop when lowering input voltage to ~8.2V (current drops to ~25mA)So I have some 1n4002 diodes here and I believe on the datasheet it shows a forward voltage drop of 0.6-0.8V with current between 0.03A to 1A. If it put one in series with the LED module and run it at 9V I achieve the ~50% dimming I am looking for (voltage across the LED module should be in the ballpark of the 8.2V I'm assuming). If I used a ~30ohm resister in series instead of the diode I get roughly the same result as I am limiting the current.Here in lies my first question, by using a diode in series to drop the voltage, or using a resistor to further limit the current (since it already has resistors built into the module) what is the advantage or disadvantage to either solution?Second question, in the previous post, it was suggested to use a constant current LED driver but this was before determining all of the other components inside the module. I'm not sure what effect it would have trying to "push" a constant amount of current through the module with everything else going on in there?Third question, I actually have three of these LED modules in red, amber, white... which I would like to control individually (on/off). The brightness of all LED modules can all be tied together as I have no reason to run them at different brightness simultaneously. I came up with the following circuit (see attached) using MOSFETS for the ON/OFF and controlling the dimming with the diode as mentioned in my first question above. The red/yellow/white inputs from my controller would be normally low to turn off the lights, and then driven high to turn each of the colors on. A common dimming signal would be driven high so that path to GND avoids the diodes (or resistors, see question 1). Low signal on this line would put the diode/resistor in series to dim the lights. Does this look like it should work, or is there a better way to do it with less components?Thank you all for your patience with all of my questions... there are definitely some gaps to fill in my fundamental understanding of electronics.

author: doublec4
author_rank: Regular Contributor
timestamp: June 13, 2019, 11:27:50 am
content: Anyone willing to take a stab at it?Just to try and be more clear, I am only looking to achieve two discrete states with the LEDs. Bright and Dim, not a continuously adjustable brightness level. In the circuit I posted the LED components represent the LED modules I have. I did not remove the actual diodes from the modules or anything like that.Thanks!

author: DDunfield
author_rank: Regular Contributor
timestamp: June 13, 2019, 01:57:11 pm
content: I'm not sure that dimming the LEDs by providing lower than the specified voltage to the module is a good idea. You would have to do some reverse engineering to determine if this is reasonable or not.Assuming it is, some thoughts to consider:There will be some sort of regulation going on inside the device. The fact that you see no difference between 9V and 12V suggests that there might be a 9V regulator.The fact that the current drops as you lower the voltage suggests that it is a liner regulator (switching regulators should draw more current as input voltage drops).So the question becomes: What is happening below 9V.First thing I would do is check the controller to see what voltage it is actually running on. It is likely to be 3V or 5V so there might be another regulator. You want to make sure that the controller is getting a proper power source at the lowest voltage you intend to provide, otherwise the device may not be stable.Both a resistor or a diode would lower the voltage, the resistor due to voltage drop based on E-IR, and the diode due to it's characteristic voltage drop.In this application I think a diode would be better because it will have a relatively constant voltage drop.If you use a resistor, the voltage drop will change based on the current drawn, which will depend on how many LEDs are on at a given time. Assuming the patterns will have different numbers of LEDs on at various times, then the brightness will change as the pattern changes.You are correct in that you don't want a constant current driver in this case, again as pattern changes required current would change.Can you modify the module? It may be possible to bring out the controller supply and LED supply separately which would likely be the best way to accomplish this as you could fool with the LED supply without compromising the controller supply.Dave

author: madires
author_rank: Super Contributor
timestamp: June 13, 2019, 03:12:59 pm
content: Quote from: doublec4 on June 11, 2019, 03:58:33 pmThe resistor also creates a voltage drop. It's a quick and simple way to reduce the LED's brightness but it will waste power (heat). And color balancing for RGB LEDs would require some effort to find the best resistor values.Quote from: doublec4 on June 11, 2019, 03:58:33 pmIf you have resistors on the LED module, like on LED strips, go for constant voltage. Constant current is meant to drive an LED directly. Again, any resistor will waste power. Therefore driving power LEDs with constant current is more efficient.Quote from: doublec4 on June 11, 2019, 03:58:33 pmInstead of the second MOSFET and the diode you could add an logic AND to each driver MOSFET and control the brightness via PWM. For example, a 74HCT08 has four AND gates.

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 02:41:19 am
content: Quote from: DDunfield on June 13, 2019, 01:57:11 pmHi Dave, when I took apart the module I scraped off the epoxy and did some part number look ups to find what I was dealing with. I have them on my work computer so I can post them tomorrow, but the only regulator I could find was a 5V regulator (very small current output so it can only be for the programmable chip not the LEDs).From my (limited) experience with a few other "high power" LEDs I find that running them at their full rated current vs running them at lower currents there isn't an appreciable difference in perceived brightness. The brightness vs current does not at all seem linear. I feel like that is what is happening here... once you hit a certain threshold the brightness has a steep drop off. I'll check again for any components I may have missed but I didn't see any other regulator, just the MOSFETs for turning them on and off.As for the flashing patterns, each module has 6 LEDs and they all flash on and off together. The patterns are simply just different flash rates, no sequencing of individual LEDs or anything like that. So the resistor would see consistent current drawn as well if I went with that instead of the diode.The module is pretty tiny and the chips are all tiny SMT components... not saying that it would be impossible to do, but it would be tough to modify.

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 02:47:00 am
content: Quote from: madires on June 13, 2019, 03:12:59 pmWould the diode not produce some heat as well because of the voltage drop across it and the current flowing through it?As for the logic AND driving brightness with PWM, this is what I tried to experiment with previously.. since the LED module only has power and gnd pins, if I try to PWM the power to the module, the on board controller just gets rapidly turned on and off and doesn't respond... the lights behave erratically

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 01:39:55 pm
content: So to bring more clarity to this topic, I took a picture of the inside of the module (back of the board is unpopulated).Main components I could identify are as follows:Controller:PIC12F683[linkhttp://ww1.microchip.com/downloads/en/DeviceDoc/41211D_.pdf]http://ww1.microchip.com/downloads/en/DeviceDoc/41211D_.pdfLikely powered by 5V, 30mA regulator:ZXTR2005Z[linkhttps://www.diodes.com/assets/Datasheets/ZXTR2005Z.pdf]https://www.diodes.com/assets/Datasheets/ZXTR2005Z.pdfThere are two N channel MOSFETS:DMT6008LFG[linkhttps://www.components-mart.com/datasheets/82/DMT6008LFG-7.pdf]https://www.components-mart.com/datasheets/82/DMT6008LFG-7.pdfThere are 6 LEDs that I cannot identify... and what would appear to be 6 very small transistors (my guess as they have a 'Q' designation).I don't see any evidence of any other components like inductors that I have seen in switching regulators. Only small caps, resistors and a few diodes present.My initial guess was that the PIC controller is switching the larger MOSFETS to turn the LEDs on and off, but the coincidence of 6 LEDs and 6 smaller transistors is throwing me off. These light modules are intended for automotive use (emergency vehicle light bars etc)... so perhaps there is something going on to protect the LEDs from voltage spikes produced by the vehicle's electrical system.Let me know what you think !

author: madires
author_rank: Super Contributor
timestamp: June 14, 2019, 02:13:34 pm
content: Quote from: doublec4 on June 14, 2019, 02:47:00 amYep, it would be P= I * VfQuote from: doublec4 on June 14, 2019, 02:47:00 amThe PWM based brightness control is meant for the LEDs and not the complete module. Some modules have a PWM input for that purpose. If you want to modify the modules I'd suggest to reverse engineer the circuit first.

author: Zero999
author_rank: Super Contributor
timestamp: June 14, 2019, 02:19:25 pm
content: The smaller transistors are probably used as a MOSFET driver.PWMing the entire circuit will not work because it the MCU will have to restart every cycle. The LEDs will most likely be configured common anode. If you can disconnect the common anode connection for the LEDs and PWM that, it will probably work.

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 05:10:01 pm
content: Quote from: Zero999 on June 14, 2019, 02:19:25 pmThat was my thinking but... the brand of lights is Whelen if you guys didn't see the little label in the picture I posted. They have a programmable flashing module that apparently we just so happen to have here at my work... I was just playing around with it and it can dim the lights with only the power and gnd connected... I started prodding the power/GND connections with a Fluke 177 true RMS meter.My power supply is putting out 12VDC to the programming module... The readings I got at the output for the LED module for each brightness level are as follows:100% brightness --> 12VDC --> N/A VAC --> 200Hz AC --> 0Hz DC70% brightness --> 9.6VDC --> 3.8VAC --> 200Hz AC --> 0HZ DC50% brightness --> 7.5VDC --> 4.75VAC --> 200Hz AC --> 0HZ DC20% brightness --> 4.12VDC --> 4.33VAC --> 200Hz AC --> 0HZ DC0% brightness --> 2.7VDC --> 3.45VAC --> 182Hz AC --> 0HZ DCI set the meter to both AC and DC to see how the readings would differ. I'm wasn't sure if the AC setting would respond different to a PWM signal or not. I'm not experienced in taking these sorts of measurements but I did read that using the AC setting to check DC voltage would not damage the meter.Now where I am confused is that if I remove the module from the programmer and just wire it directly to my power supply and adjust the DC voltage to lets say 4.12VDC as was read for the 20% brightness... the LEDs do not come on. They turn off around 7VDC direct from the power supply... So when I took the above measurements, am I reading some kind of average 'ON' time from a PWM signal perhaps?And since I have the programmable module, before anyone suggests just using that... its quite large. Too large to fit into a portable device (it's meant for flashing/programming vehicle lights). I'll see if someone in my building has a scope to see if the programmer is outputting a PWM signal then?

author: Zero999
author_rank: Super Contributor
timestamp: June 14, 2019, 05:20:43 pm
content: Quote from: doublec4 on June 14, 2019, 05:10:01 pmThat's what you should expect to happen. 20% brightness will be 12V pulses with a duty cycle of 20%. The string of LEDs probably have a turn on voltage threshold of around 7V, so will not turn on, until the voltage exceeds that threshold.The meter is not measuring the peak voltage of the signal, but the DC component, i.e. the voltage you'd get if you averaged the signal.

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 06:43:49 pm
content: Got it on the scope ... see attached. So yes, with 12V supply and the programmer set to 40% brightness, there is a 200Hz frequency, 5ms period... 40% on timeSo now I have to revisit the 555 timer circuit to do thisMy last little bit of curiosity is this... when I first power on the LED module (no PWM), my power supply reads a higher current draw and then after about 5 seconds of being on, the LED modules settle at about 1/2 the peak current of when it was first turned on... Now when I PWM them at a lower brightness (ex: 40%), the current draw is still slightly higher than the "settled" current when I just directly connect the 12V supply to the module. I thought PWM should reduce current consumption since there is a considerable "off time?"

author: doublec4
author_rank: Regular Contributor
timestamp: June 14, 2019, 08:12:50 pm
content: For those still following...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...Thanks to all who helped!

author: Zero999
author_rank: Super Contributor
timestamp: June 14, 2019, 10:14:15 pm
content: Quote from: Jwillis on June 14, 2019, 08:33:14 pmWell no, because the LED module mentioned in the original post, already has a built-in current limiting resistor.With bare LEDs an additional series resistor would be required, but I hoped the original poster would have been aware of that, even though this is the beginners section.Quote from: doublec4 on June 05, 2019, 05:52:31 pmI've built that circuit before and it works perfectly. There are two things which I can think of that will cause this: the polarity of one of the diodes in incorrect or the potentiometer is bad.The frequency is fixed and depends on the RC time constant.Assuming the potentiometer has a much higher resistor compared to the 1k connected to pin 7.F = 1.44/(RC)Quote from: doublec4 on June 14, 2019, 08:12:50 pmThat circuit is very similar to the one I posted, except it has a fixed duty cycle and if that's acceptable, then good.

author: doublec4
author_rank: Regular Contributor
timestamp: June 16, 2019, 03:13:28 am
content: Thanks Zero999I was going to use your circuit to find the "sweet spot" with the pot and then just measure the resistance once I had a suitable duty cycle.I think maybe the module is somewhat sensitive to the frequency. I'm not sure how to calculate the frequency in your schematic , but perhaps it was too high for the module.

author: Zero999
author_rank: Super Contributor
timestamp: June 16, 2019, 03:39:16 pm
content: Quote from: doublec4 on June 16, 2019, 03:13:28 amI did say how to calculate the frequency, perhaps I wan't clear about what the variables in the formula relate to.F = 1.44/(RC)Where:R is the resistance of the potentiometer, in OhmsC is the capacitance of the timing capacitor between pins 2 and 6 and 0V, in Farads.F is the frequency.This is assuming the potentiometer has a much higher resistance, than 1k.So in the circuit I posted.C = 10nF = 10×10-9R = 100k = 100×103F = 1.44/(10×10-9*100×103) = 1.44/(1000×10-6) = 1440HzSo if you want 200Hz, increase the capacitor value to 68nF, which will give about 210Hz, which is as close as is feasible given component tolerances.

author: doublec4
author_rank: Regular Contributor
timestamp: June 18, 2019, 01:30:59 pm
content: Quote from: Zero999 on June 16, 2019, 03:39:16 pmThank you! Perhaps I will try this circuit again with the modified cap to lower the frequency and see what happens!