# 24VAC/5VDC power supply design

I am planning to create a water valve controller using an MCU and a set of solenoid-controlled valves. The solenoids run on 24VAC (40mA inrush, 20mA holding).

The MCU is on a board that draws ~100mA, and it has an on-board regulator, so I can supply it either 5V directly (bypassing the regulator) or 6-12V through the on-board regulator. I also wish to run some other 5V peripherals (i.e. sensors, a display, some LEDs, and whatnot), so let's say I'll need 500mA of regulated 5VDC.

I could theoretically take the rectified/filtered output from the 24VAC transformer and regulate it down to ~12V and use the onboard regulator to further regulate it to 5V, but I'd be dissipating a LOT of power (comparatively) as waste heat. My regulators would need to be heatsinked and possibly actively cooled (this would all go in a box in a garage where it would regularly get to ~110F...). I've also considered using a switching regulator instead of a linear regulator, but I've got ZERO experience with those, and I wouldn't know how to put together a schematic to do what I want, or whether it's even as theoretically realistic as the linear regulator idea.

I've toyed with the idea of using a center-tapped 24VAC transformer and rectifying/regulating the 12V from the center tap down to 5VDC to run the MCU and using the 24VAC across the full output to drive the solenoids.

Is this an appropriate design? Is it OK to use the center tap in this way?

• Ok, let's ignore the existing 300mA transformer. It's not suitable regardless of the power supply design. – Mark Jul 11 '11 at 20:51
• Why do you say 24VAC at 300mA is not suitable? Seems to me it can be made to work, as both Russell and I explained in our answers. A 80% efficient switcher would only use about 100mA. That leaves enough current for 9 valves, assuming you only switch on one at a time. – Olin Lathrop Jul 11 '11 at 20:57
• I wrote that before I read Russell's answer. Apparently, it is indeed suitable, which is a (happy) surprise to me (not for cost reasons, this whole exercise is certainly not a cost-saving measure). This is for watering a lawn, so I'll only ever need a single solenoid on at a time. – Mark Jul 11 '11 at 21:08

Your solution started out as bearable (5V at 100mA) but ended up completely unacceptable at 500 mA. You say that your "wall wart" is rated at 300 mA. When you supply a voltage using a linear regulator the current in is the same as the current out - the regulator drops the difference in voltage. So here if you draw 500 mA at 5V you must supply 500 mA at 12V or 24V. The transformer will be overloaded in either case.

If the ratings are as you say then a potentially acceptable solution is to use a switching regulator (SR) operating from 24V in. $5V \times 500 mA = 2.5 W$.

$24V \times 5 W =~ 210 mA$. If the SR is 80% efficient (easily achieved) that rises to 260 mA. As that is liable to be an occasional requirement the total current at 24V will probably be acceptable with a 300 mA supply - depending on how many solenoids you wish to maintain on.

If you switch only one solenoid on at once the current drain with N activated is $20 \times N + 20 mA$. The surge current is essentially immaterial.

If you wanted more than 3 or 4 solenoids then current drain at 5V may need to be limited.

e.g.

• 10 solenoids at 20 mA = $200 mA$
• Balance = $300mA-200mA = 100 mA$
• Available current at 5V at 80 % efficient = $100 mA \times \frac{24}{5} \times 0.8 = 384 mA$, say $400 mA$.

Note that when a switching regulator is used, using a higher input voltage will result in less input current drain. Hence it is better here to use the full 24V supply.

Note also that if the transformer is a genuine 24 VAC then the rectified DC will be about $24 VAC \times 1.414 - 1.5V -$ "a bit" $~= 30 VDC$

Because:

• $VDC_{peak} = VAC_{RMS} \times \sqrt{2} ~= VAC \times 1.414 ~= 34 V$.

• A full bridge rectifier will drop about 1.5V.

• 34 VDC is peak voltage and available DC will be slightly lower - depends on load. There will be "a bit" of ripple and wiring loss and transformer droop and ...

At 80% efficiency this gives a 24VAC to 5V DC current boost of $\frac{30}{5} \times 0.8 = 4.8:1$

e.g.

• for 48 mA at 5V you need 10 mA at 30V.
• for 480 mA at 5V you need 100 mA at 30V.

So you about get 10 solenoids plus almost 500 mA at 5V DC :-)

One solution of many:

There are many SR IC's and designs. Here a simple buck regulator will suffice. You can buy commercial units or "roll your own". There are many modern ICs but if cost is at a premium you could look at ye olde MC34063. About the cheapest switching regulator IC available and able to handle essentially any topology. It would handle this task with no external semiconductors and a minimum of other components.

