Page 1 of 1

### Question about a DC0-24 Voltage Sensor

Posted: Fri Feb 08, 2019 7:55 pm
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

+ 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

Arduino Uno
DC0-25V

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>

int val1;
int val2;

void setup(void)
{
Serial.begin(9600);

}

void loop(void)
{
float temp;

temp = val1/5.092;
val1 = (int)temp;
val1 = ((val1%100)/10);
temp = val1;
Serial.print("Voltage = ");
Serial.println(temp, 2);
delay(700);
}
``````
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.