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.