MC34063. $US0.62 from Digikey in 1's. I pay about 10 cents each in 10,000 qauntity in China (about half Digikey's price). Figure 8 in the datasheet referenced below happens to be a "perfect match" to your requirement. Here 25 VDC in, 5V at 500 mA out. 83% efficient. 3 x R, 3 x C, diode, inductor. It would work without alteration at 30 VDC in. • Added: Figure 8 in the LM34063 datasheet shows ALL component values except for the inductor design (inductance only is given). We can spec the inductor for you from Digikey (see below) or wherever and/or help you design it. Basically it's a 200 uH inducor designed for general power switching use with a saturation current of say 750 mA or more. Things like resonant frequency, resistance etc matter BUT are liable to be fine in any part that meets the basic spec. OR you can wind your own for very little on eg a Micrometals core. Design software on their site. From Digikey$US0.62/1. In stock. Bourns (ie good).

Slightly better spec

• your answer is extremely helpful. The 300mA transformer is actually not important, I can replace it with something more powerful if I need to, but it looks like that wouldn't even be necessary. My only hesitation is that while I've put together linear regulated supplies before, this would be my first foray into the SMPS world. I don't have any idea how to choose the external components. – Mark Jul 11 '11 at 21:06
• @Mark: It would always be your first foray into switchers until you sit down and do one. This one is neither wierd, nor dangerous, nor needs to be super effecient. This is about as good a place to start as any. – Olin Lathrop Jul 11 '11 at 21:21
• I just used National's tools to put together a SMPS using the LM22675. Sheesh, the tools available these days make this stuff a little TOO easy! – Mark Jul 11 '11 at 21:46
• See addition at end of answer re inductor availability. – Russell McMahon Jul 11 '11 at 22:58
• @Mark Yes and yes. (You're a wimp and that thingy looks like it is a good match for what you need. I didn't look at the datasheet, but the brief parameters DigiKey shows look good.) Actually that may be a really good answer in this case. This is a one off, so buying a part for a few dollars makes sense. You're being a wuss stalling getting into switchers, but as a engineering solution I can't argue with just buying the ready made part off the shelf. – Olin Lathrop Jul 12 '11 at 21:48

Even if you use the center tap solution you'll want a switching regulator; a linear regulator would still dissipate 5W, and it's not worth it. I'll get back to the switcher in a minute.
If you would use the center tapped transformer, you have to keep two things in mind:

1. You can't drive the solenoids directly through uninsulated triacs, because your power supply's ground is halfway the AC voltage. But looking at this question I guess you want to use an SSR, so that's OK. An electromechanical relay will do as well.
2. A center tapped transformer + full-wave rectifier isn't very efficient regarding the transformer, since it uses only half of the transformer at any time. So you'll need a bigger (and therefore more expensive) transformer.

The working principle of switchers is a bit more complicated than that of a linear regulator, but it's not extremely difficult. Thanks to their advantage of offering high efficiencies they're used everywhere these days, and there's a plethora of regulators available. Olin mentioned Linear Technology, they're one of the leaders in the field. They're not the cheapest, but if you just need 1 that's not as much of a problem as for 100k/year, for instance. Their website offers a parametric search, which with my parameters returned something like 16 parts, so there's plenty of choice. I picked the fixed output voltage LT1076-5 (disregarding cost):

As you can see this is hardly more complicated than a linear regulator, so what's the problem?

1. Switchers sometimes switch at rather high frequencies (MHz range) which causes EMI. This one works at a lower 100kHz, less EMI, but a bit bigger coil. Not a big deal.
2. You can achieve very high efficiencies with switchers, but to get that last % out of it you need to select components very carefully and pay much attention to the PCB layout. If you're not yet experienced in SMPS design you may have an efficiency of only 85% instead of the maximum 90%. Again, no big deal.

Crucial components are the coil, the diode and C1. They're also the parts which need attention in the layout: the loop L1-C1-D1 must be kept as short as possible, and also the connection between IC and coil. Use wide traces because they will carry high currents.

On second thought this is not the ideal datasheet. In fact it's pretty brief for an LT datasheet. It doesn't have a single graph, and many other datasheets give you lots of information on component selection. Check other parts if you want to learn more. (update: the datasheet for the LT1076-5 seems to be more of an addendum to that of the LT1076, which is more extensive)
The datasheets for the LT1766 and LT3430 are more LT-like, with nearly 20 pages of application information, including calculations and board layout. Read them and learn! :-)

OK, this was about LT. Yes, I'm a fan (very good support too, at least for professionals), but there are others of course. National has its series of Simple Switchers and has a Webench designer which gives you schematics complete with BOM. Much cheaper than LT too.

It sounds like you already have what you need in the 24 VAC 300mA wall wart.

The 500mA requirement of your 5V system is high enough that this really calls for a switcher. You can still run the solenoids from the 24 VAC as intended, but also rectify that and then buck it down to 5V to run the processor. The peaks of 24 VAC sine will be 34V, so you should design the system to work with up to 40V.

