AT+BAT=? COMMAND

Hi,

Is there anyone who can explain how the “AT+BAT=?” command works?

  1. What is the reference of the voltage value it gives in response?
  2. How does it measure voltage?
  3. What is the reason for answering constantly 3V?

Thanks.

image

Hi @whydont ,

AT+BAT corresponds to the voltage divider network of the WisBlock Baseboard. In RAK3172, it is connected to PB3.

image

This discussion might be helpful - Custom Li-ion battery voltage calculation in RAK4630 - #3 by newuser_rak4630

Thanks.

But why i’m getting 3.000000 V value constatly?

Are you using RAK3172? Also on what RUI3 firmware?

Few things that can affect AT+BAT reading.

  1. Supply voltage. Is it 3.3v?
  2. What is the input voltage on the PB3 pin if there is any? Or is it floating?

If your device has no voltage divider and floating, what you see is not a valid reading. There is a special algorithm in RUI3 firmware implemented in RAK3172 to compensate on the input impedance requirement. Since there is no way to detect a floating pin, the output will be based on that implemented calculation/algorithm. I have no internal details of the equations/code used at the moment. If the 3.0V reading is critical on your application, maybe is a good idea to implement a voltage divider so that it will be pulled down if there is no analog input voltage.