9VDC + 5VDC SMPS for driving LEDS - Page 1
Forum section: electronics / projects

author: Blade2Raiden
author_rank: Newbie
timestamp: February 09, 2020, 07:42:36 pm
content: Hi, I'm trying to find information as how to build a switching power supply that can output 9VDC to drive LED's but it must have at least 3 AMPS on this rail and a 5 VDC for logic board that will control the unit.I intend to replace the Tube lamp from a desk magnifyer with a pcb. The LEDS I found out to suit my needs are the Bridgelux BXEN-50S-13H-9C-00-0-0 (9V 0.1A), and I wanted to put 30 of them on the Ring which means 3A minimum. Logic board will be simply an Arduino Nano (ATMEGA128P) to be able to control over PWM the LED's, I've been thinking of using EPC2203 to supply the LED's, I'll see about that later on in the design process.Big thing is I've never built a SMPS ever before, I have the skills to build one but never learnt how they worked, so I hope people on here can help me out understand how to get this right. Maybe provide basic schematics and how to do the math that goes with it,Thanks for any help!

author: will_raymo2000
author_rank: Newbie
timestamp: February 09, 2020, 08:03:33 pm
content: I have designed a constant current driver PCB based on the AL8843 chip which is capable of 3A max. Am currently troubleshooting a layout issue but am happy to share design with you in Eagle format.Further to the post here:https://www.eevblog.com/forum/projects/al8843-led-driver-problems/I have now got both PCBs working and not killing LEDs with voltage spikes.Not sure if thats suitable for your application as its CC not CV.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 09, 2020, 08:21:36 pm
content: design is quite simple, I like it, but I'm going from main source so 120VAC, so I'd need something to step-down first and a transformer might be too heavy and probably won't output enough power for my application, I'm wondering if there's IC's powerful enough for that (well I think so after LED light bulbs work this way), 3 amps is my minimum though and I must be able to add a 5VDC output, that's where I'm quite lost

author: will_raymo2000
author_rank: Newbie
timestamp: February 09, 2020, 09:52:54 pm
content: I went through a similar process and ended up selecting a Mean Well chassis mount power supply as it was more of a robust solution (and cheaper) to something I could make myself. Here in the UK a 6.5A 12v mean well supply is about £11.50 which would accept your mains voltage too - worth a look. Then you can use a switching regulator chip for the 5V part and use a circuit similar to mine to run the LEDs

author: Mr Evil
author_rank: Regular Contributor
timestamp: February 09, 2020, 10:38:49 pm
content: Are you sure you need that much power? 27W of LED lighting is a lot. Half that much will light an entire room very brightly.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 09, 2020, 11:36:52 pm
content: Keep in mind that those LEDs are current driven, not voltage driven. The datasheet shows the Vf as 8.8V to 9.6V. (Unless you get one of the the binned versions.) If you hook them up to a constant voltage source then you may wind up either driving them too hard or not hard enough.Unless you're set on building your own switching supply, one possible solution is to get an inexpensive 30VDC 1.5A to 2A power brick and do something like the attached. If you are going to use 30 LEDs then everything in the schematic to the right of the 30V supply would have to be duplicated 10 times but none of the components need to be particularly expensive, high power, or precise. The sense resistor / BJT pair (R1 / T1) may need some special attention however to get the correct current dialed-in.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 12:04:34 am
content: Ok, I assess about 30W of LED's might be extreme, but on the other hand I want it to be very diffuse, might need a plastic lens for that, so if I lower down by Half and go with 15 LED's instead (5 set of 3 LED) lowering the current to 1.5A.I had in mind doing a little program on arduino and use a rotary encoder to adjust PWM output sent to a Transistor to light up the LED's but is it easier to drive with current instead? and if so what kind of IC's should I use for that matter?I'll buy a 30V 2A Switching instead, good idea!

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 01:28:02 am
content: You can drive the circuit I posted with PWM from a MCU. The duty cycle would have to be inverted if you use it as shown. That is drive it with a 70% duty cycle to turn the LEDs on 30% of the time.If you are making just one of these and you use a 30V supply then another thing you can do is string 3 LEDs in series along with a hand picked resistor (nominal 27, 1/2 Watt) and then tie all these strings to either a logic-level N-channel mosfet or an NPN BJT (of sufficient power rating.) You can then drive the MOSFET/BJT with PWM from the MCU.Also, if you need the MCU only for PWM then you could instead use a 555 timer for the PWM. Dave had a video where he does pretty much what you are wanting to do. (Although it looks like he switches the LEDs from the high-side.)

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 04:54:03 am
content: So things going into place, I'd use a D/A converter to drive the current of the LED's over a MMBT2222A-7-F on the ground side, so I can let go the PWM method.Design would look something like this,30V---R1---D1---D2---D3---Q1---GNDR1: CRGCQ1210F27R (27OHM, 1/2W)D1-2-3: BXEN-50S-13H-9C-00-0-0 (9.1V, 0.1A)Q1: MMBT2222A-7-F (0.6A Ic)5 times this circuit, D/A is to be determined, but it need to be able to output a good amount of current to drive 5 circuits or I'll have to change for PNP configuration.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 05:19:38 am
content: If you are going to use a MCU and put R1 between Q1 and GND then you can get feedback regarding the amount of current flowing through each string by sensing the voltage across R1 via the MCU's ADC.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 06:49:49 am
content: Quote from: blueskull on February 10, 2020, 05:23:39 amI'm an electrician. I don't "fear" 120V, I know how to work with it.12V 2,5A would be enough, you're right and it would simplify parts needed but how do I current drive 1,5A? That's a little harder to achieve, a TO220 transistor maybe? If you know a good one tell me.

