Voltage on disabled Pins, Voltage on Pins goes beyond 5V

Hi Guys,

i guess i have messed up my Mega 2560, but i still have hope that there is a way to safe him. The problem is that, regardless if they are enabled or disable i have a voltage on all digital and analog pins. I use an external power source (9V, 500mA) and i measure ~0,66V on all disabled pins. When enabling a pin, i produces about 9V, regardless if set on high/255 or low/10. If powered with another source with lower voltage it stays the same, except the enabled pins now producing the alternative voltage (e.g. 7,5V).
I have used the mega in combination with an Motorshield to power two fans.
When i tried to integrate a sensor in this setup i basicly messed it all up. I already did some googlin but was unable to find a solution to my problem. So you guys are my last hope. If there is any way to restore the functionallity of the pins, please let me know.

Cheers

Stop connecting it to external power supplies, first and foremost, before you destroy it completely.

When you say "enabled", you mean set as output and written high or low?

Assuming you're using your multimeter correctly, it sounds like the chip is getting the full supply voltage you are applying (presumably due to a regulator failure, or Vin shorted to Vcc some other way), and it is only by the grace of god and the margins of modern semiconductor processes that your chip has not failed entirely.

If the bizzare behavior persists while connected only to USB, that is, if pinMode(pin,OUTPUT); digitalWrite(pin,0); doesn't output ~0V on the pin, or (after setting as output) digitalWrite(pin,1) doesn't output ~5v on the pin), yet you can upload sketches to it, I'd say the board is trashed (buy a new one) - this would not be a surprising outcome, as the chip's absolute maximum voltage spec has been exceeded by about 70%.

Assuming it does work off USB, if you need to use external power input, you'll need to either buy a new mega (clones are like $10 on ebay?), or repair the one you have. I'd replace the regulator (the SOT-223 package) with a fresh 1117-series regulator (I like the ZLDO1117's, as they've got the lowest dropout spec among the 1117's - but just about all the 1117-series regulators are interchangible - basically every major semiconductor manufacturer makes one), and I'd be prepared to replace the LMV358 as well, as those are frequently trashed when things go wrong with power.

Yes, exactly, set as output. When powered over USB, the behaviour does not occure, so i will try your last solution. I´ve got a spare and since its still partially working i can maybe bring it back to life. Thank your for your detailed response.

Cheers