plugwash
Forum Moderator
Forum Moderator
Posts: 3477
Joined: Wed Dec 28, 2011 11:45 pm

Re: Can you power the Pi from GPIO?

Sat Feb 04, 2012 1:31 am

DeliciousRaspberryCake said:


If you were instead just learning about how a DC-DC step-up/down converter works, then my sincerest apologies for almost advertising ready-made diy products. I also still want to learn how an SMPS actually works, though the concepts are a bit difficult to grasp. Hopefully, I'll get around to it at some point


The key to understanding all SMPSUs is to understand that they rely on switching rapidly between two states of operation. Typically energy will be stored (usually in an inductor) during one state of operation and released during the other mode. Depending on the particular converter type some energy may also be transferred directly from input to output without being stored.

Inductors resist changes in current. The faster the current is changing the higher the voltage across the inductor V=L(dI/dt).

In the case of the buck converter when the switch is on the inductor is in series with the load. Current is transferred from source to load  and the inductor is charged. When the switch is turned off current continues to flow through the inductor and into the load but rather than coming from the source it comes from the ground rail. Since the voltage on the inductor has reversed but the current is flowing in the same direction the inductor is now discharging into the load. Depending on the inductor value and load current the inductor may or may not be completely discharged before the switch turns on again.

A capacitor on the output holds the voltage across the load reasonably steady despite the constantly changing current flow in the inductor.

Control electronics adjusts the duty cycle (the proportion of the time the switch is turned on) to maintain the desired output voltage as load current and input voltage changes.



error404 said:


Avoid doing that – also pretty easy to protect against, use a TVS, polyfuse and series diode for any power outputs.


I wouldn't generally put a series diode on the output of a power supply because diodes can have quite a high voltage drop which will mess with your regulation and reduce you efficency. Agree on the TVS and polyfuse though.


Just to prove I'm not crazy, I spent a few minutes poking around at WeBench and some parts suppliers and came up with a design based around LM3150, 7-14Vin 5Vout @ 1.7A. Efficiency > 90% for all loads > 350mA and > 94% at > 1A. Total BOM cost for a single copy of this circuit is $5.45 (however you won't save a huge amount in quantity, it's still $4.95 at qty 100). This is all surface-mount, but accessible packages like SO8 and 0805 that anyone can do easily by hand.

Just watch the switching frequencies. Converters with a high switching frequency can have lower parts costs but they are also far more sensitive to PCB layout issues.

schlomo
Posts: 19
Joined: Tue Jan 31, 2012 3:14 am

Re: Can you power the Pi from GPIO?

Sat Feb 04, 2012 3:25 am

Thanks for the help error404 and plugwash. After playing around with WEBENCH, I've finally got a nice switched-mode power supply circuit designed. It has over 91% (!) efficiency and costs about $3.00. The problem: total (max) power dissipation is 700mW [when input voltage is 18v and outputs 5v/1.6A]. (specifically around 500mW dissipated from the TI LM20333 IC, and 200mW from the 22.0 uH inductor)

Is .7 W of max power/heat dissipation too high? Does it need a heat sink? Or would it be possible to get away with just placing the circuit in the right place on the PCB?

error404
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm

Re: Can you power the Pi from GPIO?

Sat Feb 04, 2012 8:01 am

schlomo said:


Thanks for the help error404 and plugwash. After playing around with WEBENCH, I've finally got a nice switched-mode power supply circuit designed. It has over 91% (!) efficiency and costs about $3.00. The problem: total (max) power dissipation is 700mW [when input voltage is 18v and outputs 5v/1.6A]. (specifically around 500mW dissipated from the TI LM20333 IC, and 200mW from the 22.0 uH inductor)


Neither is a big deal, just don't use an inductor close to its maximum current rating. LM20333 ?ja is 27°C/W, so at 0.5W its temperature will be ~14°C above ambient. Not a big deal, you probably don't even need to heed the standard recommendation to have lots of (attached) copper nearby. Surface mount regulators are generally designed to heatsink through the power planes.

