tactile off and programmatic off

Are you one of these persons that listen to radio play or music to get asleep?
I do, and it’s anoying when the story is over and the device is still turned on and you can “hear” the electrons “running” aka it wont shut off.

So i try to build and mp3 player that plays random stories and turns it self off if finished. And if your still awake a button press is enough to play another one.
For this i need a circuit to shut the power of on a progammed event and turning back on on a button press.

There are existing circuits for this kind a thing, but i wanna do for my own ;)

Ok, first thing … on/off is said a bit to much, its more a hybernate with ~729µA.
for the example following components are needed:

  • 5V Source
  • Atmel Mikrocontroller ATtiny 85-20PU, DIP-8
  • Timer-IC, Typ 555, DIP-8
  • resistors: 1x 100kΩ, 2x 10kΩ, 2x 220Ω
  • 2x led’s
  • 1x 1µF 50V condensator
  • 1x NPN transistor
  • 1x tactile switch
  • 1x flip switch

circuit:
cicruit

  • pin 1 booted/online signal
  • pin 2 led to emulate “work”
  • pin 0 to high device goes into shutdown

code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void setup()
{
pinMode(1, OUTPUT);
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(1, HIGH);
}

void loop()
{
delay(2000);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(500);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(500);
digitalWrite(0, HIGH);
}

simulation @ https://www.tinkercad.com/things/1eIpTIWzqyF?sharecode=PadZPFMSf-PpKL_I-p0J0354EAafbRVyNFPu2P5ZGCA