Prevent ATmega328 from leaking current through ports when GND is disconnected

Hi guys

I have the following circuit to turn on the ATmega with a push button:

The idea is simple: a MOSFET opens and closes the path between the ATmega and GND.
Both the [push button] and [ATmega pin 17] go into an OR gate, which goes into the MOSFET gate.

Once the ATmega starts, pin 17 goes HIGH immediately, which keeps the fet gate HIGH and the fet ON after the button's released.

My problem is: with only VCC connected, the ATmega leaks current through the ports. Say, if I have an LED on pin 5, current will flow through:
VCC -> Pin5 -> LED+Resistor -> GND.

Which defeats the goal of completely killing power to the ATmega.

I thought about controlling the path between +5V and the ATmega's VCC, but due to the Vgs drop of the mosfet, I always get less than 5V at the source.

Thoughts?

Thanks!

I think I'll just use a 4016 CMOS switch and open/close the VCC line to the circuit.

Why on earth would you break ground? Anything attached to the cip will now source through the clamp diodes in the mpu's IO drivers. Not to mention the tiny detail that the mpu has voltage regulators who refence to ground.

We just had a thread about self power down have a look at that.

due to the Vgs drop of the mosfet,

A MOSFET will work in the VCC path, there shouldn't be any appreciable voltage drop.


Rob