author: tooki
author_rank: Super Contributor
timestamp: February 10, 2020, 04:17:04 pm
content: Quote from: TerminalJack505 on February 10, 2020, 01:28:02 amFWIW, I have had MUCH better results with this LM393-based PWM dimmer than with any 555 dimmer I’ve tried:https://www.electro-tech-online.com/articles/simple-pwm-circuit-for-lamp-dimming-etc-improves-on-555-pwm-circuits.797/I built the circuit without the CD4050, configured for ~20KHz switching, with the PWM output feeding directly into an IRL540N MOSFET. It handles the 12V/1A load I have without even beginning to get warm, and testing at 5A with a tiny heatsink still produces absolutely negligible warming.What I like about this circuit is that it allows FAR better dimming down to low levels.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 04:40:01 pm
content: For those who haven't read all the answers these LED's are current driven so any FET transistor won't do, It'll have to be Bipolar I have access to MMBT3904 and MMBT3906 at work but I don't know their specs yet I'll need to look that up back at home

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2020, 04:46:36 pm
content: PWM control is fine here. You could also consider controlling the supply itself, but then you'd want an independent 5V supply so the MCU isn't browning out at light loads or anything (also could be something of a chicken-egg problem, say if the MCU commands the 9V supply to enable in the first place).Definitely get a COTS module. It's not just about safety, it's about performance, reliability, RF emissions -- they've already checked out and solved all those issues for you, the value is very good.Strictly speaking, you should spend a good $10k+ putting your own supply design through testing; now, also strictly speaking, that only matters if you intend tosellit, so if you're running a one-off, who cares, right?But keep in mind, anyone whose radio spectrum you're stomping on, takes legal priority, and it is their right to prompt the FCC to send C&Ds or fines to you.It's also simply polite to not throw out noise.And to use something UL-approved, so no one loses insurance in case the thing starts a fire (whether this is your own house, an apartment shared with others, or a place of work).Tim

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 04:57:17 pm
content: Tooki, nice looking project. Yeah, that would be a good option for generating the PWM as well.Dave swapped pins 3 and 7 (discharge and output) on his circuit and got a duty cycle range of about 1% to 99%. Dave's circuit was running at about 400Hz, which seems like a reasonable frequency for lighting.At 20kHz, I'm surprised the MOSFET in your circuit doesn't get hot without using the 4050 to drive the gate.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 05:12:51 pm
content: Quote from: Blade2Raiden on February 10, 2020, 04:40:01 pmThere seems to be some confusion here. The LEDs will need to be driven from a constant current source (as opposed to a constant voltage source) but that doesn't mean you can't use PWM.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 05:13:00 pm
content: Quote from: T3sl4co1l on February 10, 2020, 04:46:36 pmYes, I was going for a 30V 2A PSU so I can put LED's in series of 3 then control them, but for it being driven with PWM I'm a little lost, there's another one who told up there it was current driven so I'm not fully certain to understand

