Pages: [1]   Go Down
Author Topic: Switch between 2 voltage sources  (Read 481 times)
0 Members and 1 Guest are viewing this topic.
New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 518
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm building a PCB where a Arduino Pro Mini will plug into headers on the PCB.  I'll also have a header on the PCB for FTDI connection so I can program the Arduino.  Normally the FTDI cable can supply 5 volts to the Arduino, but when I am powering the Arduino with another power supply, I don't need or want to use the 5 volts from the FTDI cable.

I'll have three scenarios for the Arduino Pro Mini:
1) At my desk when I'm programming, I'll have FTDI cable and the mini should be powered by the 5 volts from the cable.  It will not be connected to any other power sources.
2) In my project, no FTDI is connected and I'll have 5-12 volts (not sure which yet) connected to the Arduino RAW (Vin) pin.  Note: The Arduino Pro Mini has a regulator that brings this down to 3.3 volts.
3) Once in my project, I may need to make programming changes, so I'll want to plug in my FTDI cable to to this.  The Arduino already has power, so I don't want the 5 volts from FTDI to reach the Arduino, it should continue to get power from the 12 volt source.

So I'm looking a circuit that will let the FTDI power the Arduino if there is no other power source, but if there is, I don't want the FTDI power going to the Arduino. The simplest thing is to just add a little switch on the FTDI voltage pin, but I'm concerned I'll forget to use it, especially if a lot of time has passed and I forget all about this.

I looked at the schematic for the Arduino Uno (attached) because the some of the Arduinos do this.  The Uno uses a LVM358 op amp connected to a FDN340P p-chan MOSFET.  I think the op amp is used as a comparator.  I don't understand completely how the Uno circuit is working.  From what I can tell if Vin = 0, then the op-amp compares this to 3.3 volts and brings the output of the Op amp low which is connected to the MOSFET gate.  With the gate low, current flows from source to drain, source being USB power in this case.  If Vin > 3.3 volts the Op-amp output goes high and stops current flowing in MOSFET.  I think I've got that right, what I don't understand is if Vin = 0, where is the 3.3 volts coming from used by the op-amp.  I guess if Vin = 0 and you plug in the USB, then current will flow in the Mosfet, and then make it to the 3.3 voltage regulator.

My circuit shouldn't draw more then a few hundred mA, if that.

I'm interested in recommendations on how to do this.


* Screen Shot 2013-08-28 at 11.07.15 PM.png (25.9 KB, 1072x370 - viewed 36 times.)
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Something like the attached should work.

Resistor could be 10K.  Shottky diodes would work best.  MOSFET is logic-level P-channel.  Make sure the MOSFET and diodes can take the current you need.  VSupply should be at VUSB or higher for best results.  You could probably replace D1 with a wire.

In fact, if you want to keep it really simple and if VSupply > VUSB  you could probably loose the MOSFET and just use the 2 diodes.


* power switch.jpg (21.98 KB, 809x493 - viewed 44 times.)
« Last Edit: August 29, 2013, 01:42:26 pm by BillO » Logged

Facts just don't care if you ignore them.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26933
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the Nano schematic - I think that just uses a diode also.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 518
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Something like the attached should work.

Resistor could be 10K.  Shottky diodes would work best.  MOSFET is logic-level P-channel.  Make sure the MOSFET and diodes can take the current you need.  VSupply should be at VUSB or higher for best results.  You could probably replace D1 with a wire.

In fact, if you want to keep it really simple and if VSupply > VUSB  you could probably loose the MOSFET and just use the 2 diodes.


Thanks that looks like what I need. I'll give it a try.
Logged

Pages: [1]   Go Up
Jump to: