1
votes

I am using a LilyGo-T-SIM7000G to send readings from my remote device ( newest firmware ).

I need to know how much Airtime is left on the SIM card so I can recharge it when it is low so the device keeps on sending me the information I need.

I have found a lot of people using the AT+CUSD=1,"USSD NUMBER",15 - replacing the USSD NUMER with the airtime query number. So I know this is possible but I have a worry that I am messing up something really basic that I dont realize what I am missing or doing wrong.

I however am only coming up with only ERROR as a response from my modem.

The code I am using is : ( The updateSerial(); function only prints the AT commands to my Serial monitor and show the modem replies)

   Serial.println(F("*************************MODEM BOOTING UP************************"));
   modemRestart();
   SerialAT.println("AT"); // hand shake
   updateSerial();
   SerialAT.println("AT+CSCS=\"GSM\""); // set GSM char set
   updateSerial();
   SerialAT.println("AT+CMGF=0"); // sent to text mode ( not 100% sure if this is needed )
   updateSerial();
   SerialAT.println("AT+CUSD=1,\"*136#\",15"); // Send USSD
   updateSerial();
   SerialAT.println("AT"); // hand shake
   updateSerial();

The respose I am getting is :

*************************MODEM BOOTING UP************************
AT

OK
AT+CSCS="GSM"

OK
AT+CMGF=1

OK
AT+CUSD=1,"*136#",15

ERROR
AT

OK

I have looked in the AT command manual for the SIM7000G and found that these commands do exist.

Also when I run "AT+CUSD?" I get a return of "OK" so I know the modem knows how to use the command.

I am in South Africa using a Vodacom sim card, I can send SMS's and emails from the device but the only thing I cannot do so far is USSD commands to check airtime balances.

I do wonder if the "15" might be unique to the cellular provider but I have tried a few others and I have not found anything of use, the exact same reply.

I have put the SIM in my phone and I can use USSD numbers. I have also made sure that AT+CREG comes back OK and AT+CSQ gives 14,99 so I know it is registered on the network and has good signal.

Any ideas would be appreciated. I feel like I am missing something basic in the setup of the commands or somthing but this is all still rather new to me and the Datasheet AT commands really seem to be aimed at someone who knows exactly what they are doing.

1
If you configure extended error reporting, AT+CMEE=2, you might get some more descriptive error than just ERROR.hlovdal
Hi, sorry I took so long to reply, other areas of the project were going well so I ran with it. I gave that a try but I still just got the normal ERROR message, so far I have figured out or found a way to do everything else but this is still a problem. Any other Ideas would be great, thanks for your time.Spider999

1 Answers

0
votes

I never got this to work with the modem I was deailing with but I have since gotten a new modem (SIM7600) and now USSD codes works perfectly.

Everythin else is 100% the same, nothing has changed besides the modem. I have to say from that it is the modem and nothing else.