teeny 4.1 ADC to read battery

Eyal

Member
hello everyone :)
I'm trying to read the voltage of the 16.8V battery.

im using UBEC to get 5V from the 16.8V battrery and connected the gnd and 5V to Vin and gnd to power the teensy.

I'm using a voltage divider of 101.8k[ohm] and 479.3k[ohm] resistors with 1% tolerance to read from the ADC.

Which after reading with a multimeter, I get a voltage of 2.92 V.

and after using this equation with the ADC:

Code:
#define R1 101.81f //k ohm
#define R2 479.3f  //k ohm
#define RT (R1+R2)/R1

void Read_battery(float * battreyV)
{
    int tmp = analogRead(14);
    *battreyV = float(tmp)*(3.3f/1024.0f);
}

I get 3.07V instead of what I have excpected, is a difference of 0.15V normal?

if I multiply by RT, I'll get 17.53V instead of 16.8V, and that's a big offset from what I expected.

any help will be appreciated
 
Last edited:
Turns off the digital input circuitry so that it does not compromise the analogue input signal.
 
Back
Top