"Phantom Power" to Arduino via input pin???

I just had an interesting thing happen which perhaps somebody could explain in terms of electrical properties of the ATMega328P in my Uno... It reminds me of "phantom power" for one-wire devices, except in involves a whole Uno running successfully without power except via one input port.

This is not about something not working; it's about something working just fine when it should be inactive.

I have two Uno's (master and slave), separately powered, and connected to each other by only 3 wires: * Ground to Ground * Master D9 to Slave D8 * Slave D9 to Master D8 (this was not really neccessary for the phenomenon)

On both, D8 is configured as input, D9 and D13 (for the LED) as outputs. Both powered by separate USB supplies (two laptops actually).

The master was toggling D9 out every 500ms, the slave was watching for that transition on its D8 and signaling back to the master on its D9. The Slave would also toggle its D13 every cycle. I was testing timing and synchronization. D8 out from the master was mostly on, dipping low briefly.

Then I removed power from the Slave. And it kept running, at fulll speed (the timing of the signal going back to the master did not change). The Master was still receiving its handshake from the Slave; the power LED on the slave was on, and the D13 LED was toggling normally. The LEDs were a bit dimmer tho. I could successfully remove the Slave D9 to Master D8 wire but not the Master D9 to Slave D8 wire - really the Slave only needed 2 wires, Ground plus D8 connected to Master's D9.

I figure that the Slave AVR microcontroller was being powered via its D9 input from the Master's D8 output. Successfully enough to keep the Slave running at 16 MHz and sending its own output signal back to the master. Plus enough power to run D13's blinking LED. Not only that, but it must have been "sharing" that power back out the 5V power inputs, and powering the rest of the board, including the power-status LED. There must have been enough capacitance to hold up during the brief time that the Master's D8 was low.

Does that make any sense to those that know the microcontroller hardware better? Other explanation? Have you ever seen this? (It's easy to reproduce if you are curious or dubious).

I didn't leave it connected long (tho I verified it a couple more times the next day), as I was concerned that the power path incoming from D8 might be going through paths not meant to handle power, at least not "flowing uphill" as it were.

I searched here before posting, but could not find any successful keywords to search the Forum for a similar occurrence. It's not easy to guess the right keywords for an anomoly like this!

I wonder if this could be deliberately used? I did found a thread here from somebody who wanted to supply power and data to an Arduino with fewer wires; he was getting suggestions like POE and AC coupled power/data. But it looks like for some purposes one might be able to power and signal an ATMega328P with only 1 data wire and ground, almost like a (write only) OneWire device.

And - it's something to be aware of. Suppose the unpowered Uno controlled a motor via another output; despite being unpowered when one of the inputs received 5v, it could continue to function and to control the motor, even send SPI or I2C commands to a controller so this is not like a static zap.

This may qualify as a type of schrödinbug.

The datasheet says IO pins should not have voltage applied that is higher then VCC + 0.5V to avoid damage. That said, the oddities of current leaking past IO pins to power other parts of the chip has been discussed here before.

29.1 Absolute Maximum Ratings* Voltage on any Pin except RESET with respect to Ground ...-0.5V to VCC+0.5V

*NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

I have two Uno's (master and slave), separately powered ...

When you say that, do you mean one of them is unpowered? Or, this happens after you disconnect the power?

I just connected together two Unos and did not observe this, but perhaps the duty cycle on the pin is important? As CrossRoads says, this is probably going outside specifications. For example, the noise from the "power" supply, being interrupted, may cause unwanted behaviour.

Both were (separately) powered to start; then power was removed from the Slave, so that its only connections were Ground and the two data pins (in and out) connected to the other (still powered) Arduino.

Yes, the duty cycle is probably important. The master's D9 (going to the slave's D8) was on (1) most of the time - probably off (0) less than a dozen microseconds about twice a second. So the capacitive holdup is not needed for long.

As for an IO line being above VCC, it's an interesting case when there is no VCC (the vcc input is not powered). My guess is that it's only a protection diode's drop higher. My (perhaps naive) concern is less about voltage than current - I'm guessing that the io pin's protection diodes are conducting power to the rest of the microcontroller, but they were probably not intended to conduct much current...

"That said, the oddities of current leaking past IO pins to power other parts of the chip has been discussed here before."