author: mariush
author_rank: Super Contributor
timestamp: February 10, 2020, 05:39:37 pm
content: First of all, you don't want a 9v power supply.Because the forward voltage of the leds is 8.8...9.3v , you want a power supply that can provide a bit more than 9.3v (unless you use a more expensive BOOST led driver).I would go with either a 12v or a 24v or a 36v power supply, because they're common voltages and chances are they'll be stocked in higher quantities and they're cheaper. A 24v psu would allow you to make groups of 2 leds in series and therefore you'd get less current, same for 36v (make groups of 3 leds)There are wall warts with these voltages and they're cheap, so you could simply have a standard barrel jack connector on the thing.8$ : 24v 30w:https://www.digikey.com/product-detail/en/tri-mag-llc/L6R30-240/364-1280-ND/76826438$ : 36v 30w:https://www.digikey.com/product-detail/en/tri-mag-llc/L6R30-360/364-1780-ND/76815309$ : 12v 30w:https://www.digikey.com/product-detail/en/qualtek/QFWB-30-12-US01/Q1182-ND/8260130There are lots of led driver chips which allow you to control the brightness either by using a potentiometer or by using a pwm signal from a chip.Some examplesAL8443QSP :https://www.digikey.com/product-detail/en/diodes-incorporated/AL8843QSP-13/31-AL8843QSP-13CT-ND/10668311It can do up to 3A, so you can use it with 12v (0.1a x 30= 3A), 24v (1.5A), or 36v (1A if you wire 3 leds in series)See page 2 of the datasheet for example circuit and explanation for each pin :https://www.diodes.com/assets/Datasheets/AL8843Q.pdfYou set the maximum current with the resistor, and then you can either send a pwm signal on the CTRL pin, or use a potentiometer to adjust brightness)Monolithic Power MP24833 :https://www.digikey.com/product-detail/en/monolithic-power-systems-inc/MP24833-AGN-Z/1589-1591-1-ND/9433357Up to 55v , up to 3AAllegro A6211 (up to 48v, up to 3A, dimming with pwm signal) :https://www.digikey.com/product-detail/en/allegro-microsystems/A6211GLJTR-T/620-1477-1-ND/3597453Other examples:up to 2A of current:https://www.digikey.com/product-detail/en/diodes-incorporated/PAM2863ECR/PAM2863ECRDIDKR-ND/4505541You can power an arduino or pic microcontroller or whatever using a plain linear regulator that can tolerate the voltage you choose (ex if you decide on 36v, then choose a HV version that can tolerate 42v or 60v max.)

