Combined USB and Battery project - how to switch off battery supply?


Can you draw a schematic of what you're thinking of? Put a blob with "switch goes here" where you think it should go.

An N-type MOSFET can switch the negative side of a load. A P-type MOSFET can switch the positive side. To switch the P-type off, the voltage on the Gate must be raised to be equal to the voltage on the Source. That's means you can't connect the 9V "switch" to an Arduino output as that can't achieve 9V. So you need a pullup resistor and an N-type MOSFET to switch the ground side of the pullup resistor. No current flows when it's off and the voltage drop (and current consumption) when on is very small.


What you ask is quite simple. The conventional way to do it is to use a P MOSFET to switch the + side of the battery on and off. An N MOSFET can then be used to switch that on and off using your ARDUINO.

Refer to the attached drawing.

Q1 in the diagram is the switch element and is switched on and off with the ARDUINO, which is represented by V2, via Q2.
When Q2 is not conducting, Q1 is held off by resistor R1 which may be almost any value but I suggest you keep it in the range of 10K to 1M.

In the off state no current will be drawn save for some reverse leakage in Q2 which will be much less than the self discharge current of your battery.

switch.pdf (8.96 KB)

How much current do you need at those voltages? Just get a boost regulator instead of bothering with a separate battery.

X-Y problem.


Hi again. BJT version added. See attachment. As you will see it is not too dissimilar. You will need the resistors on the base of Q2 otherwise the Output of your Arduino will be clamped to one Vbe (base emitter voltage) of about 0.6V above ground. Other than that, use a darlington transistor for Q1 as it will have much higher current gain. Also bear in mind that the voltage drop across Q1 will be higher than a MOSFET due to Collector - Emitter saturation and its internal emitter resistance which is not real but a function of BJT transistor physics.

switch 2.pdf (8.75 KB)


Hi again. In answer to your question, you guessed correctly. The 0.6V mentioned is indeed the base emitter voltage otherwise known as Vbe. It can be likened to a forward biased diode and will behave in a similar manner. The dynamic impedance of the base emitter junction will diminish rapidly at the point of conduction and will try to draw more and more current from the source supplying it. If left in this state the junction (and transistor) will fail. The upshot of this is that as the output of your Arduino can supply only a limited amount of current, the base emitter junction without a resistor in series will clamp the output of your Arduino to one Vbe above ground which it won't be too happy about.
R3 is there to protect both devices and will allow the Arduino output to function correctly.
Now, to get Q2 to switch on, the voltage on the base of Q2 must at some point be at least 0.6V. The potential divider chain of Q2 and Q3 is calculated to achieve this at about 2/3rds of the output from the Arduino which I assume is about 5V.
The sum is quite simple as follows:
Simplify the value of R2 and R3 to units ie 1 and 4.7. The sum is then (R1+R2)/R2 * 0.6 = 3.42V.
Q2 is a high gain device and is not required to pass much current therefore R2 and R3 may be relatively large values which will put little strain on the output of you Arduino.

Hope that all makes sense.