After AT Command Module, MDBT42Q-PAT, released, Raytac has received several feedback from developers about “How to read battery status through AT command?“
In order to help developers quickly set up the environment, the tutorial hereby is using a AT command DK board which deployed MDBT42Q-AT, to demonstrate how to work out this function.
First of all, the DK board schematic is provided in below for reference.
To use AT command module to get the battery status, we can use ADC (Analog Digital Converter) hardware with AT “Read” command to implement the application.
The Read Command refers to “AT?ADCVALUE” which stated in Page 6 in spec sheet.
Regarding to the hardware setting, ADC hardware equipped in the circuit and DK Board is the one developers need to use.
There are 3 input voltage options refer to different user scenes which mostly been used.
1.5V is designated for the application powered in by 1 battery
3.3V is designated for the application powered in by 2 batteries
3.9V is designated for the application powered in by Li-On battery.
The default value of the DK board is set as 3.3V option.
For those applications need to use 1.5V or 3.9V, developers can take off the resistor
equipped in R30, and apply on R27 (for 1.5V) or R33 (for 3.9V) to complete the hardware setting.
Regarding to how to obtain the information of battery status, developers can use the AT Read Command “AT?ADCVALUE” to retrieve the battery status information.
(For more detail of Write, Read, Response command table, please to the spec sheet)
PS. AT Command can only be committed under the modules is “No-Bonded” (not paired). Strongly suggests carrying out the Reset function first and then implement the required command to get the information.
Above hardware and software setting can be used for Raytac AT Command module and DK.
Module Part No.: MDBT42Q-PAT (PCB Antenna) & MDBT42Q-AT (Chip Antenna)
DK Board Part No.: MDBT42Q-UART-AT