Arduino Forum

Using Arduino => General Electronics => Topic started by: neilbaker86 on Jun 14, 2018, 07:59 pm

Title: Prevent Arduino taking power from input pin.
Post by: neilbaker86 on Jun 14, 2018, 07:59 pm
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!
Title: Re: Prevent Arduino taking power from input pin.
Post by: DaveEvans on Jun 14, 2018, 10:58 pm
....deleted...because @Wawa's advice is so much better...
Title: Re: Prevent Arduino taking power from input pin.
Post by: Wawa on Jun 14, 2018, 11:29 pm
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..
Title: Re: Prevent Arduino taking power from input pin.
Post by: ted on Jun 15, 2018, 03:55 am
The inputs have high resistance, I think the leakage current is in range 5uA @ 5V
Title: Re: Prevent Arduino taking power from input pin.
Post by: westfw on Jun 15, 2018, 06:53 am
Quote
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.)
Title: Re: Prevent Arduino taking power from input pin.
Post by: ted on Jun 15, 2018, 09:02 am
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.
Title: Re: Prevent Arduino taking power from input pin.
Post by: septillion on Jun 15, 2018, 10:06 am
@ted, you might want to watch this (https://www.youtube.com/watch?v=2yFh7Vv0Paw). 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 ;)
Title: Re: Prevent Arduino taking power from input pin.
Post by: ted on Jun 15, 2018, 10:19 am
You right, I connected 3V trough 10k resistor = 100uA,