Prevent Arduino taking power from input pin.

I have a 5V DC signal coming from an external device, which is there permanently, even when my Arduino is powered down.

I need to be able to monitor this signal, to see if it ever goes low (to ground), and also be able to short it to ground myself.

What is the best way of connecting this to my Arduino, as I've read that the Arduino will attempt to power itself through the digital input pin from this external device when it itself has no power.

Any help or advice would be much appreciated!

....deleted...because @Wawa's advice is so much better...

The solution depends on the '5volt signal'.

If grounds can be shared, and the signal can sink:
Use internal pull up on the pin, and a diode (1N4148) between pin and signal (cathode to signal).

If grounds can be shared, and the signal can source:
Use internal pull up on the pin, and an NPN transistor between pin (collector) and ground (emitter),
with a 100k resistor to the 5volt signal.

If grounds can't be shared:
Use internal pull up on the pin, and an opto coupler, with opto transistor between pin and ground,
with the opto LED driven by the signal via a (~5k) current limiting resistor.
Leo..

The inputs have high resistance, I think the leakage current is in range 5uA @ 5V

The inputs have high resistance, I think the leakage current is in range 5uA @ 5V

It's not leakage that's the problem. The protection diodes present on IO pins will conduct when the AVR is otherwise unpowered and inputs are connected to +V, and this will power the chip (perhaps unreliably, since it may not include all the power pins.)

I measured the resistance on one of pins when power is off it is 2.5 MΩ, to that pin is connected LCD, 60% pins are connected to something.

@ted, you might want to watch this. I don't know how you measured it but you can't do it just in the ohms range of a DMM. The diodes are non-linear and the current depends on what else is connected to the uC. Just don't connect power to an input when it's off :wink:

You right, I connected 3V trough 10k resistor = 100uA,