Could you help me find that? I haven't yet find the magical keywords (just tried some from your description, too).

I'd just look for the same kinds of terms. Discussions were not much more than what you've asked. Might have been in the Old forum too.

it's an interesting case when there is no VCC (the vcc input is not powered).

There is nothing special here, so the Vcc is zero volts, the rules still apply! This is a well known way of frying your chip, don't do it. It happens will all sorts of chips, it is not new or extraordinary. The protection diodes should only be asked to carry 1mA.

Basically its powering the chips through the internal protection diodes. You could probably "get away" with it if you were driving light loads and not using LEDS but if you continue to do that as you are, you may end up blowing up the diodes and rendering those pins nonfunctional.

Regarding cautions: Well, I am not continuing to power it this way pending more knowledge, but thanks for the warnings.

The 1ma limit mentioned for protection diodes is the kind of info I did not have, tho, so I'm glad I asked.

I would disagree somewhat about VCC. VCC input is floating, not grounded at 0V. This is not a case where there's a power supply trying hard to keep the other end of the diode at a fixed voltage. In fact the floating VCC rail is being raised via that same diode to about one diode drop below the D8 digital input; still apparently within the chip's operating voltage so the rest of the chip seems to be woking.

The current limit (cited above as 1ma) for the protection diode is a larger concern, especially if off-chip LEDs are being powered.

The main lesson here is what I said last time - it's something for us to be aware of, that a chip could actually operate (and accidentally actuate some output) if some input pin is driven to 5v from a different supply. I did not know that.

That begs the question: What's the accepted form of input protection one should build into their circuits, then, to keep outside sources from reverse-powering the micro? I expect it would be quite common for signal sources to be alive and present while the sensing IC is otherwise unpowered.

I would have thought it was quite common for, say, an I2C bus to be active even though a device connected to it was not powered up.

Again, I haven't reproduced this phenomena personally.

But it would be rather strange would it not, if you queried devices (eg. via I2C) to see if they are switched on, and the query itself switched them on?

I would disagree somewhat about VCC. VCC input is floating, not grounded at 0V

You might disagree but would be wrong. Vcc is NOT floating there are internal connections in the chip that connect it to ground.

In the case of I2C the current is limited by the pull up resistors so the damage done is less. It is still very bad practice however.

This is really rocking my world right now. I wonder what horrors I've done leaving a USB CD-ROM plugged in via USB, while being disconnected from power, for instance. I never thought to care.

The one thing I've learned while designing electronics is how little I know about electronics. Usually, this occurs when I'm starting to feel proud of myself for something. It sure explains why, when I see an experienced designer's schematic, I think, "that looks awfully complicated for what it does."

SirNickity: This is really rocking my world right now. I wonder what horrors I've done leaving a USB CD-ROM plugged in via USB, while being disconnected from power, for instance. I never thought to care.

The one thing I've learned while designing electronics is how little I know about electronics. Usually, this occurs when I'm starting to feel proud of myself for something. It sure explains why, when I see an experienced designer's schematic, I think, "that looks awfully complicated for what it does."

Many commercial products are already protected against this sort of fault.

What's the accepted form of input protection one should build into their circuits,

I don't think there's a generic protection method, it depends on the application.

You could for example drive a signal through a diode with a pullup on the "slave" side. Or use buffer chips like the TXBxxxx that shuts the buffers off if one or other VCC pins are floating. You can tri-state any outputs from the master chip or just drive them low when you detect that the slave is not powered. etc etc.

Straight series resistors may appear to work because there may not be enough current to start the slave chip, but there will still be current flowing.


Rob

I wonder what horrors I've done leaving a USB CD-ROM plugged in via USB, while being disconnected from power, for instance.

How can a USB device be plugged in and not powered?

I expect it would be quite common for signal sources to be alive and present while the sensing IC is otherwise unpowered.

No it is not common at all. Driving a signal into a device that is not powered is hardly ever encountered. The only common case I can think of is plugging an RS232 cable into an unpowered device, but the buffer chips protect the rest of the circuit.

The best form of protection is to use an opto isolator. Next best is to use catching diodes to the rails and series resistors like here:- http://www.thebox.myzen.co.uk/Tutorial/Protection.html