There should be many off the shelf chips available that can take up to 40V in and put out 500mA at 5V. These things tend to be surprisingly expensive (several $each), but probably small compared to the cost of a single valve. Dealing with the heat otherwise is also not free. It's possible to roll your own buck converter and save a couple of$, but it will take more time and probably not a good idea if you have to ask basic questions here.

The center tapped transformer isn't a good idea. 12V AC will be 17V peak, with 15.5 after the full wave bridge. Even if it's say only 13V average after droop and impedance drops, that's still 4 Watts of heat to deal with. It's also 4W less available to the solenoids.

• thank you very much for the information regarding the CT transformer. Do you have suggestions for sourcing the switching regulator? I've found parts such as the LM22674-5.0, but designing a supply around that seems to require some working knowledge of switching regulator theory. – Mark Jul 11 '11 at 20:57
• @Mark: Russell mentioned a particular model. Since this is a one-off and the cost of a switcher small compared to the valves anyway, I wouldn't worry about price too much. If you don't like Russell's, look around on the Linear Technologies or On Semiconductor web sites. Your switcher requirements are not out of the ordinary. All these switcher datasheets come with suggested circuits, and there are probably separate app notes. If you don't know switchers, learn them instead of trying to avoid them. – Olin Lathrop Jul 11 '11 at 21:02
• excellent advice. Do you have any suggestions on where I can learn switchers? I'm certainly not an electronics expert, my education is ~15 years old and wasn't extensive to begin with. – Mark Jul 11 '11 at 21:10
• @Mark: I didn't learn about switchers from any one or even a small number of places. The first I heard of the concept was in the late 1970s in college on a tour of the GE Schenectady research labs. Lot's of cool stuff, including oil-eating bacteria and possibly the first hardware Z buffer. Anyway, Linear Technologies is a leading switcher chip maker, and tends to have good technical articles, so look around their web site. National may also have some good background material. Of course there are also whole books on this subject. – Olin Lathrop Jul 11 '11 at 21:16

Definitely use a switching regulator. I use 34063, a common, cheap switching regulator. Speaking of water valve controller, I have an open-source design on my website:

• +1 for the nice example, and a nice side note is that the 34063 is available in a DIL8 for the hobbyist as well so it should be quite easy to use it. – Johan Jun 28 '12 at 5:36

My immediate thoughts:

• Take the 24VAC, rectify it with a full-wave bridge rectifier.
• Add a suitable smoothing capacitor.
• Take a feed from the 24VDC and feed it through an LM317T with suitable voltage adjustment resistors (say 680Ω and 2KΩ iirc) and output capacitor.

That should provide you with enough current for the solenoids and the MCU.

If you want more current, just use a more meaty transformer that gives more than 300mA. The LM317T can cope with up to 1.5A, if you can provide it with such.

Obviously, there are more 'efficient' switching circuits, but this one is quick and simple to put together.

• A linear regulator won't work with his existing 300mA transformer since he wants 500mA out. Even if it could, it would get very hot. Let's be generous and say the rectified 24V AC is only 30V after diodes, impedance drop, and droop between half-cycles. That's still 12.5 Watts of heat. A switcher will be a lot simpler than getting a bigger transformer and dealing with 12.5 Watt of heat. – Olin Lathrop Jul 11 '11 at 20:17
• But your option doesn't work. You can't take his existing tranformer as you stated and make a 500mA linearly regulated supply from it since it can only supply 300mA. For linear supplies, current out can't be more than current in. Also, you'd need a heatsink with 4 degC/W from the To-220 case to ambient to not exceed the LM317T's thermal specs. That is certainly not trivial, although you didn't mention heat dissipation at all. All in all, your suggestion is just plain broken. – Olin Lathrop Jul 11 '11 at 20:35
• Your points under "immediate thoughts" look like they answer his question. It's not obvious at all that what you are telling him won't meet his requirements. Later you say that if he wants more current to use a more meaty transformer, but never said more than what. The impression is that his 500mA requirement has already been answered, and this is only if he wants more than that. The 300mA you quote seems to be about the transformer, not his output current since you never explained the latter is limited to the former. Again, this whole scheme is a bad idea. – Olin Lathrop Jul 11 '11 at 20:47
• His question asks for 500mA. "so let's say I'll need 500mA of regulated 5VDC". I suppose you gave a solution for 1/5 of his question, but that's not useful and therefore not much of a answer. Why don't you just tell the OP that a linear regulator is not appropriate here so he and other bystanders don't get confused? – Olin Lathrop Jul 11 '11 at 21:07
• @Matt - 500mA @ 5V and 24V AC in should immediately ring a "switcher" bell. 24V AC rectified doesn't give 24V, but 32V DC. That's 13.5W to be dissipated in the 317. This is a bad design choice. – stevenvh Jul 12 '11 at 9:26