## Power Changeover Switch - Ingenious Circuit Needed

30 posts / 0 new
Author
Message

I have a unit that needs to run on two different power sources...

1) An external 12V DC supply or

2) An external AC supply which can be anywhere in the range 8-18V rms, this is FW rectified and turned into DC in the range 9-24V DC.

These appear on separate hard-wired connections.

If the DC supply is present then it should be used, otherwise use the AC supply. Total current no more than 500mA.

If the rectified and smoothed AC was always less than the DC supply it would be easy - two diodes (actually 1 because of the bridge). The 12V DC would 'win' if present.

The simplest would be a SPDT relay with its coil fed from the 12V DC, but that feels a bit 'old school'.

I've tried various high-side P-channel MOSFET schemes but they all fall apart because the rectified AC can be both higher and lower than the 12V DC.

Anyone have any clever ideas? I'd like something nice and simple.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

<SARCASM ON>

Seems simple:

```    if (DCV < CUTOFF) {
USE_ACV();
} else {
USE_DCV();
}```

where CUTOFF is minimum voltage present on DC to know it is valid.

(Hardware implementation left as an exercise for the student.)

</SARCASM OFF>

Does the 12V have a fairly rapid on-off edge or does it slowly ramp up and down?

David

How about feeding the AC through a polyfuse then saturable reactor that crowbars when DC is running through the control winding?

When the AC input voltage is rectified and under 500mA load,  what is its peak ripple voltage? Can you add a big capacitor after the bridge which would result in the rectified AC would always be a DC level greater than the +12V DC input voltage?

Is the +12VDC input regulated?

Is the +9 -- 24V result from the AC converter an average DC voltage, or a peak voltage?

frog_jr wrote:

Does the 12V have a fairly rapid on-off edge or does it slowly ramp up and down?

It'll be a typical wall-wart power supply. So likely to be rapid on.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Simonetta wrote:

When the AC input voltage is rectified and under 500mA load,  what is its peak ripple voltage? Can you add a big capacitor after the bridge which would result in the rectified AC would always be a DC level greater than the +12V DC input voltage?

To a certain degree that's under my control as any smoothing capacitor is mine to choose. Within reasonable size/cost constraints of course. But at the very lowest AC voltage, even going to schottky rectifiers, the resulting DC will be less than 12V.

Simonetta wrote:

Is the +12VDC input regulated?

Typical switch-mode wall-wart power supply so likely to be within a few percent.

Simonetta wrote:

Is the +9 -- 24V result from the AC converter an average DC voltage, or a peak voltage?

The unrectified input range is 11-25V peak to peak. So less two diode drops to give a peak DC voltage in the range 9-24V.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

EDIT:  Never mind, I got it backwards! ;-)

 "Experience is what enables you to recognise a mistake the second time you make it." "Good judgement comes from experience.  Experience comes from bad judgement." "Wisdom is always wont to arrive late, and to be a little approximate on first possession." "When you hear hoofbeats, think horses, not unicorns." "Fast.  Cheap.  Good.  Pick two." "We see a lot of arses on handlebars around here." - [J Ekdahl]

Last Edited: Sat. Jun 20, 2020 - 07:58 PM

It's overkill but you could use separate switching regulators, each with their own logic level enable signal. You could then use the code in #2 to drive those enables.

how bout this

http://www.ixysic.com/home/pdfs.nsf/www/CPC1114N.pdf/\$file/CPC1114N.pdf

combine its output with your 12v line going through a schottky (optional to prevent backflow out the 12V input)

Drive the relay with your 12v signal to shut off the HV drive

watch the current rating.

enjoy the sparks

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

avrcandies wrote:

how bout this

That has a max load current of 400 mA.

Brian Fairchild wrote:
Total current no more than 500mA.

Mind you, it has a peak of 1000 mA, but that's t<10ms.

 "Experience is what enables you to recognise a mistake the second time you make it." "Good judgement comes from experience.  Experience comes from bad judgement." "Wisdom is always wont to arrive late, and to be a little approximate on first possession." "When you hear hoofbeats, think horses, not unicorns." "Fast.  Cheap.  Good.  Pick two." "We see a lot of arses on handlebars around here." - [J Ekdahl]

