juan3211
(Juan)
8
Hi,
After reading all of you I think the solution is to have a little cap as jeelab sugest here: http://jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/
And about firmware, I think ATMEGA is powered by 3.3V, so 1023 anaog value is 3.3V. As voltage divider is a x2 factor, so I think that it will have to be:
int battery_voltage = analogRead(battery_voltage_pin) / 1024 * 3.3 * 2 * 100; //1023 or 1024 (there is always discussion about this). (x100 is to save 2 decimales in the int battery_voltage value
int battery_voltage = analogRead(battery_voltage_pin) * 0.64453125; //1023 or 1024 (there is always discussion about this)
Max value for the battery is 6.6V.
As @glyn.hudson says, the diference between 0.681322727 and 0.64453125 is about 5.7% so may be he check several times with a multimeter. But 5.7% is big.
Conclusion: I understand that 0.681322727 is an empirical value. I will add a 0.1uF cap.
THANKS A LOT.
1 Like