I am using 5V from my PC to know if the PC I on or off.
5V straight from the power supply.
I have it connected to A0 and when Arduino is running there is no problem.
When I connect the Arduino to my PC using USB C (to upload the code) the wire 5V wire to the A0 draws so much current that it starts to melt and smoke... so I turned it off.
The question is, why is it doing it and how can I stop it?
Code: does not affect it, currently running Example Blink
Using: Arduino nano ATmega328P (old Bootloader)
(I am using A0 because it's how I have it printed on my custom PCB so it's expensive to change. In the past, it was on pin D11 and it worked just fine.)
The answer can be found by studying the circuitry contained inside the whatever Arduino You use.
Don't make that combination of connections.
Most Arduinos have the barrel input, the USB and the 5 volt pin used for powering. Also inputs are often protected by diods leading current away in case of abnormalities. That's likely what You've experienced.
Never connect a power supply or battery that can deliver signiificant current directly to a pin.
The computer supply will try to power the Arduino through that pin when the board is not powered any other way, which will sooner or later burn out the pin or destroy the whole processor. This is called ghost-powering or phantom-powering.
Always use a resistor inline (10k is common) to limit fault current.
That said, current draw of a common Arduino is not enough to melt a wire.
Please draw a diagram of the setup.
Leo..
Thank you for any suggestions, I tried to connect it via a resistor, did not help. The problem is that when I connect the Arduino to the PC via USB C A0 pin is pulled to GND for some unknown reason. (the code uploaded is a blink example, so the code does not do it)
I just needed to work around and connect it to D8 as in my previous design and it works with no problems.
If anyone knows why A0 pin is pulled to GND when connected to PC I will be happy to learn something. I tried to study the Arduino internal circuits but I am lost there.
Here is the connection that caused the problem. There was no problem when NOT connected to PC via USB C.