As plugwash points out though, be careful with layout and heed the datasheet recommendations in this regard. Even if it works, you don't really want a ton of RF hash all over your board. Also I'd recommend prototyping the supply separately from any other part of your circuit (work on it first before building up the rest or something so you don't need to have two different boards made…). It's kind of a pain to work on/test little SMD power supplies – but much worse when they're in circuit. Put lots of easily accessible test points.

User avatar
reiuyi
Posts: 165
Joined: Sun Oct 09, 2011 4:59 pm
Contact: Website

Re: Can you power the Pi from GPIO?

Sun Feb 05, 2012 9:10 pm

schlomo said:


You"re right… I am looking for an integrated solution that is efficient. But would it be better to regulate the ~12 volt/2A power directly on the board, or would that generate too much heat/electrical noise? I like the UBEC idea because the regulator is replaceable, so it something burns out, you can easily get a new one. To make sure the output voltage is 5 volts from such cheap regulators, I would probably want to put another regulation circuit on the microcontroller PCB itself (maybe something like a zener diode or a LDO?). But if you get a more expensive UBEC regulator (like the one at Pololu) with 80+% efficiency, that should be good enough, right?


From the looks of it, both of those UBECS are based on the LM2596 (so electronically they're the same). Despite the one on DX being wrongly spec'd (it's 3a max as stated in datasheet of lm2596), I believe it's a simple solution for a complex problem. I have a ubec based on lm2596 in my possession and they're a pretty simple solution if you want to focus on other aspects of your design instead of spending hours trying to design a PSU on your own

and @plugwash your explanation including the inductors was clear to me. I'm not into the physics of it, though from what I can tell that story only goes from stepping down. I currently can't think of a way how by switching on and off a source, the voltage can be increased. And I can't even begin understanding how such a process should work stepping down from 230 (many modern wall adapters no longer have a copper transformer coil)

wallabybob
Posts: 17
Joined: Thu Aug 18, 2011 2:08 am

Re: Can you power the Pi from GPIO?

Mon Feb 06, 2012 4:08 am

DeliciousRaspberryCake said:


and @plugwash your explanation including the inductors was clear to me. I'm not into the physics of it, though from what I can tell that story only goes from stepping down. I currently can't think of a way how by switching on and off a source, the voltage can be increased. And I can't even begin understanding how such a process should work stepping down from 230 (many modern wall adapters no longer have a copper transformer coil)


One option for step down switch mode power supply with mains input is to rectify the mains, use a couple of switching transistors feeding a transformer to step down to something close to the required voltage and rectify that with a voltage divider providing some feedback to the switching transistors to adjust frequency or pulsewidth or both to control the output voltage. By switching at high frequency (tens to hundreds of kiloHertz) the size of the transformer can be dramatically reduced compared with a transformer for mains frequencies. The transformer provides isolation between the mains and the output supply.

There is a good discussion of switch mode power supplies at http://en.wikipedia.org/wiki/S.....wer_supply and its linked pages.

plugwash
Forum Moderator
Forum Moderator
Posts: 3477
Joined: Wed Dec 28, 2011 11:45 pm

Re: Can you power the Pi from GPIO?

Wed Feb 08, 2012 12:52 am

DeliciousRaspberryCake said:

I currently can't think of a way how by switching on and off a source, the voltage can be increased. And I can't even begin understanding how such a process should work stepping down from 230 (many modern wall adapters no longer have a copper transformer coil)
The key is in how the components are arranged.

For a buck converter (decreases voltage) the inductor is charged in series with the load then discharged into the load.

For a boost converter (increases voltage) the inductor is charged from the power source on it's own. Then the inductor and the power source are placed in series (think like putting batteries in series) to power the load with a higher voltage.


many modern wall adapters no longer have a copper transformer coil


Actually they do hve a transformer (it's needed for the isolation), it's just much smaller because it's part of a high frequency flyback converter (yet another type of switcher) rather than operating at mains frequency.

User avatar
Chromatix
Posts: 430
Joined: Mon Jan 02, 2012 7:00 pm
Location: Helsinki

Re: Can you power the Pi from GPIO?

Wed Feb 08, 2012 1:16 am

An important point is to understand that capacitors and inductors have dynamic behaviour related to their storage of charge and flux (respectively) which present themselves as resistance to changes in voltage and current (respectively) in circuit.

In the boost converter, the inductor is connected directly across the input power while the transistor is on.  At first it resists any current through it, but this charges it and causes it to attempt to maintain a current through it.

Then the transistor suddenly switches off, leaving a strong current trying to get through a near-infinite resistance, the result being a very high voltage.  (This is also why you need diode protection on relay coils.)

This triggers the flyback diode, which accepts the current, discharges the inductor and charges the output capacitor.  This will take less time the higher the output voltage already is.

Then the switching transistor turns on again, the inductor begins to charge again, and the diode blocks the return flow of current from the output.

All of this happens very quickly, typically 10kHz or more.
The key to knowledge is not to rely on people to teach you it.

Return to “General discussion”