DIY Cellphone

Serial Debugging

You can further debug the phone by communicating with the GSM module via serial communication with the computer, using the microcontroller as a proxy. To do so, upload the SerialProxy sketch to the phone (using a 3.3V FTDI cable or breakout board). Then open the serial monitor and set the baud rate to 9600 and the line ending to “carriage return”. After a few seconds, you should see:

READY
AT
OK

That means the GSM is ready to receive AT commands (text strings that mostly start with the letters “AT”). The commands are detailed in the datasheet for the GSM module but here are a few basic ones:

AT
Test/synchronization command. If you enter “AT” in the serial monitor (with a “carriage return” line ending), you should get a response of “OK”.
AT+CREG?
Check the status of the network registration (connection). The response will be in the form “+CREG 0,N”, with N being: 0 (not registered to a network), 1 (registered to a network), 2 (searching for networks), 3 (network registration denied), or 5 (registered, roaming).
AT+CPBS?
Display currently-selected phone book. Sample response: “+CPBS: “SM”,50,250″, with the “SM” indicating the SIM card is the current phone book (some other options include “MC” for the missed call list, “RC” for the received call list, and “ME” for the GSM module phone-book) and that 50 of its 250 entries are in use. This command can be useful for verifying that the GSM module is able to communicate with the SIM card.
AT+CPBS=”SM”
Select the SIM card’s phone book. You can also replace the “SM” with the abbreviations for the other phone books listed previously.
AT+CPBR=1
Read the first entry from the currently-selected phone book. Replace the 1 with the number of the entry you wish to read (up to the total phone book size reported by AT+CPBS?).

Leave a Reply