SparkFun Forums 

Where electronics enthusiasts find answers.

By RADaugherty
So I've been messing around for a bit with trying to make a rudimentary but accurate voltage meter for a project.

I started with a simple resistor-built voltage divider but my numbers were sporadic. I then moved to using

ADS1115 16-Bit ADC
+ The resistor-voltage divider.

I feel like it helped a bit but I decided to go for broke and wen't with a premade voltage sensing board so now I have

ADS1115 16-Bit ADC
Arduino Uno

And upon first test ( a 9V battery ) it kicked out 9.00V so that was nice. I of course need it further resolution but for first test it was great.

But then I moved onto a AAA battery and sadly it kicked out 8.00V so not so nice :(

Now, for some clarification, both of these readings are done with reverse polarity. IE: the board is setup properly but for the two "meter leads" they are reversed on the batteries. If I have them non-reversed I get: 1.00 on the 9V and 2.00 on the AAA.

So not sure why that is. So some help in getting this right would be awesome!

Here is my code;
Code: Select all
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1015 ads1015;
Adafruit_ADS1115 ads(0x48);

int val1;
int val2;
void setup(void)

void loop(void)
  int16_t adc0, adc1, adc2, adc3;
  float temp;
  adc3 = ads1015.readADC_SingleEnded(3);
  val1 = adc3;
  temp = val1/5.092;
  val1 = (int)temp;
  val1 = ((val1%100)/10);
  temp = val1;
  Serial.print("Voltage = ");
  Serial.println(temp, 2);
And I can provide a wire diagram of the project if need be (never done it before, but can try) but I'm fairly sure I got it all hooked up right.

Goals: Get detecting between two different batteries to be accurate. Get resolution down to exact; IE: 9.54 and 1.87 for the two batteries.

Thanks in advanced!