Pages: 1 [2]   Go Down
Author Topic: measuring battery voltage  (Read 1358 times)
0 Members and 1 Guest are viewing this topic.
Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
An external diode to clamp the input from going above the AVR VCC voltage might be a good idea - I wouldn't want to put that kind of stress on the internal clamping diodes (if there are any).

Sure a one amp diode and a series say 100 ohm resistor between the analog pin and the junction of the voltage divider would make it pretty bullet proof.

Lefty

Yes, an additional resistor in series with the input is a great idea. Even if the external clamp forward drop is a bit higher than the input pin clamp, the resistor will limit the current and prevent a latchup.

The reason I mentioned an external diode is that some microcontrollers have actual clamp diodes on the inputs while others have "pseudo" diodes formed by the junctions of the input FET's. If THOSE are driven above VCC or below ground, the input stage can latch up like an SCR and then the holy smoke is released from the chip and it doesn't work anymore!  smiley

I don't know if the AVR micros have actual clamp diodes on the inputs or not. Better safe than sorry.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the AVR 328p datasheet:

Quote
All I/O pins have protection diodes to both VCC and Ground as indicated in Figure 14-1. Refer to ”Electrical Characteristics” on page 317 for a complete list of parameters.

Lefty
Logged

Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From the AVR 328p datasheet:

Quote
All I/O pins have protection diodes to both VCC and Ground as indicated in Figure 14-1. Refer to ”Electrical Characteristics” on page 317 for a complete list of parameters.

Lefty

OK thanks. I have the PDF file, but I haven't gone through much other than A/D registers, ports and fuses yet. I wish I could get a paper copy (a book). I don't want to print a 567 page document... even double sided!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There is an Atmel application note recommending that the current into the pin protection diodes is limited to no more than 2mA.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is an Atmel application note recommending that the current into the pin protection diodes is limited rated to no more than 2mA.

it's up to the external circuit of course to do the current limiting to stay below the diodes maximum rating. I know you know that, I'm just clarifying for the newbies that tend to treat statements as rules rather then as hints to understanding.

Lefty
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 403
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

wow thank guys for all the posts, but what should my final circuit be?
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I already gave you my recommendation in reply #1.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

wow thank guys for all the posts, but what should my final circuit be?

This should work for you. The resistors chosen will allow you to go up to 15.6 volts before exceeding the Arduino 5 volt limit. And if you do exceed the limit, the series 1000 ohm resistor and the 1N4148 diode will protect the Arduino input port.



* voltage_divider.jpg (46.23 KB, 800x600 - viewed 33 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that will work. But it uses one more resistor than necessary, and the 1N4148 won't completely stop current flowing into the pin protection diode, it will merely divert an unknown proportion of it. To prevent current flowing into the pin protection diode, you would need to use a Schottky diode. But pin protection diodes are there to be used, you just need to ensure that you limit the current flowing into them to a low enough value.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: 1 [2]   Go Up
Jump to: