Circuit for momentary switch to turn Arduino on (then hopefully off too)

Hi,

I have a project where a momentary switch should turn an Arduino on. My idea on how to achieve that, is to have the switch connected to the base of a (NPN) transistor, so whenever I press the switch, the Arduino’s power circuit gets closed, therefore it gets energized. As soon as it does that, the arduino sets the base of another transistor to HIGH, which maintains the Arduino’s power circuit closed, so the Arduino can function without the need to keep that button pressed.

You can see what I just described in the sketch I have included below. So, any thoughts on that? Will it work (I guess it will) or are there any BETTER ideas to do what I want?

Moreover, later I intend to turn the arduino off with the same momentary switch if possible. I have some ideas, but any suggestion on how to do that are totally welcome. :slight_smile:

Almost everything in that schematic is wrong.

Uhm, care to elaborate? :}

I don't know. I can only read correct schematics. :slight_smile: But the battery is backwards, unless you plan to fry the Arduino. When I untangle things, I like to start from the power supply. Pin 2 of the battery is negative, and you have that going to Vin.

You can read this link for the design of your circuit

BillHo:
You can read this link for the design of your circuit

http://forum.arduino.cc/index.php?topic=347154.msg2393718#msg2393718

Yeah, that's what I'd need, however, it seems more complicated than I can afford at this moment, so the option for putting the MCU in deep sleep, appears more attractive now. However, why wouldn't the circuit i proposed work? (aside of the upside down battery)

Why not KISS. Use a toggle switch?

kuruki:
Yeah, that's what I'd need, however, it seems more complicated than I can afford at this moment, so the option for putting the MCU in deep sleep, appears more attractive now. However, why wouldn't the circuit i proposed work? (aside of the upside down battery)

Follow the turn on sequence. Initially, Q1 and Q2 are biased off. S1 closes, supplying base current to Q1. Q1 collector passes current from the battery negative terminal to the Arduino ground and it turns on. Software now enables and sets D7 high. This biases Q2 on. After a while, S1 is released. Now the battery positive has no connection to anything, and Q1, Q2 and the Arduino all turn off.

Thus, the Arduino turns on with the pushbutton and turns off when it is released. The entire circuit can be replaced with one pushbutton. Or more sensibly, as in reply #6, a toggle switch.

:slight_smile: :slight_smile: :slight_smile:

aarg:
Follow the turn on sequence. Initially, Q1 and Q2 are biased off. S1 closes, supplying base current to Q1. Q1 collector passes current from the battery negative terminal to the Arduino ground and it turns on. Software now enables and sets D7 high. This biases Q2 on. After a while, S1 is released. Now the battery positive has no connection to anything, and Q1, Q2 and the Arduino all turn off.

oh, now i see it! Thanks! So, this would be fixed if i’d move the wire “before” the S1 switch, as in the attached schema, correct?

Just put the switch across transistor Q2 collector-emitter.

Archibald:
Just put the switch across transistor Q2 collector-emitter.

Not sure I understand why to do that (I hope you have checked my revised schema)

kuruki:
Not sure I understand why to do that (I hope you have checked my revised schema)

Transistor Q1 and its base resistor are unnecessary.

As it stands in your revised scheme, when the switch is closed, transistor Q1 switches on, connecting the negative (hopefully!) terminal of your battery to the ground of your Arduino. If instead you connect your switch across transistor Q2 collector-base, that's the same thing as connecting your switch from negative battery to your Arduino ground. Operate the switch and the Arduino will turn on. Transistor Q2 can then keep the Arduino powered-up for as long as necessary.

On thinking about it, this is not a very normal thing to do.

This is because the ground of your peripherals can only at the best be sitting 0.7V below the ground of the Arduino. Measure it and it might be closer to 1V. This gives a problem with the devices at least. It means that they can go negative.

This sort of thing is best done with a top switch (high Side) using a PNP transistor.

BillHo:
On thinking about it, this is not a very normal thing to do.

This is because the ground of your peripherals can only at the best be sitting 0.7V below the ground of the Arduino. Measure it and it might be closer to 1V. This gives a problem with the devices at least. It means that they can go negative.

This sort of thing is best done with a top switch (high Side) using a PNP transistor.

Even if you switch the positive supply to the Arduino (sometimes colloquially called "top switch" or "high side"), it's advisable to switch the power to all peripherals at the same time to ensure no peripheral puts a voltage into any Arduino input while the Arduino is not powered-up. If you switch all peripherals with the same, it may well make no difference whether you switch the positive or negative supply.