Read out battery voltage on the LongRa board

Using the “GetBatteryVoltage” function, the current battery voltage can be read out as a float on the LongRa board. This is only possible with boards of revision 7.2, the software revision used must be at least RadioShuttle 2.6. For LongRa boards as of revision 7.5 the adaptation described below is not required. However, two solder bridges must be set here (on “B1” and “B2”, factory setting).

Two adjustments are required to read out the battery voltage; firstly, a change must be made in the “xPinMap.h” file; secondly, you must replace two resistors on the LongRa board:

1. Edit “xPinMap.h”
Open the “xPinMap.h” file and search for the (deactivated) lines:
// #define BAT_MESURE_EN 27 // Optional turn for measurement PA28
// #define BAT_MESURE_ADC 19 // Analog-in for battery measurement PB02/A5
// #define BAT_VOLTAGE_DIVIDER ((82.0+220.0)/82.0) // 82k + 220k 1%

Activate these three lines by removing “//” at the start of each line:
#define BAT_MESURE_EN 27 // Optional turn for measurement PA28
#define BAT_MESURE_ADC 19 // Analog-in for battery measurement PB02/A5
#define BAT_VOLTAGE_DIVIDER ((82.0+220.0)/82.0) // 82k + 220k 1%

2. Hardware modification
Two resistors need to be removed, according to the figure above, and be replaced with components of the values given above (type 0805). To do this, proceed as follows:

  1. Heat the solder with a soldering iron and remove the resistors with tweezers.
  2. Remove the excess solder with a desoldering braid.
  3. After all the solder has been removed, clean the affected areas with a cotton swab soaked in some alcohol.
  4. Position the new resistors and solder them with a fine soldering tip.

After successful modification, the current battery voltage is displayed in any example program in the serial monitor:

“xPinMap.h” before the modification:

22:53:58.361176 RTC Clock: 8/7/2018 22:53:56
22:53:58.543914 Welcome to RadioShuttle v2.6

With entries in “xPinMap.h” and hardware modification:

22:53:58.361176 RTC Clock: 8/7/2018 22:53:56
22:53:58.525543 Power: 3.30 (ADC: 3672 Vref: 1.000)
22:53:58.543914 Welcome to RadioShuttle v2.6

Note:
The value of the resistors can only be reliably measured when removed. If the components are still soldered on the board, the resistance measurement is falsified!