Soft power switch schematic. Thoughts?

I'm new at this so I need someone to double check my plan, and I'll take any advice.

I am planning to create a soft power switch with a momentary button, so you basically just hold the button down long enough for the Arduino to boot up and pull down the gate pin on the mosfet to keep it on after the button is released. The Ardino needs to be able to sense when the button is being pressed when it is on because it will be used for other things, as well as it needs to know when to shut off. Also, there is an extra mosfet to control an led that is attached to the switch.

So, in short, there are three mosfets. One that controls flow from the battery to the Arduino, one that connects the first mosfets gate pin to ground, and one for the led.

When the button is pressed, the arduino gets a connection directly to power.

The diagram is below. Please ignore the resistor values and the battery voltage, as I haven't quite determined the proper values for those.

Thank you.

Hi,

I think this is what you are trying to do, I haven't tried it, just interpreted your frittzy diagram, correcting some wiring problems.

Tom... :slight_smile:

+5volt (left) should be +9volt.

This diagram won't work.
A3 will be ~0.5volt when the Arduino is off, because of the pin protection diode.
That will turn the power back on.
Leo..

@Wawa: You are talking about TomGeorge's diagram, right? Mine doesn't even use pin A3 so I assume so.

@TomGeorge: What wiring did you correct? I need to understand the difference between our two diagrams so I can correct mine if needed.

This is what you are trying to do, just interpreted your frittzy diagram, correcting some wiring problems.

  1. Your battery is up side down.
  2. You let the 9V to the A0 pin, I have added a voltage divider.
  3. You did not have a 10K resistor to ground for the N-Ch Mosfet.

Perfect.
I would replace all the 10k resistors for 100k resistors for a bit more battery life.
Which Arduino are you going to use?
An attiny85 with a 1C LiPo could last very long.
Leo..

@BillHo: Thank you. I'm confused about the battery symbol though. Isn't the short line the positive charged side? Also, can you clarify the need for a voltage divider even if I have a resister? And Why do I need a resister from the N-Chanel Mosfet to ground?

@Wawa: I haven't determined what resisters to use yet, but that's a good idea. thanks. And I'm eventually going to use a Arduino Micro.

Nevermind about the battery. I get that part now. I'm a bit foggy on why you would have a resister to ground on the pin going to the N-Channel Fet controlling the LED. Wouldn't that make the charge always 0? How would it ever turn on the Fet?

No, is the long line the positive charged side.

A voltage divider is a simple circuit which turns a large voltage into a smaller one.

Arduino input do not like voltage anything that above 5V, you need to lower that voltage, a single resistor will not lower that voltage. If you using higher voltage than 9V, then you need to change the value of the top resistor to make the voltage read at pin A0 below 5V.

In the schematic the 10k resistor (Pull-down resistor) keeps the Gate at zero volts if the Arduino pin is not configured for output, this keeps the MOSFET off if the processor is booting and has not yet set the pins correctly.

The gate resistor is necessary. It is exactly that current that charges up the small capacitance in the MOSFET that is the problem. The "small" capacitance is often on the order of nano farads, while the digital output of the microcontroller is designed to drive other digital outputs, which are on the order of picofarads. Thus, a MOSFET gate "looks like" 100-1000 little digital inputs all in parallel, all hungry for a little bit of current.

The risk of damaging the microcontroller is real. The short burst of current can, over time, degrade the digital output and cause it to fail. The MOSFET will be no worse for wear, unless in the process of the digital output degrading it fails to turn the MOSFET on fully, the MOSFET starts operating in its linear region, then overheats and fails too.

Hi,
Check this product.

Press button power switch.

google expresspcb for an easy to use CAD that is free.
I'm not sure what CAD BillHo, is using but it looks like a good package too.

Tom.... :slight_smile:
PS The A3 was hastily put in last when I realised the OP wanted to monitor the button for other purposes.

The CAD that I used was DesignSpark PCB,

World’s first truly FREE and unrestricted electronics design software. Developed by RS Components/Allied Electronics to enable engineers rapidly design great products.

BillHo, you have been a great help. Thank you. Could you tell me how the gate on the FET would still be charged, allowing it to be closed, if it is connected directly to ground? I would expect it to be 0 volts regardless of what the Arduino is sending out. Am I wrong?

Thanks.

Hi.
The resistor going from gate to gnd, is 10K so the gate is not shorted to ground, it discharges the gate if it is left open circuit.
The 5V from the arduino output and through the 220R resistor is enough to apply the required gate voltage over the 10K resisitor.

It is common practice to do this as the gate behaves like a capacitor and will store any charge put on it, thus holding the FET on.

Tom.... :slight_smile:
PS, Isn't the RS Designspark an online program?

You should learn about voltage divider, when Arduino output pin send out 5V, 220 ohms resistor is much lower than the grounding resistor which is 10K ohms, so most of the 5V will supply to the gate of the FET to turn on the FET.

PS, No, RS Designspark can install in the PC too.

BillHo, Tom, Mawaw, (did I miss anyone?) Thanks to you all. You guys are a big help to a noob like me. I am a programmer so I have already answered a question for someone else about code, so I will try to contribute too. I'm sure I'll be back with questions about the electrical side.

Actually, I have one final question. If the Mosfet does discharge, say, when I turn the arduino off by setting the pin leading to the gate to LOW, what is keepng that discharge from going down the easiest path which is through the 220 resister and into the Arduino? In that case, wouldn't I want that resister to be the higher resistance? But then I couldn't control the gate... uhg... someday I will wrap my head around this.

Hi,
The charge is not big enough to cause any problems going back into the output, only large enough to keep the FET turned on.

Tom... :slight_smile:

What, then is the purpose of the 220 ohlme resister from the arduino to the gate? I'm sorry to ask so many questions. I just feel there is something fundamental that I'm missing here and need to get to the bottom of it.

Zephos:
What, then is the purpose of the 220 ohlme resister from the arduino to the gate? I'm sorry to ask so many questions. I just feel there is something fundamental that I'm missing here and need to get to the bottom of it.

To protect the AVR pin from excessive current when driving a large gate capacitance. A capacitor is effectively a low resistance at high frequencies, remember?

Yeah, I get that, but what about Tom saying "The charge is not big enough to cause any problems going back into the output, only large enough to keep the FET turned on."

How do I reconcile these two statements? Is Tom's statement true only after the current goes through the resister? As in, I use the resister to protect against currents that would clearly be damaging if it isn't there?

I understand that the Mosfet can act like a capacitor, but what does its resistance have to do with the gate circuit, as the gate is just opening and closing the valve, so to speak, and nothing is actually going through the gate pin other than a small control voltage?

Thank you for your patience. I am totally new to all this so please bear with me a little longer so I can wrap my head around this mosfet business.