LoRa Node 151 ADC measure battery voltage

I’m currently testing the LoRa node 151 using the example code for the STM32CubeIDE.

I’ve connected a HDC1080 sensor after adding the stm32L1xx I2C drivers, works fine, low power in sleep (stop mode) as expected.

Now I’m trying to see if I can measure the battery voltage with ADC to transmit along with temp and humidity. I’ve worked with similar implementations of this LoRaWAN code that had ADC drivers implemented and measured battery voltage level from a specific pin.

Is this possible on the LoRa Node 151, the pinout refers to PA_2 for power detection, can this pin be used to read voltage level with ADC?

I’ve tried reading PA_2 but am getting 0 values, although could easily be my code.

Any help greatly appreciated.

Please refer to the schematic diagram, we need set PB3 low to enable the Q6 first, and then read ADC data via PA2.

1 Like

I have the same problem. I tried setting PB3 LOW. It does drop the input voltage from 3.8V to 2.1 V but there is still some voltage sneaking in.
Any way to use any of the other GPIO pins as an analogRead?