If we want to get the battery charge of SIM900-TTL GSM Modem, there is an AT command for that. Here Arduino board is used to send the AT command to the Modem. Modem I used is given below. GSM Modem I used is given in this page.
void setup()
Circuit is done as shown in following image.
Test Command : AT+CBC=?
Upload the following program to run the command AT+CBC=? in Modem.
void setup()
{
Serial.begin(2400);
Serial.write("AT+CBC=?\r"); //Get the battery charge
while(1)
{
if(Serial.available())
{
Serial.write(Serial.read());
}
}
}
void loop()
{
}
Open the Serial Monitor and change the baud to 2400. Response of the modem to this AT command will be as shown in the following figure.
Output : +CBC: (0-2),(1-100),(voltage)
Output will have three parts.
0-2 indicates the battery connection status (bcs).
if bcs =0, Mobile Equipment (ME) is not charging.
if bcs =1, Mobile Equipment (ME) is charging.
if bcs =2, Charging has finished.
1-100 indicates the battery charge level (bcl).
1...100 : battery has 1-100 percent of capacity remaining.
voltage indicates the Battery Voltage in millivolts.
Execution command : AT+CBC
Upload the following program to run the execution command AT+CBC.
void setup()
{
Serial.begin(2400);
Serial.write("AT+CBC\r"); //Get the battery charge
while(1)
{
if(Serial.available())
{
Serial.write(Serial.read());
}
}
}
void loop()
{
}
Output : +CBC: 0,99,4190
From the above output, we can conclude that,
Mobile Equipment is not charging because bcs = 0.
Battery has 99 percent of capacity remaining because bcl = 98.
Battery Voltage is 4190mV.
Important : This command is hardware dependant and only be used when the battery is charging.
This is where these Worldwide IoT SiM Card come in helpful. They provide you the flexibility to keep connected with both your family and your business partners, and they do so in the most simple and cost-effective manner imaginable.
ReplyDelete