Arduino UNO powered through input pin

I have read the topic with the same subject heading but there was no solution, only a brief mention of the harmful consequences of doing this. I need a solution.

I have written a sketch that looks for a HIGH signal on an input pin (#2 in my case). I am connecting a thermostat to the input pin. When the thermostat calls for cooling a 5Vdc signal is sent to pin 2. The pin will receive the 5Vdc signal for an extended period of time (until the room is cool enough for the thermostat to turn the signal off. Like the aformentioned post the UNO board is unintentionally powered from the input pin. I have a separate power supply through the USB plug that is intended to power the board itself. I am considering placing a resistor in series to lower the voltage to a level (<.5Vdc ?) where the pin will recognize it as HIGH, yet not enough to power the board. This does not seem to me to be a complete solution, my fear is that it will still harm the pin in the long run. Does anyone have a solution to my problem, I would appreciate any input.

No.

You have so many wrong ideas I don't know where to begin.

An unpowered AVR is not going to read a pin and power itself from it.

Arduino pins have input protection diodes to the supply and ground rails.
If you connect a voltage to an input pin that is ~0.4volt higher than Arduino’s supply, current flows into the input pin, through the input protection diode, to Arduino’s supply rail.

One way to stop this is to limit the input voltage to <= the supply voltage (3.3volt or 5volt).
Another way is to limit the current into the pin with a series resistor (to <= 1mA).

So does this thermostat output a voltage?
If it’s just a switch, then connecting it between Arduino’s 5volt and analogue in should solve your problem.
Leo…

Just put a diode in series with the 5V logic input - cathode to the source, and use the internal pull-up on the Arduino.

This presumes that if the thermostat is not sending the 5V, it pulls the signal to ground.

Paul__B:
Just put a diode in series with the 5V logic input - cathode to the source, and use the internal pull-up on the Arduino.

This presumes that if the thermostat is not sending the 5V, it pulls the signal to ground.

If the thermostat is powering the Arduino through the input pin, the thermostat must be sourcing 5v... If it just pulled low, this problem wouldn't exist in the first place.

However, this solution could still work, assuming the thermostat's output can both source and sink...

A series resistor could also solve the problem, and is what I'd probably try if it were me - if you put something like 20k-100k in series with the input, not enough current could flow to damage anything, and it should prevent the input from powering the chip through the protection diodes.

DrAzzy:
If the thermostat is powering the Arduino through the input pin, the thermostat must be sourcing 5v... If it just pulled low, this problem wouldn't exist in the first place.

My logic was that the thermostat is in fact, powering some other piece of equipment, so it must have an inherent pull-down. :roll_eyes:

The reason open-collector/open-drian outputs are commonly used is you never have any
phantom powering issues like this - and if you use a decent output device you don't have to
worry about voltages either.

Powering any system inadvertantly via protection diodes can damage the chip, if in doubt
use a series resistor to limit the current, or a diode (which is basically faking an open-drain
output if you think about it).

This does not seem to me to be a complete solution, my fear is that it will still harm the pin in the long run. Does anyone have a solution to my problem, I would appreciate any input.

It sounds like your thermostat is a simple on / off signal. If so then simply put it through a transistor or use an opto isolator.