I’m using this circuit to turn on and off an Attiny85 and a led driver with the push of a micro switch.

on/off switch circuit

My circuit is powered by 7.4V battery.

In the “load” part of the circuit there’s a voltage regulator to 5V and then the Attiny.

And also a led driver that get’s powered directly from the 7.4V, without going through the voltage regulator.

It works pretty well, but I’d like to be able to, when the batt is at a low state, to use an output pin of the attiny to turn off the whole circuit.

I already have a voltage divider circuit and code to check the batt levels, but I don’t know how to interface an output of the Attiny with this circuit.

What should I change in this circuit (if possible) to be able to, besides using the micro switch to turn on and off, also to be able to turn off it entirely by a signal from the Attiny?



1 Answer 1


I would use a bipolar transistor with its collector to the right terminal of the on/off switch.

Emitter to ground. And a resistor to the base that is driven by an output from your MCU.

Set the signal high to turn power off.

Ensure that the transistor does not get turned on during the power-up and initialization of the MCU.

  • \$\begingroup\$ It seems perfect! I ran a simulation and it worked. I’ll assembly in my pcb tomorrow and let you know if it works!! Thanks! \$\endgroup\$
    – Rodrigo
    Commented Oct 14, 2020 at 1:24
  • \$\begingroup\$ Worked flawlessly!! Thanks!! \$\endgroup\$
    – Rodrigo
    Commented Oct 14, 2020 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.