Last Edited: Sat. Jun 20, 2020 - 04:50 PM

He's just guessing & prob only needs 100 ma

I say this, because about 25 years ago we had a huge team meeting, big white board to draw up. I was doing the main power control & needed to discuss cabling & fusing.  I asked each person how much their section (devices) required & what cable would they use.....Umm when we added it up, it was like the system would take 95 amps & require 6,4,2 gauge wires, etc.  So everyone nodding their heads, yup we need BIG, very BIG.   Ummm...I pointed out the old system, which used essentially the same pieces was operating fine for 10+years with a 15 amp fuse and much lighter wiring.

If someone told me they might need 4 amps, I'd put them down for 5, just to be safe, in case their estimate was low.  Except, when they told me they might need 4, they only really needed maybe 2 amps, but said 4, just to be safe & account for any surge.   If someone needed 200 ma , they said they "would be fine with 1 amp" (which I then increased, in case they were "off")  All of those "extra" amps really cranked up the total.

We laughed & did another query & developed a more realistic picture....I think we ended up using 20 amp fusing for the whole system.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Jun 20, 2020 - 05:56 PM

I haven't actually used this yet bit was planning to... LTC4415

Its a dual 4A ideal diode for power muxing but it does allow you to control which source has priority.

The LTC4413(-1,-2) is a similar, lower current (2.6A) version that I have used effectively.

Unfortunately both max out at 5V so no good for your app but may point you to a solution.

Notably there are ideal diode controller chips that use external MOSFETs instead and you may be able to make a 12-24V version that way.

Alternatively, I've just been designing in a Ti eFuse TPS2663x

Again this specific part may not quite fit your requirements but the datasheet does again show a prioritised power mux arrangement using 2 such devices.

Cheers,

Steve

