Blogroll

Powered by Blogger.

Monday, 5 May 2014

AT+CBC - AT Command to Get the Battery Charge of GSM / GPRS Modem

by realfinetime  |  in TTL at  11:38

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



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() 
{
}



Open the Serial Monitor and change the baud to 2400. Output of the above program will be as shown in following figure.



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.

0 comments:

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips

Blog Archive

Proudly Powered by Blogger.