I am trying to build an auto power off circuit for my arduino nano.
It should wake up by a push button and poweroff by code. I found some circuits in the web, but they are listing items I don't have accessible yet (mosfet or pnp transistors). So I thought I built my own circuit, but it doesn't work. Arduino is starting when pushing the button, but it is powering off immediately although D5 pin of arduino is still high.
Can anyone point tell me what is wrong with my idea? Please explain it for someone who has not much experience in electronics
To turn on a transistor you need to supply a voltage of more than 0.7V ABOVE the voltage on the emitter.
The output of Pin 5 can only ever be 5V but the emitter of U2 is at 9V. Therefore U2 will never turn on.
You can wire a relay that gets driven high by a pin.
Have the power for the arduino get routed through the NO side.
Add switch and jumper from power to manually energize relay.
You would just need to hold down the switch long enough for the arduino to boot up and set the pin high.
butch:
It should wake up by a push button and poweroff by code. I found some circuits in the web, but they are listing items I don't have accessible yet (mosfet or pnp transistors). So I thought I built my own circuit, but it doesn't work.
Slumpert:
You can wire a relay that gets driven high by a pin.
Have the power for the arduino get routed through the NO side.
Add switch and jumper from power to manually energize relay.
You would just need to hold down the switch long enough for the arduino to boot up and set the pin high.
I also thought about a relay. I tried what I have here, but it consumes 60mA while activated. Since my target is to save power 60mA are way to much during operation.
Grumpy_Mike:
To turn on a transistor you need to supply a voltage of more than 0.7V ABOVE the voltage on the emitter.
The output of Pin 5 can only ever be 5V but the emitter of U2 is at 9V. Therefore U2 will never turn on.
I understand your point, but then I don't understand the following point. When I try to drive a LED with 2nd transistor, why is it shining? And if I check voltage between Emitter of transistor2 and ground, why do I get about 5V there?
Hutkikz:
@butch You should also tell us what transistors you are using.
butch:
When I try to drive a LED with 2nd transistor, why is it shining? And if I check voltage between Emitter of transistor2 and ground, why do I get about 5V there?
OK, you chose not to answer my question, but anyway ...
This clearly will only do anything as long as you press the button. So your yellow LED can only shine while you press the button.
It shines if you have programmed the Nano (probably my favourite/ most practical Arduino) to set pin 5 HIGH. You have an emitter follower - the emitter will be pulled up to 0.7 V less than the base, so if the Arduino regulator on Vin is getting something approaching 9 V (your 9V battery voltage less 0.7 V in the base-emitter junction of U1) then pin 5 will be getting almost 5 V and the base of U2 will be getting less than that by the drop in the 6k8 resistor so the emitter will be pulled up to 0.7 V less than this, perhaps about 4 V but sufficient to light the LED.
As Mike explained to you, in the original circuit - OK, here it is again: When you press the button, Vin will receive about 8.3 V, feeding the inbuilt regulator so that there is 5 V on the 5 V pin.
If the Nano sets pin 5 "HIGH", that will be about 5 V, and the base of U2 will see 5 V. Recall that U2's emitter is at 8.3 V so the emitter-base junction sees minus 3.3 V. As you should know, to turn a transistor on, you need plus 0.7 V on the emitter-base junction, so there is no way that U2 can conduct from collector to emitter. In fact, if pin 5 is LOW, there will be minus 8.3 V between base and emitter which is generally above the Zener breakdown voltage and fortunately, the 6k8 resistor will limit this current.
There is a reason for the circuits you found "in the web". You cannot switch your own supply without both an NPN and PNP transistor (or even better, P-channel logic-level FET).
Arduino is starting when pushing the button, but it is powering off immediately although D5 pin of arduino is still high.
I ever have similiar problems like this, to control stepper motor with TB6600 driver, and i solved the problems.
I connected GND and 5V with 110k resistor from arduino to push button.