RAK811 get battery level

In the next topic it is said that it is possible to get the own power voltage level of RAK811 module using rui_get_adc and a voltage divisor:

Rui_voltage_get

But it never measures bigger voltages than its own working voltage (3.3V), however, the module can get independent battery levels if they are not powering the node.

I do not find the way to get the own RAK811 battery level to make a controlled life app.

An ADC can only give readings up to the voltage powering it.

But if you use a resistor divider, for instance 2 x 10K, you can read up to twice the supply voltage and just use a little maths to get the actual reading.

This is a typical application for reading the battery voltage of a node.

Thanks for your reply.

I am actually using that method to get battery level, making a resistor divider like showed:

I am powering the node with a Li-ion battery of 3.7V [3 - 4.2]. If the battery is in it´s maximum (4.2), the node will give its working voltage (3.3) and it’s supposed to go down as the battery goes down.

But that’s not it. If battery level is 3.3 or bigger, the measure taken in the central node is always 2.62V which is 3.3V after calculations.

I suppose that it is happening because of the pin reference to Vcc, because if I apply the same logic to an external battery it works fine.

Any idea?

Ah, you are measuring the voltage of an output pin so you can turn it off and on to reduce current?

If so, this will always be at VCC so will always read full voltage.

On the Arduino, we have the 1.1 VREF we can use to compare against.

As I don’t think we have that on this module, you will have to use a MOSFET to provide battery V to the resistor divider.

I am measuring directly from the battery, I can add a mosfet as a swich in a future to save current, but first I need to get the correct battery voltage :slight_smile:

I would like to know if there is something like the internal 1.1Vref in arduino, otherwise I’d say the node doesn’t allow this.

Use a LM4040 as a small inexpensive voltage reference source