I am having trouble with an ATtiny85 that I want to turn on using a momentary push button and run for a set period of time before the Micro truns itself off. The unit will be battery powered so I want minimal to no current draw when the unit is off.
Please see attached schematic.
The following test code is used:
The unit turns on as soon as I apply power which I do not want. I thought the 100K would hold the base high on the PNP to stop it turning on.
Then, after a preset time, my code takes the base high but it does not switch the transistor off. This is probably due to the pin 4 only recording a voltage of 4.35 volts when on (with 5 volts on VCC) . I have tried another ATtiny but it gives the same voltage. Disconnect the 470 resistor and I get 4.97 volts. When the code takes the pin low, it records a voltage of .17 volts; i.e. it does not take it to ground. The LED tells me when the micro is on.
Can someone tell me how to get this circuit to work?
Add an NPN transistor.
Emitter to ground, collector to the 470ohm resistor.
Base via a 10k resistor to pin3.
Reverse logic now, so change your code.
A HIGH on pin3 will turn both transistors on.
Leo..
Have a look on this video, I believe this is the circuit you're after: https://www.youtube.com/watch?v=9CnTguj_qvY, but the current consumption for an AVR during sleep is so small that it might be better just use the sleep methods. Just use your push button to wake up the AVR using an interrupt.
Also, reduce your voltage to 3.3V, that will help preserving battery even further.