40V burning Arduino Nano?

In my bicycle project there was the need to measure battery voltage, around 40 Volts, and the current, up to 14 Ampere.
I was worried to burn some valuable parts and therefore made very simple test circuits an a breadboard together with one Arduino nano connected to a pc. The whole test in a living room on a stand.

To measure voltage there was a voltage divider with 20k resistor connected to 40 Volts, middle point voltage to analog input A3 in Arduino nano, and lower side of the voltage divider being 1k and connected to ground.

The analog conversion value was about level 410 ( out of 1023) , when the results were viewed at Arduino monitor window in a windows pc. The connection was with the usual usb-cable.

The current was measured on the same nano, the same breadboard with Acs712T (hall effect sensor ). Its 5 V logic power was fed to it from the 5 V pin of the same arduino nano, and the analog signal was connected to analog pin A2.
The analog conversion value made sense.

The measurements above were made so that first the usb cable was connected to nano, and thereafter the 40 volt battery.

But then I left the 40V battery connected to nano and disconnected the usb cable. The nano was supposed to be without power, in my understanding.

I reconnected the usb cable between my pc and nano (the battery 40 V was still connected). Windows XP complained that the usb connection was invalid or the device defective and asked to disconnect/reconnect or replace the device.

Disconnectin/connecting the usb-cable did not help.

The next day I connected the usb cable first, then the battery, and the Arduino monitor showed good values for current and voltage. Sigh of relief.

But in the next test session there was faint smell of something hot: the cpu of the nanoboard was too hot to touch and pc could not communicate correctly with it. Even without any breadboard wires the nano became very hot in 10-20 seconds.

To make the circuit simple I had omitted all the customary(?) protection diodes and all the capacitors. The only protection for the analog inputs of A2 and A3 was a 10 k resistor in series.

Is it possible or probable that in the above circuit the 40 V battery causes damaging voltages or currents, when Arduino nano is without power? (provided the components ACS712T and resistors are not at fault).

How would you recommend to continue?

3 pictures should be visible at flickr, here

when Arduino nano is without power

Never ever connect any voltage to the input of ANY chip when that chip is not powered. As you have found out this is a great way of killing a chip.
I would try and power everything off the same source, even if it means several stages of step down.
Another option is to connect the input through to the arduino through a reed relay and have the arduino power the relay, so that when the relay drops out the input is disconnected.

Grumpy_Mike:

when Arduino nano is without power

Never ever connect any voltage to the input of ANY chip when that chip is not powered. As you have found out this is a great way of killing a chip.
I would try and power everything off the same source, even if it means several stages of step down.
Another option is to connect the input through to the arduino through a reed relay and have the arduino power the relay, so that when the relay drops out the input is disconnected.

Thanks for the prompt and clear answer, Grumpy_Mike. This has taught me an important lesson, and I am willing to learn about it very thoroughly. Could you or somebody of the other readers give me keywords or links to learn more about this? I had wrongly believed that one could connect different microprocessors to each other without worrying where and when they get their power. (not out of range voltage or out of range current had been my only concern...)

I would have used 200k and 10k for the voltage divider, ten times your values, since then the max current
from the divider would be 200uA rather than 2mA.

With the supply disconected that 2mA would flow through one of the input protection diodes
which might be enough to put the chip into CMOS latch-up (to be avoided since the whole chip then
conducts between Vcc and ground).

Of course some other failure mode might have been involved.

MarkT:
I would have used 200k and 10k for the voltage divider, ten times your values, since then the max current
from the divider would be 200uA rather than 2mA.

With the supply disconected that 2mA would flow through one of the input protection diodes
which might be enough to put the chip into CMOS latch-up (to be avoided since the whole chip then
conducts between Vcc and ground).

Of course some other failure mode might have been involved.

Is there any safe level of current or energy, which Arduino Mega2560 would tolerate in its pin when not powered? E.g. a voltage divider with 10 megaohm legs?

Is there any safe level of current or energy, which Arduino Mega2560 would tolerate in its pin when not powered?

Any chip will not be able to take more than 0.5V without power. This is because an unpowered chip just looks like a bunch of diodes.
One way of getting round this is to have a transistor buffer in front of the input. But this would only be any good for a digital signal not an analogue one.
You can also use an opto isolator but again it is not good at transferring analogue voltages.

Grumpy_Mike:

Is there any safe level of current or energy, which Arduino Mega2560 would tolerate in its pin when not powered?

Any chip will not be able to take more than 0.5V without power. This is because an unpowered chip just looks like a bunch of diodes.
One way of getting round this is to have a transistor buffer in front of the input. But this would only be any good for a digital signal not an analogue one.
You can also u
se an opto isolator but again it is not good at transferring analogue voltages.

