DC/DC converter with uC interface - Page 1
Forum section: electronics / beginners

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 09:17:34 am
content: I am a hobbyist working on a microcontroller project in which I’d like to control the speed of a 12V BLDC fan by varying its supply voltage (no PWM).I’d like to power everything from a single 5V USB supply (with no Quick Charge etc = fixed at 5V). This will ordinarily be a USB power bank, so I’d like to keep things reasonably efficient. The power bank can supply 3A, though I don’t need anywhere near as much. There’s no requirement to power from a computer USB port.So in a nutshell, I have a 5V rail and I’d like to derive a variable 3V-12V supply with a reasonably convenient microcontroller interface (an I2C digital pot?) If this drastically simplifies the design, I can forgo the step-down and just have 5V-12V.In a steady state, the fan draws:25mA @ 3V52mA @ 5V172mA @ 12VI also need to be able to switch the fan on and off (so maybe inrush currents need thinking about, given that the uC will sit on the same 5V rail?)I can probably find an off-the-shelf DC/DC module that’s close to my needs. But since this is mainly a learning exercise, I feel it would be more instructive to design something at the component level.How would you tackle this?I’ve been looking at MC34063A (and might still play with it to learn) but it seems that it’s not very efficient and there are better modern ICs. I don’t know if there’s anything else about it that would outright disqualify it for my application.Would love to hear your thoughts.

author: David Hess
author_rank: Super Contributor
timestamp: May 05, 2019, 12:12:44 pm
content: Quote from: aix on May 05, 2019, 09:17:34 amA common boost converter requires an extra transistor to disconnect the output from the input. Or the SEPIC configuration can be used at the cost of an extra inductor and capacitor.QuoteThe MC34063A is actually one of the better choices because its peak switch current limiting function can be used to limit input current.Controlling the output voltage just requires injecting a current into the feedback network which can be done with a DAC. This would commonly be done with a filtered PWN output from the microcontroller.

author: mariush
author_rank: Super Contributor
timestamp: May 05, 2019, 12:39:55 pm
content: Turn fan on and off - there are regulators with ENABLE pins.There are fan controller ICs but often they're expensive in small quantities.You could just use a switching regulator in SEPIC mode and control the output voltage ignoring the current and that would allow you a wide output voltage range, like 3v.. 12v.You can go for the cheaper route and use only step-up regulator, and configure fan between 5v and 12v... step up would only allow you an output voltage as low as the input voltage.You could set the output voltage of a regulator using a DAC on your microcontroller, here's a "tutorial" :https://www.microchip.com/forums/FindPost/688260You can use ANY switching regulator, just have to look up the datasheet and determine the voltage reference value inside the chip (listed in datasheet) and adjust resistor values accordingly (keeping in mind minimum resistor value mentioned in datasheet)34063 or 33063 would work, but personally I would choose a switching regulator that works at slightly higher frequency than 100-150kHz because while you lose a bit of conversion efficiency, you get much smaller and cheaper inductors and you can use smaller ceramic capacitors instead of electrolytic capacitors.For example, have a look at* LM4510 :https://www.digikey.com/product-detail/en/texas-instruments/LM4510SD-NOPB/LM4510SD-NOPBCT-ND/1679844* MP1540 :https://www.digikey.com/product-detail/en/monolithic-power-systems-inc/MP1540DJ-LF-Z/1589-1857-1-ND/5291720(up to 12v 200mA with 5v input , 2.7v..5.5v input voltage, 1.3 mhz switching frequency, super simple to wire and very few extra components)You can use the DAC method on these to mess with the adjust to limit current. But if you don't want or don't have DAC....Another trick you could do would be to use a LED driver IC as a fan controller... use a regular switching regulator to boost your battery voltage of 3.7v .. 5v to around 12v or whatever voltage you want (maybe you'd like max 10v for a more silent fan ... and pick inductor and other parts, for example to really optimize for around 12v.. 12.5v output instead of a wide output voltage range - would be safe to go up to around 13v, most PC fans have +/- 10% tolerance) and then use a super cheap and simple buck (step-down) led driver IC to limit the current. The fan always gets around 12v (minus some losses in the led driver and resistor that measures current) but the current is limited by the "brightness" setting which you could control through PWM or i2c commands.Here's a short selection of such led drivers :https://www.digikey.com/short/pzh00pFor example the cheapest AL8860 would be quite suitable:https://www.digikey.com/product-detail/en/diodes-incorporated/AL8860WT-7/AL8860WT-7DICT-ND/6226981Datasheet:https://www.diodes.com/assets/Datasheets/AL8860.pdfYou can set the maximum current (for example 0.2A) using a resistor, and then you can use the CTRL pin for ON/OFF or adjust current between 5% and 100% of the value set using the resistor:QuoteAnother example : TS19376 :https://www.digikey.com/product-detail/en/taiwan-semiconductor-corporation/TS19376CY5-RMG/TS19376CY5RMGCT-ND/7359728Datasheet :https://www.taiwansemi.com/products/datasheet/TS19376_A12.pdfAgain, set maximum current using a resistor and then use PWM pin to "dim", aka adjust current to your desires.QuoteYou could use a step-up led driver IC and basically use it to also boost 3v..5v to 12v ... but you'd have to add a zener diode or something to cap the output voltage to 12v or thereabouts..There's loads of 10v, 11v and 12v zener diodes... and cheap :https://www.digikey.com/short/pzhv3z

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 01:16:21 pm
content: Why do you not want to use PWM? that you need to boost the voltage is clear but the ability to control the output voltage may complicate the control or require specific parts. Most SMPS circuits will be more efficient at their designed condition. Boosting is not as efficient as bucking anyway.Why not have a fixed boost to 12V and then PWM the fan? You can just send the PWM signal to a single low side mosfet so no need for level shifting. with PWM you can also do softstart to prevent too much current being drawn at startup. You will also be able to get to lower speeds as PWM tends to keep the torque up even at lower speeds allowing you to operate slower than if you just lower the supply voltage.

