I am trying to measure the battery level voltage as maniacbug did but I always get value = 324 for 2.58V measured with a multimeter. Can someone help ?
The equation is vout = (value * 3.44) / 1024.0; and vin = vout / (R2/(R1+R2)); but vin appears to be around 2.98V. The voltages measured in the voltage divider are 1.75/0.81.
I am creating a wireless node with an nRF24L01+ and a battery level meter, using 2AA batteries (2.4-3.0Volts). I am also testing it with two cables from an arduino Uno board connected on 3V3 pin (3.3Volts). The chip doesn't have an external oscillator - I am using the 8Mhz bootloader provided by official arduino website.
I am also measuring the AREF pin which is not connected to anything, with a multimeter by hand and it shows 3.3 when connected to the 3V3 source and analog Reference set to DEFAULT and 2.7Volts when connected to INTERNAL. I've also used 5 different ATMega328s, some of them brand new (in case I burnt something). Shouldn't it be 1.1 ?
I am using the exact same schematic except for the R's which are 1KOhm and 470Ohm.
hyp3rkyd:
I am also measuring the AREF pin which is not connected to anything, with a multimeter by hand and it shows 3.3 when connected to the 3V3 source and analog Reference set to DEFAULT and 2.7Volts when connected to INTERNAL.
Shouldn't it be 1.1 ?
On the client that reads the battery voltage and changes it into a value..
Yes!
1.xxx volt (~1.000 to 1.200).
Did you read the digital value directly on the client.
It should be ~800 there.
Base: (value * 2.25), not sure were you get 2.25 from.
Two variables are the battery A/D value and the ~1.1volt Aref of the client.
Fixed is 1024 and 470/1470.
Leo..
it's not 800, it always display 323. I tried with 5 ATMega328P chips and two boards. The only difference with the arduino Uno is that the boards have no oscillators and they work with the 8Mhz arduino bootloader. Could that have to do anything with that (any kind of bug?) ?
I am measuring the voltage directly with the Red needle on the AREF pin and the BLACK on the GND one. INTERNAL gives 2.7V, DEFAULT gives 3.3V.
Don't know if other libraries are interfering with 1.1volt Aref.
Try to load something else.
With this sketch and my UNO r3, I measure 1.063volt on Aref.
Leo..
/*
0 - ~17volt voltmeter
works with 3.3volt and 5volt Arduinos
uses the internal 1.1volt reference
10k resistor from A1 to ground, and 150k resistor from A1 to +batt
(1k8:27k or 2k2:33k are also valid 1:15 ratios)
100n capacitor from A1 to ground for stable readings
*/
float Aref = 1.075; // change this to the actual Aref voltage of ---YOUR--- Arduino (1.000 - 1.200), or adjust to get accurate voltage reading
unsigned int total; // A/D output
float voltage; // converted to volt
//
void setup() {
analogReference(INTERNAL); // use the internal ~1.1volt reference, change (INTERNAL) to (INTERNAL1V1) for a Mega
Serial.begin(9600); // ---set serial monitor to this value---
}
//
void loop() {
analogRead(1); // one unused reading to clear old sh#t
for (int x = 0; x < 16; x++) { // 16 analogue readings and 1/16 voltage divider = no additional maths
total = total + analogRead(1); // add each value
}
voltage = total * Aref / 1024; // convert readings to volt
// print to serial monitor
Serial.print("The battery is ");
Serial.print(voltage);
Serial.println(" volt");
total = 0; // reset value
delay(1000); // readout delay
}
All the arrows are pointing at the software not switching to 1.1volt Aref.
I would start another topic in "Programming Questions" with e.g. "1.1v Aref not working" as header.
And refer to this post. List micro, bootloader, etc.
Leo..