Arduino powers when voltage input in Analog Pin

Hello,

I am measuring a LiPo battery voltage using an analog pin, the problem is that if I dont apply power supply to the mini usb or dc jack, the arduino power pin lights fadely.

I fear that this will damage the microcontroller, it is also not desired as not enough current is available and the arduino can act randomly.

Any solution?

Thank you.

If the uC is not powered via VCC, then voltage on any IO pin will put current thru the clamp protection diodes and power the device. At the least this may damage the clamp diodes, at the worst this may cause other damage.

I will try to think of ways of preventing this situation, but any idea on how this is handled when there is no other option?
I mean, there must be systems where voltage is fed to the analog pins before the system is powered up.

Thank you CrossRoads!

You can put a 10K resistor in series with the analog input pin, and in most cases this will prevent damage from current flow into the pin when the Arduino is not powered.