author: David Hess
author_rank: Super Contributor
timestamp: May 05, 2019, 01:33:37 pm
content: Quote from: Simon on May 05, 2019, 01:16:21 pmPulse width modulating the power to a DC brushless motor is a really bad idea unless it uses hall effect sensors to directly commutate the transistors which has not been done in decades. It is not a good idea even then.The power input to the fan includes a decoupling capacitor so a pulse width modulator has to operate into an AC short. If you check old PC motherboards which did this to control fan speed, they include a big LC filter on the output of the pulse width modulator effectively making an open loop buck converter. Or at least the reliable ones did; the ones with burnt out transistors left the filter off.

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 01:36:43 pm
content: Ah, I missed that it is brushless

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 04:52:25 pm
content: Thank you for the suggestions everyone. Much appreciated.I built the attached schematic on a breadboard. It seems to work pretty well. Would love your feedback in case there are some glaring problems that I'm yet to discover.I did not have a DAC in my parts drawer, so I simulated it using a variable 3.3V supply. It seems to do the trick.Using an I2C DAC — such as MCP4725 — makes total sense as I already have an I2C bus running throughout my project.I wonder if I could even have a MOSFET switch that would cut off the supply to the boost converter when the DAC output is sufficiently close to Vdd (3.3V). This way I won't need to run a separate signal for switching the fan on and off. What do you think? (I am not sure whether it's a good idea or how I might implement it.)

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 05:53:49 pm
content: I've looked at the efficiency of my experimental circuit, and it's 71% at V(out)=5V going down to 58% at V(out)=11V.I honestly have no idea what I should be expecting, but that does seem a bit low. Would you agree? If you do, how might I go about finding & fixing the root cause?(The project does have to run from a battery after all, and this part is by far the biggest power drain.)

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 06:31:45 pm
content: Quote from: aix on May 05, 2019, 05:53:49 pmFor a DAC you can low pass filter a PWM signal.Boost converters are never as efficient as buck converters. This is because in boost mode you take more current in to convert into voltage going out. Losses are more about current. think a resistor in a network, if it passes twice the current then twice the voltage will fall across it making the pawer lost 4 times for a 2x increase in current. This is known as the "i" quare law. When you have a buck converter wore voltage goes in and is converted to a higher out current than what went in.

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 06:47:14 pm
content: Quote from: Simon on May 05, 2019, 06:31:45 pmIt seems that modern, well-designed 5V → 12V boost converters can achieve efficiency of at least 80-90%. My naïve breadboarded circuit is clearly neither modern nor well-designed, but I can't help wondering whether the 60-70% I am seeing can be improved upon or is an inherent limitation of my approach?

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 06:50:05 pm
content: As you say a well designed circuit. I think the chip you are using is not the most efficient. It's a BJT for starters so has more voltage drop than a MOSFET might.

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 06:51:46 pm
content: Quote from: Simon on May 05, 2019, 06:31:45 pmI would definitely like to learn how to do that, and will read up on it.In this particular project I happen to be out of uC I/O pins, which is not something I mentioned before. Using I2C doesn't require any additional uC pins since I already have an I2C bus. Using an extra £1 part (MCP4725) is no biggie in my case.

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 06:59:44 pm
content: You produce a PWM from you µC, you put that through an RC filter that has a cutoff frequency 10-100 times lower than your PWM frequency and voila' you have the equivalent of the duty as a voltage. It's more or less what your buck converter does in a SMPS but obviously it's a high impedance source suitable as a signal only. The higher the cutoff frequency the more ripple you get but the faster it changes when the PWM duty changes, the lower the cut off frequency the smoother the signal but it will take longer to follow any changes in duty, like all things it is a trade off.

author: free_electron
author_rank: Super Contributor
timestamp: May 05, 2019, 07:21:42 pm
content: you can't speed control a bldc properly by changing its voltage.get a 4 wire fan and use a pwm on the control line to regulate speed. the way that works is that they are chopping the power rail to the bridge. the rail there has a capacitor to smoothen the voltage. the control ic reads the pwm signal and changes the drive pattern of the mosfets to adjust the speed.the voltage on a bldc only controls torque. ( indirectly through current)the rotational speed is purely controlled by speed of commutiation on the phases.

author: mariush
author_rank: Super Contributor
timestamp: May 05, 2019, 07:23:12 pm
content: Quote from: aix on May 05, 2019, 05:53:49 pmThe MC34063 is a shitty cheap ancient switching regulator IC with poor efficiency from the start, and then it actually matters to pick the right inductor and the right timing capacitors and various resistors. IF you put the circuit on a prototyping board, the capacitance of the board itself can actually affect some capacitors.See my post above where I showed you some more modern regulators like that MP1540, which claim to be as efficient as over 90%, see picture below :BUT, the inductor MUST be chosen properly to handle the peak currents, and you MUST follow the instructions in the datasheet and have the components as close as possible to the chip, with as tight loops as possibleAnother good example would be LT1961 :https://www.analog.com/en/products/lt1961.html#product-overviewDatasheet :https://www.analog.com/media/en/technical-documentation/data-sheets/1961fa.pdfSee page 11 which shows you example circuit layout, and you can see how tight you're supposed to place the components to get decent results.

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 07:34:22 pm
content: Quote from: free_electron on May 05, 2019, 07:21:42 pmCorrect. many fons will state a working voltage range and go a bit under the minimum before they cut out but they tend to slow down at the bottom end as they use that back emf on the unswitched phase to detect the position so work out for themselves how fast they can go.

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 08:13:22 pm
content: Quote from: free_electron on May 05, 2019, 07:21:42 pmThanks for this insight. I've looked into getting a PWM-controlled BLDC fan, but couldn't find one in the form factor I need at a suitable cost.Quote from: free_electron on May 05, 2019, 07:21:42 pmI've measured the rotational speed of the fan I have and it does change with voltage (see the attachment). I am not sure how to reconcile this with your suggestion that it shouldn't.

author: aix
author_rank: Regular Contributor
timestamp: May 05, 2019, 08:20:32 pm
content: Quote from: mariush on May 05, 2019, 07:23:12 pmJust wanted to say thanks and mention that I'm not ignoring your suggestions. The MC34063A is all I had in my parts box on a Sunday, and so that's what I ended up playing with. I knew next to nothing about DC/DC converters this morning. I still do, but at least I have a working circuit. This feels like progress.Once I get to grips with the current design, I might venture into playing with more advanced ICs.

author: Simon
author_rank: Unknown
timestamp: May 05, 2019, 09:17:43 pm
content: Quote from: aix on May 05, 2019, 08:13:22 pmI explained this earlier. Ideally brushless fan's don't want their supply voltage altering as there is control circuitry that needs a minimum to work on. Usually the fans can work down to about half the maximum at lower speeds and may be able to go lower in voltage but it will be attempting to run full speed at all times. It will conceed to go as fast as it can at the lower voltage but it will be speed limited by the throttling of power. while the fan will work at a lower than specified voltage it is of course not guaranteed to work.i have some 16-32V 65W fans at work that i can run down to 5V but I only do that when I use them on my bench to cool me down in the summer. i would never set them up to do this in a working design.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 04:52:10 am
content: Quote from: Simon on May 05, 2019, 09:17:43 pmThis agrees with what I'm seeing with my fan. Its datasheet specifies 7-13.8 VDC working voltage, but it spins (even starts) all the way down to at least 3V. With the current design I plan to push it to 4.5V. Given the nature of my project it's OK to drive the fan out of spec. The lower voltage threshold will be configurable in software in case I find the fan unreliable at lower voltages or have to replace it with a different model.

author: paulca
author_rank: Super Contributor
timestamp: May 06, 2019, 06:50:16 am
content: I think Simon is trying to nudge you towards using a proper variable speed PWM fan. These are not expensive, they are pretty standard PC fans. 12V PWM control. A basic 4 wire fan is about £3 on a PC supplier website, less on ebay.You get your DC +- an RPM sense wire and the PWM control wire. Some even work with 5V on the control line or you can use a mosfet to level step the PWM.The downsides of course are that the PWM control mechanism is not well specified and manufacturers are free to implement it as they choose with regards to things like minimum speed and what they do below it. For example out of 8 PWM fans in my PC, 5 will not stop at 0 PWM, of those 1 will snap to 100% rpm if PWM falls below about 15% the others will just continue at minimum RPM. The other 3 will stop at minimum PWM (Arctic 140mm F14s).With a PWM fan you can (google the spec) and just send the right duty cycle from the uC pin, possibly via a 12V mosfet level changer (your 5V PWM pulses the mosfet gate to pull 12V across the fan PWM pin.You can also connect the sense line to the uC (via a divider to get 5V) and count the pulses to work out the current RPM.https://folk.uio.no/kyrrens/diverse/viftekontroller/developer-specs-REV1_2_Public.pdf

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 07:18:52 am
content: Yes, once you have paid for the built in electronics to drive the motor (DC to 3 phase converter) actually bringing a wire out for input control is a trivial exercise for the manufacturer. The fans I use a lot at work come in varieties with and without the speed wire and rpm feedback probably for people that don't want to have to deal with unwanted wires as you can't always just leave them hanging around if it is say a wet environment but the fans themselves cost exactly the same with 2 or 4 wires.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 09:10:00 am
content: Quote from: paulca on May 06, 2019, 06:50:16 amThat would certainly be a good solution. The reason I'm not using one is that the form factor (7530 blower) is a hard constraint. When I looked for fans in that form factor, I found 2-wire to be common and cheap, 3-wire to be rare and generally expensive and 4-wire to be like gold dust.For future-proofing, I thought it desirable to keep my choice of fans as wide as possible. And building my own speed controller felt like a good learning exercise, which is the main reason I am doing this in the first place. Though I now think that having a fixed efficient step-up to 12V followed by current control might have been a more fruitful approach. It just did not occur to me when I started this, though it's not too late to play with that as well.Of course if any of you know of a good supply of inexpensive 4-wire 7530 blowers (maybe they're also known under a different designation?), I'd be all ears. I attach a drawing for reference.

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 09:15:09 am
content: Presumablp no one does a brushed version?

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 09:31:25 am
content: Quote from: Simon on May 06, 2019, 09:15:09 amI've not seen one.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 10:10:25 am
content: Driven by curiosity, I took apart a cheap Chinese 7530 blower fan that I'd managed to kill earlier.Quality of construction aside, the PCB does have provisions for a third pin, though that part of the PCB is unpopulated. The pin is labelled "O/P" and — if populated — would have been derived from FG/RD signals, all of which makes me think it's a sense output rather than a PWM input.

author: ogden
author_rank: Super Contributor
timestamp: May 06, 2019, 10:16:48 am
content: Quote from: aix on May 05, 2019, 09:17:34 amThere is no point to make 5V->12V boost converter for 12V fan when you can just use 5V fan. There are gazillions of various 5V fans available.

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 10:21:44 am
content: True, I meant to say that and forgot to mention it.

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 10:25:07 am
content: Quote from: aix on May 06, 2019, 10:10:25 ami tried looking for the datasheet for the controller. It's very vague and does not even explain the chip. I am not sure what they mean by single phase motor.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 10:26:14 am
content: Quote from: ogden on May 06, 2019, 10:16:48 amThe fan form factor (7530 blower, I posted a drawing earlier) is a hard constraint for my project. While 5V versions do exist, they seem to be much less readily available. Additionally, I'd like compatibility with a pre-existing controller whose replacement I am designing. That controller requires a 12V fan.P.S. This is also an opportunity for me to learn some new skills, which is an end in itself.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 10:27:44 am
content: Quote from: Simon on May 06, 2019, 10:25:07 amYeah, that datasheet is a bit of an enigma. I found several versions branded by different manufacturers but they're all equally mysterious (basically copies of each other).

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 10:29:28 am
content: Yes they are all identical copies.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 10:32:33 am
content: In any event, I won't necessarily be expecting the next fan I use to have the same circuitry (even if it's identical on the outside).

author: Simon
author_rank: Unknown
timestamp: May 06, 2019, 10:34:45 am
content: Ah, well this is your problem. They are rated for 12V one may go down to 3V, another may not.

author: aix
author_rank: Regular Contributor
timestamp: May 06, 2019, 10:37:11 am
content: Quote from: Simon on May 06, 2019, 10:34:45 amThat I am happy to live with. It's not a commercial product; I will be the only user and won't mind recalibrating the voltage limits in software when I get a new fan.