multiple power supplies

I’m working on something that I would like to be able to power from a battery, or from a DC power jack. When there is something attached to the DC jack, I don’t want to draw current from the battery. (I’m cheap like that)

Is this easy to do? I think the Uno does something like this, but I’m just a software guy and the schematic was too complicated for me. :slight_smile:

Can someone explain whether this is feasible and if it is how I would go about it?

I’m planning to use this as the basis for each power supply: http://www.sparkfun.com/tutorials/57

Thanks in advance for any help!

  • Mark

It depends on where you connect the battery and what the voltage is on the jack compared to the battery.
If the jack voltage is higher than the battery voltage then you need a seriese diode to stop current flowing into the battery.
If the jack voltage is lower then you need a FET to act as a switch, see the arduino schematic for an example of how to do this.

Thanks! I remember seeing a MOSFET and trying to figure out what it was doing. :slight_smile: I'll have another look.

Couldn't you use one of the LiPo Rider Shields to do this? I think if you connect your PS to the input marked for the solar panel, and the battery to, well, the battery input, you have this conquered, right?

I realize it means you need to purchase the shield, but it would seem it's all worked-out from there, no?

(Please correct me if I'm wrong.)

-AJ

Thanks for the input.

Early on I had considered using rechargeable batteries. If I think hard enough, maybe I'll remember why I didn't go that way. :~

I think part of it was the cost of the charger and batteries, and part of it was just plain wanting to figure out how to put it together myself. :slight_smile:

I've been looking at the Uno schematics when I can find time, and I've gotten some FETs to play with, but still haven't gotten that working.

Maybe it's time to consider "buying" a solution.

Do you want to post a schematic of what you have tried and we can see if we can spot where you are going wrong.

Grumpy_Mike:
Do you want to post a schematic of what you have tried and we can see if we can spot where you are going wrong.

I'll try to have a schematic in the next day or two.

Some things confuse me about the Uno schematic.

The Uno has 3 possible power supplies: VIN, the DC Jack, and the USB. There is a MOSFET that seems to be controlling the USBVCC (which, if I'm reading things correctly, is the source for the MOSFET) and it seems to be controlling it based on the output of an OpAmp which seems to be used to compare the 3V3 and a voltage divided VIN. I kind of feel like I know words for all of the pieces, but I'm probably missing a lot of the purpose.

Can someone explain in simple terms what the OpAmp is bringing to the party?

I'm trying to put this together on a breadboard, and I have an LMV358 and a LM386 to play with. I'm trying to use the LMV358. Would the other one be a better choice? Also, the Uno schematic doesn't show the OpAmp connections to VCC & ground, even though there are pins for that. Is this because it is not connected, or because the connections are obvious and therefore not worth noting?

As always, thanks for all of your help!

Can someone explain in simple terms what the OpAmp is bringing to the party?

It is used as a voltage comparator to compare the voltage on Vin with the voltage on the USB port. If it sees a sufficiently large voltage on the Vin pin it uses the FET to switch it in, otherwise it switches in the power from the USB.
in the old days you had to remember to switch a link over to change the power source.

Often the power and ground supplies are not shown on an op amp. However I think you will find them the schematic is is just that there will be a different symbol for them.

So... which VCC should I connect to the OpAmp? Should I tie it to the rail that both the Jack and the battery ultimately hook up to?

I think I'm getting close. Maybe its time to put some effort into that schematic. :blush:

Yes but through a voltage divider, you should not have the input of an op amp, or any other component, higher than its supply.

Here is my schematic. I have no training in electronics, so I hope I've gotten it down correctly.

The LEDs are an attempt to see which parts of the circuit are getting power.

EDIT: See the update posted after this. I had the FET hooked up wrong.

In this configuration, when I put a 6V battery on X1-X2 and have the 9V battery connected, all of the LEDs light up brightly. If I disconnect the 9V battery, there is no noticeable change.

When I connect the 9V battery without the 6V, all of the LEDs light up, but LED1 is very dim, LED2 is very dim, LED3 is bright but slightly dimmer than with the 6V connected.

Any help would be greatly appreciated.

Going back and comparing how I have components wired, I found that I had the MOSFET hooked up incorrectly. (gate and drain reversed)

After fixing that, with both 9V & 6V connected, all three LEDs are bright.

If I disconnect the 9V, LED 1 becomes very dim, 2 & 3 do not change.

If I disconnect the 6V (with the 9V connected), LED 2 dims (about half brightness), and the other two are unchanged.

So now I’m interested in knowing if there is a way to hook up an LED (or use an amp meter or any other method) to determine if the 9V is actually being turned “off” when the 6V is connected.

I just tried disconnecting the output from the 5V regulator on the 9V side from the 5V rail and connecting it to LED1 (replacing LED1’s connection to the output of the FET) In this state, it seems like LED1 should only light up when the FET is passing current from source to drain and the FET’s gate is connected to the other circuit, and should be high when the other circuit is connected to power. (it’s a p-channel FET, so if I understand correctly that should stop current from passing through.) But LED1 continues shining brightly regardless of whether the 6V is connected or not.

Time to compare the OpAmp’s datasheet to how I have it hooked up.

It is not very clear what you are trying to do with that circuit.
Using 6V to power that voltage regulator is not going to work, you need at least 7.5V.

Connecting the outputs of two voltage regulators together is also not a good idea, especially as there will be times when one has no power on it's input.

Thanks for your help.

I think for now I'm going to just use a single power source to keep things simple.