Silly suggestion:  Take your 12V input and pop it up to 24V with a DC-DC convertor, then it will always 'win' at the input to the regulator (I'm guessing your system isn't actually trying to RUN at that input voltage - it's being regulated down to microcontroller levels first...)

e.g.:

https://www.mouser.com/ProductDe...

Of course, the thingy's 2" square and costs \$20...    Or go shopping for 24V wallwarts.  S.

Brian Fairchild wrote:
The simplest would be a SPDT relay with its coil fed from the 12V DC, but that feels a bit 'old school'.

Whats the matter with that?  Pick your filter caps that feed your circuit to have enough 'reserve' to keep the V+ rails for a few milliseconds while the relay switches.

Too often we spend/waste more time/money looking to come up with a fancy 'sophisticated' solution where the simplest is also the most reliable.

Heck, the NYC subways signals in many places are still running on circuits driven by relays and wiring that was put in 100 years ago, and still works.  Meanwhile the PLC/computer replacements are Expensive, high maintenance, and already obsolete...ant they haven't replaced half the system in the 20 years they have been futzing with the project.

Go with the relay and enjoy the time saved with a cup of tea, or a pint of brew.

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Sun. Jun 21, 2020 - 01:18 AM

Another equally silly but probably cheaper solution:

Stick a triac on the inbound AC, and clip its waveform to keep it under the 12V from the wart.  S.

More cheerful silliness:

As N. Winterbottom pointed out, use two input regulators, but the idea here is instead of having 'enable' lines, use adjustable regulators (LM317?) and adjust the 12V input regulator to put out just a hair higher voltage than the AC input regulator puts out.  Couple of diodes to prevent backfeeding, and off you go.  All solid-state, that.  S.

Thanks for all the ideas. I'm currently looking at something like this...

The 'extra' components to implement the changeover are R3, U1, Q1, R2, D4 and possibly D3.

I might be able to lose D3; the 12V would flow back through the P-channel device's body diode and charge C1 if the incoming AC resulted in less than 11V (ish) across C1. I'll need to look at the specs for that diode.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Thanks for all the ideas. I'm currently looking at something like this...

Looks like the winner's circle!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

At 12V across 1k, you'll be dropping 12mA right there (less the diode drop of U1) just to keep the 12V powered on.  Avrcandies's commentary on power consumption might not be far off.  S.

Use a depletion mode fet and get rid of the opto?

Is U1 of type Covid19?

Ross McKenzie, Melbourne Australia

This works based on the same idea as yours. I replaces the optcoupler and Zener diode with a dual pre-biased NPN-PNP BJT transistor array. You can adjust R1 in such a way that together with Q1.2 acts like a Zener diode. Watch for power dissipation on Q1.2 if you do so. Alternatively, you could place R1 in parallel with Q1.2 (EC) in such a way that the new resistor divider formed protects the MOSFET gate. With a low gate threshold and high gate - source max voltage it should be OK.

Both this schematic and yours switch over when DC voltage reaches about 2 - 3 V. The switch must be fast, otherwise you will see a drop at the output. You can add a resistor in series with Q1.1 base to adjust the switch threshold.

@ avrcandies: dots at the intersections of four lines on the schematic means that all four wires are connected together at that point.

angelu wrote:
@ avrcandies: dots at the intersections of four lines on the schematic means that all four wires are connected together at that point.

lol I was going to warn you the candyman is going to have a fit about that!ðŸ¤ª

jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Be careful with R1, too low and it could arm wrestle Q1.2 & win, causing the fet to turn on when q1.1 is on (depending on the unnamed resistor values).

You could make use of one of these 30V opencollector hex buffers (I couldn't find a single channel version)...but It is no better than the alternatives.    What you need is a 30V capable high side driver with an active low logic. enable.

@ avrcandies: dots at the intersections of four lines on the schematic means that all four wires are connected together at that point.

Some day it will surely be your regret!

lol I was going to warn you the candyman is going to have a fit about that!ðŸ¤ª

No matter how many nails you pick up , there are always more in the road.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Jun 21, 2020 - 09:02 PM

I go with the idea that since Altium Designer and I believe others makes available a "junction" to place manually, then it is not such a bad idea to connect four wires on a schematic.

I go with the idea that since Altium Designer, and I believe others, makes available a "junction" to place manually, then it is not such a bad idea to connect four wires on a schematic.

It also lets you hook up leds without resistors, often a bad idea.  The main idea is clarity (or prevention of mistakes).

Microsoft Word but words lets random me put doesn't in any mean I order should.

You might see a star connection showing 8 wires going to one central point ....in that case it is very clear what is going on, even with a coffee-stained drawing.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Jun 21, 2020 - 09:35 PM

Angelu's schematic might work. But be area of the intrinsic body diode inside each FET. It will conduct the wrong way around, specially when the AC is lower than the DC.

There are schematics coping with that in the way that they put a mirrored Q2 next to Q2 to make sure that diode is blocked.

I have wanted to build a circuit like that once, but then the specification was changed and we no longer needed it.

To address a few of the points above...

1) Yes, 500mA is, at this stage, a best guess. Until the whole thing is built and tested a final figure won't be available but it's likely to be in the 300-500mA range.

2) The 12V supply is from an off the shelf wall-wart so specifying it's output performance is easy. The output will always be close to that figure so the changeover happening at lower voltages isn't an issue.

3) The circuit is not being used for hot swapping power so any switching times don't matter.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

But be area of the intrinsic body diode inside each FET. It will conduct the wrong way around, specially when the AC is lower than the DC

True, except in this case it won't get far, since the full wave bridge will halt any escape.  The resistors will be high ohms.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

1) just put in bigger current conducting FETs when in need of more power. The principals do not change. Just keep an eye on leakage currents as they might get tricky.

2) & 3) you need to set yourself switching limits. The 12V ( or is it a SMPS wallwart?) can also fluctuate over temperature, current and input voltage.

Actually it will always be hot swapable. when you first connect the Ac supply and then the CD supply there will be switching done, as the 12V supply should be the supply used.

Same goes for removing the 12V supply when you have both attached. So you do need a certain amount of switching speed, before the supply drops below a "brownout level" and the rest of the system might crash.