SIM900 / SIM800 USSD Code AT Commands – Working example
SIM900 and SIM800 GSM modules provide a set of commands to check the balance of the SIM card. Here they are,
Before you dial a USSD code, you need to enable USSD commands and response notification using the command AT+CUSD=1.
Once you enter AT+CUSD=1 and receive a OK string as response , your USSD command response notification will be enabled and for the next USSD code you enter you will get a response notification.
Now in this example i have used Vodafone SIM card to check the balance. There are two ways to do it,
- #Option 1: Using the standard number *111# and get a USSD response string with multiple options to select, and selecting the balance check in the options.
- #Option 2: Using the shortcut number *111*2# and get a direct balance information string as a USSD response.
#Option 1 :
Enable USSD
Now to check balance using a two step process, you have to first enable the command USSD command response using command AT+CUSD=1 followed by rn or carriage return.
– You shoud get a response as OK.
Dial the command
Next dial the USSD code of your respective SIM card, in my case it is *111#, using the command AT+CUSD=1,”*111#” followed by rn or carriage return.
– You should get a response as shown in above image. Here the network gives you multiple options to select, like Tariff details or Balance check etc.
Dial the selected option number
In the response above, we need to check balance so we need to dial 2 since it is the corresponding code for checking balance as shown in options.
Select 2 as the next input using the command AT+CUSD=1,”2″ followed by rn or carriage return.
– You will receive response as OK followed by the balance information.
#Option 2 : (Note this might not always work with all network operators)
Enable USSD
Now to check balance using the shortcut method, you have to first enable the command USSD command response using command AT+CUSD=1 followed by rn or carriage return.
– You should get a response as OK.
Dial the command
Next dial the USSD code of your respective SIM card along with the option value, in my case it is *111*2#, using the command AT+CUSD=1,”*111*2#” followed by rn or carriage return.
– You will receive response as OK followed by the balance information.