Grumpy_Mike: No it is not common at all. Driving a signal into a device that is not powered is hardly ever encountered.

Well as a few examples:

  • A DVD player with digital output plugged into an amplifier (or TV) which is turned off at the power point.
  • An Ethernet cable plugged into a Ethernet switch which hasn't been powered up.
  • You plug your iPhone (via USB) into a PC, and then turn the PC off when you go to bed

A DVD player with digital output plugged into an amplifier

Digital output plugged into an analogue audio amplifier!

These examples are not at all the same as sending an input into a powered chip. In consumer electronics there is all sorts of protection on inputs and outputs, you never connect them directly into a chip. Most have at least catching diodes in like I said. Audio amplifiers are invariably AC coupled.

I'm not trying to argue with you Mike. And no doubt consumer electronics is designed to be idiot proof.

However modern amplifiers have digital inputs (co-ax sockets in some cases). I have no idea what's inside the box, but theoretically you can be putting a digital signal into the amp, where - possibly after navigating some protection circuits - it hits a digital processor chip.

I suppose with things like I2C you might expect that both ends would be powered, and on a single board that would certainly be the case. But once you start talking about "cable runs" for I2C/SPI and how it is a 2-Wire protocol (SDA+SCL+GND) then one presumes that each end is individually powered. And therefore one end powers up before the other one.

As people seem to be agreeing, the plug and play cables of consumer electronics are going to tend to be somewhat protected from common scenarios, in various ways. For the most part (due to static and EMI consideration as well), they are not going to connect a microcontroller pin directly to some jack on the exterior of the device; if they do, it will be specially designed for that.

This situation arose when connecting one naked microcontroller output to to the input of another microcontroller (no special protection except what is built into the chip), with separate power supplies such they won't both be turned on or off at the same millisecond. Since I was connecting both ways (master out to slave in and slave out to master in), there was not way I could power down both at the exactly the same time.

Basically, such situations can and often will occur any time you are jumpering microcontroller based electronics together in some circuit with more than one power supply. So if your Arduino is powered by USB but connected to a breadboard circuit with its own power supply (say a sensor or actuator of some sort), can you turn the two supplies on and off at exactly the same time? What if one side is battery powered?

One concern is damaging a microcontroller. My suspicion is that while it's not a good idea, it probably isn't super sensitive to this because most people who have ever used two power supplies while prototyping have probably run into it without noticing. Using a resistor between the microcontroller might help some.

If one accepts Grumpy_Mike's model that an unconnected VCC in the slave is effectively at 0V, then no input to an unpowered microcontroller should ever be above 0.5v, period. In addition to two processor situatins, think of something like in analog input connected via voltage divider to a battery or solar panel, used for voltage monitoring when operating normally. I suspect we have a bit more slack than that model (and that there is a difference between leaving the VCC input unpowered and actually tying it to ground), but you can decide for yourself and caution is wise. I would certainly not advise deliberately using phantom power, but I'm not going to say "never, ever use two power supplies that cannot be powered or unpowered within milliseconds of each other".

Total current is another aspect. In my case, the slave ATmega328P was powering itself, two small on-board LEDs, and the output that returned to the master. If it was in a circuit to put out 40ma on several pins, obviously it would have attempted to draw more current from the 40ma output of the Master (from which it was drawing phantom power). Maybe that would have been more problem for the protection diodes, or even the Master's output. So the more power your controller might draw via an input, the more you might want to be concerned.

(Since I'm using DIP based Arduinos, I may order another ATMega328P from Mouser for $2.50 next time I have an order, and keep a spare around).

The new caution I learned was that we should be aware that the "unpowered" microcontroller might actually begin or continue operating. It could even send out well formed commands over SPI or I2C or RF; in a few situations that could be problematic - you think a system is off but it continues to function. Probably not often a concern, but if we are ever working with systems where having the microcontroller operate when we think it's unpowered could be a problem, it's good to be aware of the possibility of it operating under "phantom power" supplied via an input pin.

And no doubt consumer electronics is designed to be idiot proof.

No it is not that, it is the ESD specification that any consumer product has to meet. The components for that will protect the circuits from this situation.

If the two sub systems can be independently powered then a seriese resistor and catching diodes to each rail are a must.