SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
User avatar
By viskr
Basically measure the voltage divider, it should be 1/2 the battery voltage. If its not then the AD input is loading down the divider too much and you'll need to decrease the resistor values.

Is your supply 5V or 3.3? If 3.3, then those analog switches don't like to be pulled above the supply.
If it is 3.3V, divide by 3, with 20M and 10M.

With resistances that high you're starting to get into the realm of very high impedance circuits. By the time you get to 100M, your circuit turns from being something useful to being an antenna picking up any stray signals. Also at those levels, just touching the resistors will leave enough perspiration to affect the values.
By cbabilotte
I got mine to work with 3 resistors of 10 M in series. If you take the attachement I previously posted you just add a new 10 M resistor and that should work. I have also a resistor from the analog pin to gnd

I think if I play with the map function I can get it to what the measurement is suppose to be. Also maybe the resistor that is from the analog to gnd might not be the right value so I can still teak it that way. With the code below I am off but it is very minimal. I will try to post a picture when I am done.

Here is the code I am using

// variables for input pin and control LED
int analogInput = 1;
int LEDpin = 13;
int prev = LOW;
int refresh = 1000;
float vin = 0.0;

// variable to store the value
int value = 0;

void setup(){

// declaration of pin modes
pinMode(analogInput, INPUT);
pinMode(LEDpin, OUTPUT);

// begin sending over serial port

void loop(){
// read the value on analog input
digitalWrite(analogInput, LOW);
value = analogRead(analogInput);

// blink the LED
if (prev == LOW) {
prev = HIGH;
} else {
prev = LOW;
digitalWrite(LEDpin, prev);

vin = map(value,0,1023,0,8690)/100.0;

Serial.println(" volt");

// sleep...
By MobileWill
Thanks that would be helpful. Even though mine works it seems to not be accurate enough to monitor battery level. I was hoping to shutdown attached systems/sensors based on battery level.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]