author: tooki
author_rank: Super Contributor
timestamp: February 10, 2020, 05:42:12 pm
content: Quote from: TerminalJack505 on February 10, 2020, 04:57:17 pmThanks for the kind words.For the sake of flicker-sensitive folks like me,for the love of goddon't use a PWM frequency in the hundreds. That's plainly noticeable (and highly distracting/annoying) to us, especially at low duty cycles. (Google the "phantom array effect" to understand why frequencies far higher than 60Hz are needed. FYI, some scientists have calculated that to fully eliminate the possibility of visible LED flicker inallsituations, a PWM frequency of 35KHz would be necessary.) In practice, anything above around 3KHz is OK for stationary objects/humans, but since that's an audible frequency, I recommend going higher, so it's unlikely to squeal.I'd have to try and measure how low mine goes on the oscilloscope, but what I can tell you is that depending on the use case, 1% duty cycle may be way too high. A frequent problem with dimmers is that at a few %, they just turn off. But because human sensitivity to brightness is highly non-linear (we arefarmore sensitive to small changes on the low end than on the bright end), 1% increments are plainly visible. The LEDs I'm dimming, I often want very dim, less than what I was able to achieve with 8-bit PWM on an Arduino (never mind the lousy PWM frequency). That's just 1/256 duty cycle!Quote from: TerminalJack505 on February 10, 2020, 04:57:17 pmI was also surprised at how little heat it produces. Like, I expectedsomeheating, but this produces so little that I suspect it'd be happy as a clam even without a heatsink (or just bolted to a case or PCB)! It's a logic-level MOSFET, so at 12V, it's definitely turning fully on (44mΩ RDS(on)), but I guess with being logic-level, even when it's only partly on, it's still super low RDS(on)(at 4V, it's still only 63mΩ). Had I realized it'd run SO cool, I might have even tried a higher frequency like 30-40KHz.As it is, the incandescent bulb in the switch (despite being run at half its rated current, thanks to the dropper resistor) produces seeminglyallthe heat in the enclosure.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 06:34:27 pm
content: If you use a 30VDC PSU here's another way to drive the LEDs. (The LEDs are being simulated with 1 Watt 9V1 Zeners diodes.)The real-world results obviously won't be as precise as the simulation since the real-world transistors will have variations that the simulation doesn't reflect but you can likely get each of the string's current pretty close to the nominal current rating for the LEDs.Although not shown this could be driven by PWM simply by putting a MOSFET or BJT on the low side.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 10, 2020, 07:59:35 pm
content: Thanks a lot mariush! I'll try putting most of that into design and post what it'll look like to see what you think about it!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2020, 08:29:36 pm
content: Indeed R2 can be driven from a logic pin instead of +30V; adjust its value to maintain similar current.Tim

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 09:12:27 pm
content: Quote from: T3sl4co1l on February 10, 2020, 08:29:36 pmGood point! You wouldn't need a high-power resistor in that case. The MCU would need to be able to source ~20mA, however. At least according to the simulation.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2020, 11:08:49 pm
content: Should only need a mA per transistor base, tops (more like 0.5-0.3mA average case), then a little extra taken up by the series diodes, so I was guessing 10mA total. But that's fine too.And if it turns out even more bias is desirable, the logic pin can be buffered by an emitter follower, and an even lower value used (like 100 ohms).Doesn't really matter either way; the excess current should just be wasted in the diode. More diode bias makes the circuit more stable against crosstalk, but only in a brute force sort of way, not really enough to keep things going if one channel drops out.Which, on that note: if an LED string goes higher voltage or open circuit, that channel will saturate. And without much C-E current to keep the emitter voltage up, the B-E junction pulls down the bias supply. Which dims all the others.This can be mitigated by driving more bias, but as I said it's a rather brute-force way. If we, say, use a modest series base resistor on each transistor (100-470 ohms say?), then turn the double-diode into an emitter-follower-boosted source (in the same way you would boost a current mirror against the same saturation crosstalk condition; not a Wilson current mirror, but another one of those 3-transistor mirror variations, I forget if it's named?), we can source the extra current on an as-needed basis.Finally, note that a string going short will drop a lot more voltage across the transistor, cooking it pretty quickly (quickly, in terms of surviving one,maybetwo failed LEDs in that string). Expect the cooked transistor to fail as a 3-way short, so, bringing the base voltage up for everyone and making the whole thing cook. Possibly, the supply will brown out through the offending string, for which it's nice to have a current limiting SMPS powering everything.But that's not at all a game-changing revelation -- indeed, it's very nice that this has room to sustainsingle LED failures. If a single LED drops 3V, then shorting one causes the transistor's dissipation to rise from, say, 100mW to 400mW, which is sweaty for a TO-92 or SOT-23, but quite survivable! (Put big thermal pours on the collector pad. Can also opt for a SOT-89 or SOT-223 for a higher dissipation rating.)If you really wanted, you could even add some diodes and a common fault monitor / detector circuit to get an instant checkup on its health, as it were. But being that this is visual, I'm guessing it'll be easier to peek at it and spot missing LEDs or strings. No further engineering required.Tim

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 10, 2020, 11:38:02 pm
content: Hmm... I didn't give too much thought about the different failure modes of that circuit. I did check to see what would happen if one of the strings went open circuit and the the current in each of the others dropped to about 50mA.That's probably not the best circuit for either home brew or production.The original circuit I posted has independent current control for each of the strings so it would be more robust--at the cost of using more components.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 11, 2020, 01:26:24 am
content: I don't mind it; it is what it is. The single-failure modes aren't perfectly robust (somethinghappens, other than the affected component), but total destruction is also unlikely. That's good design.Personally, I'd just ballast the strings with some series resistance each, then put them all in parallel, and switch the combined bank with a MOSFET for PWM (or vary supply if possible, or I guess both for highest dynamic range). The supply needs to handle a transient load, which isn't hard to do, and at a high enough frequency (some kHz), it's feasible to ride through the pulses with a little more output filter capacitance. If you're using a COTS supply, and find it tends to sing under such load, an RC filter between it and the load would do.Tim

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 11, 2020, 01:50:26 am
content: Yep. So long as the power losses are minimal then I think that is the way to go.

author: Blade2Raiden
author_rank: Newbie
timestamp: February 11, 2020, 03:27:34 am
content: @mariushAL8843Q would be perfect for this application, but now I started wondering on what to use for PWM, using the arduino nano would be too slow as some pointed out so if I were to use an I2C PWM generator such as the PCA9685 [https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf] would I be able to have a fitting frequency or is this too fast for the AL8843Q, I see they say up to 1MHz but it on the PWM input and output? unclear to me