Thanks! I'll acquire optoisolators, and suitable transistors.

0.5 V limit with analog input might be only a minor nuisance, if I use 1.1V internal reference (or even about 0.7V-0.8V aref reference voltage) and arrange the voltage divider to never(?!) give above 0.5V. Should there be a low limit for power (or current) at the same time to be on the safe side? What about having 10K resistors in front of (slowly changing ) analog inputs, or would it be significantly safer to use e.g. 1-10 megaohm resistors?

Should there be a low limit for power (or current) at the same time to be on the safe side?

No if you are keeping it below 0.5V then the diodes never start to conduct so limiting the current when it does conduct is not an issue.

Grumpy_Mike:

Is there any safe level of current or energy, which Arduino Mega2560 would tolerate in its pin when not powered?

Any chip will not be able to take more than 0.5V without power. This is because an unpowered chip just looks like a bunch of diodes.
One way of getting round this is to have a transistor buffer in front of the input. But this would only be any good for a digital signal not an analogue one.
You can also use an opto isolator but again it is not good at transferring analogue voltages.

I assume "a transistor buffer" is like this:
http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/buffer.html#c2

Is an operational amplifier (to the right of the previous page) also suitable as a buffer, eg. lm324?

If lm324 or a transistor is without power (but input has power) , they do not overheat? An when their input circuit is without its power, that circuit does not overheat?

I like connecting a couple of schottky diodes in as a protection circuit on signals such as this. Then the input can never go about 400mV above Vcc (even when it is off) or below ground.

So signal >> 200k >> 10k >> ground
The node between the 200k and 10k resistor connects to:
The Arduino input pin
A schottky diode with the other end connected to ground, reverse biased in normal opeation (anode to ground)
A schottky diode with the other end connected to the Arduino's power supply line, reverse biased in normal operation (cathode to Vcc)

That goes for the LM324 or any other Op Amp that does not specifically have protection against voltage on an input when the chip is powered down. There is a parasitic thyristor in the bulk of the semiconductor, it has to do with the way the P and N layers are built up as an insulating layer under the transistors. Look up "latchup".

http://www.fairchildsemi.com/an/AN/AN-600.pdf

BTW, with that transistor buffer, when no Vcc is present, current will flow through the BC junction into the Arduino Vcc, potentially causing unexplained effects. And when on, the voltage you are measuring will be offset by about 600 to 700mV, at about -2mV/Celsius.

I assume "a transistor buffer" is like this:

No that is called an emitter follower, you want the configuration where the emitter is connected to ground and the collector, resistor and input pin are all connected together. The the other end of the resistor goes to Vcc.

This means any input voltage is shunted off to ground through the base / emitter junction.

Grumpy_Mike, where do the Base and Signal connect? Can you post a schematic?

polymorph:
Grumpy_Mike, where do the Base and Signal connect? Can you post a schematic?

Resistor to base and the other end of the resistor to the input signal.

Maybe I'm not putting this together in my head the way you are picturing it, Grumpy Mike, but what I think you are describing is a common emitter amplifier. It is going to have a gain that is temperature and current dependent.

Input signal >> Resistor1 >> Base
Emitter >> Ground
Vcc >> Resistor2 >> Collector
Collector >> Arduino Input

It is going to have a gain that is temperature and current dependent.

Yes I an describing a digital buffer that you can use to attach live inputs to an unpowered processor to avoid latch up of the processor.
I am not describing an analogue buffer because an unpowered analogue buffer has the same problem as an unpowered processor.

Well, the OP wants to measure an analog voltage. So an inverting digital buffer isn't much help. You see my confusion?

polymorph:
So an inverting digital buffer isn't much help.

Yes read reply #5 that is what I said.

"Latch-up" is still a bit difficult phenomenon for me to understand, even after reading long descriptions about it. Especially its practical consequences. For example:

We could use a powered oscilloscope to study almost any powered (and not powered?) circuit anywhere. The probes have high resistance (e.g. 10 Megaohms?). If we have probes attached to a circuit and cut off the power of the oscilloscope, can terrible things happen to the circuit or to the oscilloscope? What if the power off state of the oscilloscope lasts only a very short time, milliseconds ?

If terrible things can happen, then that information is an important news for me: "unpowered anything" is a dangerous thing :slight_smile:

If we have probes attached to a circuit and cut off the power of the oscilloscope, can terrible things happen to the circuit or to the oscilloscope?

No.

Basically the oscilloscope is an input. It is quite alright to connect an input to an unpowerd circuit. The danger happens when you connect an output to an unpowered circuit.
It is the current from that output that causes the problem.
Another way to avoid a problem is to restrict the current from that input, normally with a resistor.