Analog Protection for Vcc=0

I have 4 analog inputs to an Arduino nano for sensing voltages in a battery management system. The input voltages are hardwired from the 4 cells of an LiFePO4 battery and are limited using voltage dividers to a maximum of about 3.3 volts. I want to protect the input pins in the case where Vcc is zero because the system is turned off but the input voltages are still present on the pins. I need to preserve as much accuracy as possible in the voltage measured. Most solutions that I see can limit voltage to a specific level (eg. 5.1v) but that will not help in the case of Vcc=0. I am currently using a small relay on each of the 4 sensing lines which opens when Vcc is turned off, but I am wondering a) if there is a better solution, and b) is there any risk to the pins in the very short time between Vcc going to 0 and the relay opening?

You could use a small quad-element CMOS switch, for instance. Or just connect a Schottky diode with anode to the analog input pin and cathode to Arduino's Vcc - that should do the trick just as well. Use high values for the voltage divider to prevent the battery from powering the Arduino through the sense lines.

1 Like

If you changed to the 1.1V analog reference, and divided everything down to the 0 - 1.1V range, would that still give you enough accuracy? If you could do that, you could replace the relay with an N-channel mosfet, such as the 2n7000 or 7002.

The mosfet will turn on only when its gate is driven high, which could not occur when Vcc = 0.

Edit: If you need the full 5V range, then you could put a P-channel mosfet at the top of the divider, and control its gate with an NPN transistor or N-channel mosfet. But that's more parts.

1 Like

Two easy solution, be sure the Analog input impedance is high enough not to damage the processor. The second approach is to use an external diode from the input to Vcc. Both of these solutions will draw some power but since you have it connected through a relay that is a mute point.

1 Like

Bettor in what way, cheaper, smaller, easier to build, less parts, lower power?
Hard to beat a relay for complete isolation.

1 Like

What are your divider value? If you batteries are in series the voltage will be approx 16.8v

If the series resistor of you divider is 10k ohms then the max current into one pin is 1.68 ma. This current (even into 4 inputs).
And if you make the series resistor 100k ohms then the max current into one pin is 168µA.

I guess that I was thinking better in terms of long term reliability of passive components way inside their operating maxima versus an electromechanical component but they are all so cheap, I guess that I will just run with a spare. Thanks.

Flying capacitor anyone ?

1 Like

The cells are 3.3 volts in series with total nominal voltage of 13.2 and a maximum voltage during charging of 14.3. So probably say 3.6 volts on each pin.

The series resistors are 30k. At 3.6 bolts the current into each pin should not have exceeded 120µA. Over time (hours) that was enough to fry Arduino.

Thanks.

Thanks. That could work.

I can't argue with your results (i.e. frying the Arduino) however its unlikely 4 pins each with 120µA seems unlikely to damage an Arduino that can survive a minimum of 10ma on each input.
Could there be current from another source?

No other current source. All I know is that I fried (actually 3 boards) by leaving the battery cells connected to analog pins with Vcc at 0. I then used the battery itself to power a buck converter with 7 volts into Vin so Vcc could never be zero when the analogue inputs were attached and it has run perfectly ever since. Then In added 4 relays (NO) to the analog sensors, driven by the same source as Vin, and it seems to work perfectly. Think I'll just stay with the relays. Thank you for your time.

1 Like

There is something else getting into your circuit. Does this happen to be on an alternator system?

1 Like

Why do we ALWAYS need to point this out?

1 Like

You could certainly replace the relay with a bunch of ICs and other active components but now you have a more complicated circuit with more points of failure, which may also be more expensive than the relay.

FYI: There is no safe current that can be injected into any pin when an Arduino is unpowered

Thank you.

First of... I'm a beginner! :slight_smile:

But I have the similar problem and planning to use a relay. What about a delay in the relay, if that happens for a few ms will it fry?

But my main question or possibly my suggestion.... let say You use the "Vin" and connect it to 12v NOT USB OR NET. then when turning it on/off You just switch the "GND" for the power and all the external batteries, then the voltage can't damage anything as there are no closed circuits? Or am I just tired and stupid right now :smiley:

I used “normally open” relays, so no battery voltage can reach the arduino until the arduino is powered up and it closes the protection relays. I have been running a month and no problems.

First, you can’t apply “12 volts” from a battery to Vin. Nominally 12 volt batteries run from 13 (la) to 14.6 (lfp) and will fry an arduino. Even if a nominally 12 volts battery were only 12 volts, I don’t think you can expect to run long term at the maximum spec and not have trouble. I would treat 9 volts, nominal, as a practical max for vin in my application.

Second, it makes sense that the floating ground would prevent pins from seeing the battery voltage except when the board is turned on with the switched ground, but I am way too amateur to know (a) how the board would behave with a floating ground switched to turn it on and off or (b) the answer to you first question about milliseconds of delay between hitting the pin with he voltage and establishing Vcc. That issue does not arise with NO relays but does arise with the switched ground methods you propose. Good thinking but I am sorry I do not know the answers.

1 Like

Yes you will. Vcc = 0 means your Arduino is un-powered.

This is called latch up and is due to having a voltage applied to your Arduino inputs when it is not powered up. The input signals from the battery then try and power the Arduino. This is known as Parasitic powering.

This in turn will blow up the static protection diodes on the pins trying to Parasitic power your Arduino.

The only puzzle is why you tried this three times?

3 Likes