Battery monitoring

The battery voltage is measured at the center of a resistor bridge using the A7 analog input:

The BAT global variable sets the minimum battery voltage required for Tx operation. The buzzer and the LED will play the Battery alarm code if voltage gets lower.
The value of BAT is set in ADC units in the [0, 1023] range; it is actually an index relative to 50% of the actual battery voltage on a 5 volts scale.
Since a L7805 regulator powers the Tx, the minimal voltage required is 5+2 = 7 volts, leading to the minimum value for BAT = 1023 * (7/2) / 5 = 716
If the transmitter is powered by a 2S LiPo then 7 volts corresponds also to a 80% discharge, which is also the maximum recommended discharge.
You may choose to increase the value of BAT to be warned before the minimal voltage is reached: add 21 per 100mV, eg: BAT = 716+21 = 737 for 7.1 volts. This is why the default value for BAT is 740.

Battery voltage calibration:
The precision of the voltage measurement is affected by the tolerance of the resistors and you may have to calibrate it with a multimeter.
Use the PRINT VOLT command to display the battery voltage measured by the Arduino. If it differs from voltage measured with a multimeter, then you define the correction with the BATVOLT_CORRECTION constant of arduinotx_config.h. In my case, PRINT VOLT returned 7.8V and my multimeter 7.7V, so the correction was -0.1V ; and since 1V is 102 (in ADC units, see ArduinoTx::ReadBattery()) then 0.1V is int(10.2) = - 10 ADC units. Hence I put in arduinotx_config.h:

 #define BATVOLT_CORRECTION -10

Notice that with R4 = R5 you should not use a battery > 10 volts because the analog input cannot handle more than 5 volts.

Page last modified on June 08, 2014, at 01:43 pm
Powered by PmWiki