Power supply connector

Hi everyone!

I'm designing a schematic to supply power to another PCB. It uses a LM317 to reduce the voltage to a fixed value.
I would like to use a 9V battery as main source, but considering that the device will also be used in a car, I would like to include also a connector for external power.

The connector I'll use on the PCB is a standard 2.1mm coaxial connector like this one: http://www.adafruit.com/adablog/wp-content/uploads/2011/05/21mmdcjackbbfront_LRG.jpg

Instead of using a separate switch I would like to use the third pin of the socket to detect when the connector is plugged in and automatically use external power, disconnecting the battery.

My problem is that I have no idea on how to do this :smiley: Any help?

Thank you!

The simplest way is to forget the third pin thing, and just use 2 diodes.

 9v +---->|----\
                ----------+
12v +---->|----/

Well the way those 3 pin power connectors usually work is that the center pin is always the unswitched voltage and the other two pins form a switched 'ground connector' which is normally closed when there is no plug inserted into the connector. So usually the battery's positive terminal is wired to the center pin output pin of the boards connector and the battery's negaitive is wired to the normall closed contact or the connector and the common switch connector pin is wired to your board's ground system. So when you plug in an external plug the battery 'loses it's path to your board's ground bus but the external DC source is connected via the connectors positive terminal and common ground pin.

This drawing may help, it's of the pins on a typical board mounted DC power connector. Pin 1 is wired to your battery's positive terminal and also to the boards DC power bus. Pin 2 is wired to your boards ground bus, and pin 3 is wired to the battery's negative terminal only.

That make sense?

Lefty

Thanks for the replies!
It's actually very basic, I was thinking too complicated!! I should have applied the KISS principle right away... :smiley:

So basically, if I want to use the connector's pin to switch I would have to do something like the schematic attached, right?
I actually like the 2 diodes solution: there is no power interruption while the connector is being plugged in.

pwr-connector.JPG

So basically, if I want to use the connector's pin to switch I would have to do something like the schematic attached, right?

Yes, that is basically right but the 'switchable' ground contact is not drawn quite as clearly as the linked drawing I showed. In this case there is no advantage of having that diode wired in series with the battery, as with the battery's negative terminal 'floating' when the external power is pulled in, there is no way for current to flow into or out of the battery, and the diode just causes permanent .6 vdc voltage drop when the battery is switch into service.

Lefty

Yeah I used Paint and I should have drawn it better. :smiley:

The reason why I placed it there is to avoid touching the battery connector with the battery held in the wrong way. I think I will move the diode to another place as actually it is more plausible to plug the external power with a wallwart and the connector in center-negative configuration. Is it ok to use a 1N5822 schottky barrier diode for this (Vf is around 0.5V)?

Before the LM317 I placed a 10uF capacitor for smoothing out voltage fluctuations: is this good also for "debouncing" the switch between the two power sources?

Is there a way to make sure that power is drawn from the battery until the external connector is properly plugged in? There is a small range while plugging in external power where the PCB is not powered at all.

Thanks again!

Chrono251:
Is there a way to make sure that power is drawn from the battery until the external connector is properly plugged in? There is a small range while plugging in external power where the PCB is not powered at all.

Yes, don't use the switch but use the diodes instead.

majenko:

Chrono251:
Is there a way to make sure that power is drawn from the battery until the external connector is properly plugged in? There is a small range while plugging in external power where the PCB is not powered at all.

Yes, don't use the switch but use the diodes instead.

Allright, I'll do it this way.
Thanks for your help!

Agreed with the diode solution as the better option, but to answer the question for posterity... yes, that's what the capacitor is for. As long as the time it takes the switched input to "break" the battery and "make" the power supply input is less than the time it takes to drain the cap below the minimum operating voltage of the circuit, you're good to go.