author: mariush
author_rank: Super Contributor
timestamp: February 11, 2020, 09:23:12 am
content: Quote from: Blade2Raiden on February 11, 2020, 03:27:34 amJust goes to show you didn't bother to read the datasheet :See datasheet again :https://www.diodes.com/assets/Datasheets/AL8843Q.pdfPage 5tells you that 1 Mhz is the maximum switching frequency of the dc-dc converter. See fsw , fsw_MAX and tON_rec at the bottom of the table.Typically, the switching frequency will be much lower, in your case with let's say 24v in and 18v out and 1-2A, you're probably gonna see 200-250kHz switching frequency.Page 11gives you more details about the CTRL pin :Analog DimmingApplying a DC voltage from0.4V to 2.5Von the CTRL pin can adjust output current from10% to 100% of IOUT_NOM, as shown in Figure 1.If the CTRL pin is brought higher than 2.5V, the LED current will be clamped to 100% of IOUT_NOM while if the CTRL voltage falls below the threshold of 0.3V, the output switch will turn off.So :<0.3 v - OFF0.4v .. 2.5v = 10% .. 100%You could literally have a 2.5v linear regulator, followed by a potentiometer (which will behave like a resistor divider), giving you the ability to adjust between 0v and 2.5v.Even an adjustable linear regulator would work as long as its internal voltage reference would allow you to set the output voltage to as low as 0.3v..0.4v to turn off the driver completely if you want that.Alternatively, I suppose you could complicate your life by using a DAC IC, if the microcontroller you use doesn't have one built in.For example:https://www.digikey.com/product-detail/en/microchip-technology/MCP47FVB01A0-E-ST/MCP47FVB01A0-E-ST-ND/5033361The above gives you 8 bits, so if you use the 5v input as voltage reference, you have an output voltage of 0v..5v as a 0..255 number, so between 0.4v and 2.4v you have around 100 steps.The chip has a built in ~1.215v voltage reference which you can double to 2.44v through i2c commands, so you'd have 0v... ~2.42v as 0..255, almost ideal for the led driver.... but even the ~100 steps you'd get by using the 5v input as voltage reference would be enough.One fancy thing you could do is use a dual channel DAC and two separate led drivers and interleave the leds of the drivers so if you turn off one led driver, you get 50% of brightness with every other group of leds being lit at 100% (so potentially no flickering)This will also reduce the amount of power dissipated by the led driver which should be relatively small either way but hey, it only costs a couple dollars more or something like that.For example, seehttps://www.digikey.com/product-detail/en/microchip-technology/MCP47CVB02-E-UN/MCP47CVB02-E-UN-ND/9657660You get 2 outputs, 8 bits, just like the previous one, super easy to control through i2cPWM DimmingThe LED current can be adjusted digitally, by applying alow frequencyPulse-Width-Modulated (PWM) logic signal to the CTRL pin to turn the device on and off. This will produce an average output current proportional to the duty cycle of the control signal.To achieve a high resolution, thePWM frequency is recommended to be lower than 500Hz, however higher dimming frequencies can be used at the expense of dimming dynamic range and accuracy. Typically,for a PWM frequency of 500Hz, the accuracy is better than 1% for PWM ranging from 1% to 100%.The accuracy of the low duty cycle dimming is affected by both the PWM frequency and the switching frequency of the AL8843Q. For best accuracy/resolution, the switching frequency should be increased while the PWM frequency should be reduced.So 500 Hz PWM frequency should be doable by any micro. Also, you don't need 5v signals, since the CTRL pin considers 2.5v or higher as 100%, you could power your arduino or atmega chip or pic micro or whatever with 3.3v or 3.6v and you'd be perfectly fine.I strongly recommend that you go with groups of 2 leds in series, or 3 leds in series. Personally, I would probably lean towards using 24v as input voltage, so using groups of 2 leds in series, but that's simply because 24v is more common and chances are you're more likely to find replacement wall wart adapters running on 24v.Also, in that configuration, the led driver SHOULD also work well with as little as 18.5v..19v, which means if you really have to, if you have no other choice, you could get a laptop adapter charger to replace your 24v wallwart and get your lamp going until you can get an actual 24v supply. ( I really think the input voltage should be a bit higher than 2 x 8.8..9.3v = 17.6...18.6v)The LED driver can do 3A, but using it at up to 1.5-2A would be also better, instead of using it with 12v input and nearly 3A of maximum current.Decide on the maximum current the led driver will need to handle pick suitable resistor for the Rset value (remember you can wire 2 or 3 resistors in parallel to get 1/2 or 1/3 of resistor value if you determine you need some whacky value like 0.067 ohm) and pick a suitable inductor between 33 and 100 uH (look at the graphs and notes in datasheet... with 24v in and 18v out 1-2A 47uH would probably work well but look in datasheet)