Author Topic: Auto turn off circuit  (Read 244 times)

0 Members and 1 Guest are viewing this topic.

Offline piwicodeTopic starter

  • Newbie
  • Posts: 2
  • Country: fr
Auto turn off circuit
« on: November 19, 2024, 09:16:09 pm »
Hi,
I designed a latch that can be turned on when shorting SW_ON pin to the ground and turned off when shorting SW_OFF pin to the ground.
The idea is to wake-up when an RTC clock chip alarm triggers, then do some action including servo operation, and finally turn the power off.

Please find the circuit attached.

When operate from the button, the circuit works as expected, but when the AT328P tries to turn the system off shorting SW_OFF pin to the ground, I just get a reboot.
I suspect that the AT328P gets under powered before the voltage gets low enough for the latch to change state.

How would you troubleshoot this issue?
Any suggestion?
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6390
  • Country: de
Re: Auto turn off circuit
« Reply #1 on: November 19, 2024, 09:24:05 pm »
Your resistor values are far too high, especially R1. Try dividing them by 10 or even 100 before moving forward.
You can always optimise afterwards.
 

Online Peabody

  • Super Contributor
  • ***
  • Posts: 2214
  • Country: us
Re: Auto turn off circuit
« Reply #2 on: November 19, 2024, 11:00:04 pm »
I assume the purpose of R2 is to latch on the power.  The problem with that on shutdown is if there is aggregate capacitance in the load circuit such that voltage declines slowly, then the NPN can be turned back on again by as little as 0.6V on its base when the Off button is released.  The GPIO will go tristate when Vcc drops below about 2.5V, which leaves R2 in control.

The alternative would be to eliminate R2, and have the 328P turn on the NPN as its first official act on bootup.  Then when it's ready to shut down, it would just bring that GPIO low, or make it an input, and there would be nothing that could turn power back on again.  You wouldn't need the Off button.

And I agree that the R1 value is a bit high.  I usually use 100K there.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf