All pins tied high/low when only Vcc/GND connected

Hi all,

[you can skip the next part it just demonstrates the problem]

so I was tinkering around with some MOSFETs trying to have an arduino turned on by a button and turned off by itself. I need the Mosfet to control the GND line so I can have the gate voltage higher than the source. The Arduino then had Vcc connected to 5V and D4 connected to the gate of the MOSFET (with pulldown resistor), nothing else. However it always turns on even if the gate isnt pulled up.

[important part]:

I measured the voltage with my dvm and when only Vcc is connected to the arduino, all (yes, all off them) pins are at approx. Vcc - 0.2V. this is not just floating because with a 680 ohm pulldown resistor it can provide ~3mA.
Same when only GND is connected, all pins have a voltage of Vcc - 1V relative to 5V.

So my conclusion is, that without complete Power connected, the arduino behaves like a diode (?) between pins and GND/Vcc.

Did I make any mistakes? why does it happen? how do i prevent it?

I hope this isnt to specific for this section...

thanks in advance

So my conclusion is, that without complete Power connected, the arduino behaves like a diode (?) between pins and GND/Vcc.

Yup. Like a "clamping diode". Because the processor has a few.

why does it happen? how do i prevent it?

Post a schematic.

All pins on the ATMega processors used in the arduino - as well as the pins on most microcontrollers and many digital IC's - have internal "protection diodes" between each pin and Vcc or Gnd.

If you have Gnd disconnected, current drawn by the micro and leakage will rapidly result in 5v on Vcc and ~5v on Gnd. The protection diodes will then hold each pin within a fraction of a volt of 5v.

It is important to never apply a voltage higher than Vcc or lower than Gnd to any I/O pin - these protection diodes are meant to dissipate static, not conduct high current, and can be damaged by even a couple of milliamps. When the chip is not connected to Vcc, no applied voltage should be present on any pin unless there's a series resistor to limit the current. Likewise, when the chip is not connected to Gnd, no pin it's connected to should be driven low or otherwise provide a path to ground.

"backpowering" the arduino board through an I/O pin like you were doing is the most common way to blow a pin, and I think the second most common way to damage the board (most common being abusing the power rails)

The arduino should turn on when the button is pressed, then turn A5 high (to keep itself on). It should turn off after some time set in the code.

So you know now why that can never work?


I believe parts that start with "IRF" are not logic level. Independent of this problem you should ensure the MOSFET is appropriate for the application.

Irfz44n is not logic level - though the typical properties chart suggests it could be used for very light loads (relative to its maximum rating), like just an arduino and low current electronics. A much better choice is irf3708, which works even with 3.3v logic levels

iirc IRF### is always standard voltage, IRL### is always logic level, IRF####, and I think IRFZ are a mixed bag, see datasheet.

The fact that the rest of the project is flawed is a different matter.

It's a real shame that arduino never made a low power version of the boards that got rid of all the power hogging parts - so many people here try to do dumb shit like this that could be done with sleep mode, except that the crap on the board like regulator and power led waste power even when MCU is sleeping.

There's no simple way to switch the power to the Arduino with a single transistor or MOSFET and
also allow the Arduino to control the switch.

At least two active devices are necessary to do this. This is a common trap for the beginner.

[ Actually if you allow a low power reed-relay to count as an active device and a signal diode
as passive, you can do it ]