GSM Shield weired characters in SMS

Hello,

I just got Arduino Uno running with Arduino GSM shield.
When running example for sending SMS I run into following problem:
SMS is successfully sent but the text message inside is corrupt.

I receive asian characters on my mobile whereas in serial monitor I enter regular english text.
e.g. message string "test" leads to "??"

I am using a t-mobile SIM registeted (PIN protected) in Germany in case that matters...

Any ideas or anybody experienced the same?
Thanks! Best Regards,
Musterstrasse

Hi,

it may be a problem with character set configured by default in the modem.

You can check if character set configured is correct:

1 - Upload this code in your Arduino:

#include <SoftwareSerial.h>
#include <string.h>

char incoming_char=0;      //Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
{

  //Initialize serial ports for communication.
  Serial.begin(9600);

  // reset
  Serial.println("Start Reset");
  pinMode(7, OUTPUT);
  digitalWrite(7, HIGH);
  delay(1500);
  //digitalWrite(7, LOW);
  delay(1000);
  Serial.println("End Reset");  

  cell.begin(9600);

  Serial.println("Ready for commands...");
}

void loop()
{
  //If a character comes in from the cellular module...
  if(cell.available() >0)
  {
    incoming_char=cell.read();    //Get the character from the cellular serial port.
    if((incoming_char >= ' ')&&(incoming_char<='z'))
      Serial.print(incoming_char);
    else
    {
      Serial.print("%");
      Serial.print((int)incoming_char);
      Serial.print("%");
      if(incoming_char==10)
        Serial.println();
    }
  }

  //If a character is coming from the terminal to the Arduino...

  if(Serial.available() >0)
  {
    incoming_char=Serial.read();  //Get the character coming from the terminal
    cell.print(incoming_char);    //Send the character to the cellular module.
  }
}

2 - Open serial monitor with 9600 baud and both NL & CR, and wait for message "Ready for commands...".

3 - Write AT in your serial monitor and push enter, repeatedly until you see the modem response as OK (ignore other messages).

Example:
AT%13%%13%%10%
OK%13%%10%

4 - Enter AT+CSCS? and push enter, you should see a response similar to:
AT+CSCS?%13%%13%%10%
+CSCS: "GSM"%13%%10% // this is character set configured
%13%%10%
OK%13%%10%

5 - If your character set is not GSM, you can change this with command AT+CSCS="GSM", and push enter. After, you can check it with AT+CSCS? and push enter.

Example:
AT+CSCS="GSM"%13%%13%%10%
OK%13%%10%
AT+CSCS?%13%%13%%10%
+CSCS: "GSM"%13%%10%
%13%%10%
OK%13%%10%

hi davidgoth,

thanks for your reply!
i did the steps you described but the GSM shield behavior stays as it was.

here is what serial monitor said when i entered the commands:

Start Reset
End Reset
Ready for commands...
%-8%AT%13%%13%%10%
OK%13%%10%
AT+CSCS?%13%%13%%10%
+CSCS: "GSM"%13%%10%
%13%%10%
OK%13%%10%
AT+CSCS="GSM"%13%%13%%10%
OK%13%%10%
AT+CSCS?%13%%13%%10%
+CSCS: "GSM"%13%%10%
%13%%10%
OK%13%%10%

When running the SMS example again I still get cryptic characters.

Any other tips to try?
Thanks!

Try send a SMS, one with Arduino SendSMS example and other with your mobile phone, and receive it in your Arduino with ReceiveSMS example.
Post your SMS messages received.

hi davidgoth,

thanks again for your feedback. here we go:

for both scenarios i am using the code examples from arduino 1.0.5 (SendSMS / ReceiveSMS) and both SIM cards (sending / receiving) are registered in Germany with t-mobile.

scenario SendSMS (arduino sending sms to my mobile):

  • i changed the line for #define PINNUMBER "" and entered my 4 digit pin
  • i opened serial monitor with 9600 baud and both NL&CR
  • here is the results for 7 tests that i ran ( --> )

1 --> empty SMS
a --> empty SMS
abc --> ?
test --> ??
abc abc --> ???
12 12 --> ??
12 --> ?

then i changed the parameter to debugging and here is the output in serial monitor for the last example with sending string "12" (i modified the output to mask my pin no. and mobile no.)

  • GSM gsmAccess = true;

SMSMS Messages Sender
AT%13%
0 9>AT%13%%13%%10%OK%13%%10%
AT+CPIN=xxxx%13%
9 44>AT+CPIN=xxxx%13%%13%%10%+CPIN: READY%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
44 75>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
75 106>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
106 9>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
23 54>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
AT+IFC=1,1%13%
54 71>AT+IFC=1,1%13%%13%%10%OK%13%%10%
AT+CMGF=1%13%
71 87>AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
87 103>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
103 114>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
114 120>%13%%10%OK%13%%10%
GSM initialized
Enter a mobile number: 0151xxxxxxxx
Now, enter SMS content: SENDING
Message:
12
AT+CMGS="0151xxxxxxxx"%13%
120 124>%13%%10%>
12%26%%13%
120 16>%13%%10%> %13%%10%+CMGS: 105%13%%10%%13%%10%OK%13%%10%
COMPLETE!
Enter a mobile number:

scenario b (arduino receiving sms from my mobile):

  • i changed the line for #define PINNUMBER "" and entered my 4 digit pin
  • i opened serial monitor with 9600 baud and both NL&CR
  • here is the results for tests that i ran ( --> )

12 --> 12
abc --> abc
1 --> 1
test --> test

test was successful for example SMSreceive
here is the debugging result for the test with string "test"

SMS Messages Receiver
AT%13%
0 9>AT%13%%13%%10%OK%13%%10%
AT+CPIN=xxxx%13%
9 44>AT+CPIN=xxxx%13%%13%%10%+CPIN: READY%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
44 75>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
75 106>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
106 9>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
AT+IFC=1,1%13%
9 40>AT+IFC=1,1%13%%13%%10%OK%13%%10%%13%%10%Call Ready%13%%10%
AT+CMGF=1%13%
40 56>AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
56 72>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
72 83>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
83 89>%13%%10%OK%13%%10%
GSM initialized
Waiting for messages
AT+CMGL="REC UNREAD",1%13%
89 95>%13%%10%OK%13%%10%
AT+CMGL="REC UNREAD",1%13%
95 101>%13%%10%OK%13%%10%
AT+CMGL="REC UNREAD",1%13%
50 4>%13%%10%+CMGL: 1,"REC UNREAD","+49151xxxxxxxx","","2013/06/05 02:53:27+08"%13%%10%test%13%%10%%13%%10%OK%13%%10%
Message received from:
+49151xxxxxxxx
test
END OF MESSAGE
AT+CMGD=1%13%
4 10>%13%%10%OK%13%%10%
MESSAGE DELETED
AT+CMGL="REC UNREAD",1%13%
10 16>%13%%10%OK%13%%10%

thanks a lot in advance!
musterstrasse

hi,

Repeat the same steps for check AT+CSCSI command that I posted, now with the command AT+QMGHEX.

The result should be: +QMGHEX: 0

You can change this configuration with AT+QMGHEX=0.

hi davidgoth!

Thanks for your tip.
Unfortunately it didn't work out but I think we are close.

Here is the logging:

Start Reset
End Reset
Ready for commands...
%-8%AT+CSCS="GSM"%13%%13%%10%
OK%13%%10%
AT+CSCS?%13%%13%%10%
+CSCS: "GSM"%13%%10%
%13%%10%
OK%13%%10%
AT+QMGHEX=?%13%%13%%10%
+QMGHEX: (0,1)%13%%10%
%13%%10%
OK%13%%10%
AT+QMGHEX=0%13%%13%%10%
+CME ERROR: 11%13%%10%
AT+QMGHEX=1%13%%13%%10%
+CME ERROR: 11%13%%10%
AT+QMGHEX=0%13%%13%%10%
+CME ERROR: 11%13%%10%
AT+QMGHEX=?%13%%13%%10%
+QMGHEX: (0,1)%13%%10%
%13%%10%
OK%13%%10%

I am getting "+QMGHEX: (0,1)" as a response other than you expected.
When I try to change this value to "0" I am getting an error "+CME ERROR: 11"

Google says that means "SIM PIN required"

It seems that I cannot change QMGHEX value without entering PIN.
Any idea on why that is the case or how to issue the command along with the PIN?

Thanks!
Musterstrasse

Hi,

The command is AT+QMGHEX? for show actual configuration, not AT+QMGHEX=?.

First, you have to enter your pin with AT+CPIN=1234 where 1234 is your PIN. After, enter AT+CMGF=1 to activate Text mode. At this moment, you will be able to use AT+QMGHEX=0.

Hi!

I ran though your instructions and could set QMGHEX to "0" (the values was already set).
The problem still stays the same. When sending an SMS with Arduino shield it is received in weird characters on my mobile.

Here is the logging in serial monitor of what I did (1234 masks my PIN)

Start Reset
End Reset
Ready for commands...
%-8%AT%13%%13%%10%
OK%13%%10%
AT%13%%13%%10%
OK%13%%10%
AT+QMGHEX?%13%%13%%10%
+QMGHEX: 0%13%%10%
%13%%10%
OK%13%%10%
AT+CPIN=1234%13%%13%%10%
+CPIN: READY%13%%10%
%13%%10%
OK%13%%10%
%13%%10%
Call Ready%13%%10%
AT+CMGF=1%13%%13%%10%
OK%13%%10%
AT+QMGHEX=0%13%%13%%10%
OK%13%%10%
AT+QMGHEX?%13%%13%%10%
+QMGHEX: 0%13%%10%
%13%%10%
OK%13%%10%

Thank you very much for any new idea on how to solve that issue.
Musterstrasse!

Try restart modem to default manufacturer configuration with AT&F.

Hi!

Unfortunately no change in GSM shield behavior even after resetting.
The outbound SMS still do have cryptic characters on them.

Here is the output of the serial monitor when trying to reset:

Start Reset
End Reset
Ready for commands...
%-8%AT%13%%13%%10%
OK%13%%10%
AT&F%13%%13%%10%
OK%13%%10%

Any more ideas?

I also did activate debugging during sending the sms maybe that helps...

GSM gsmAccess(true);

Here is the output in serial monitor during sending

SMS Messages Sender
AT%13%
0 9>AT%13%%13%%10%OK%13%%10%
AT+CPIN=1234%13%
9 44>AT+CPIN=1234%13%%13%%10%+CPIN: READY%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
44 75>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
75 106>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
106 9>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
AT+IFC=1,1%13%
9 40>AT+IFC=1,1%13%%13%%10%OK%13%%10%%13%%10%Call Ready%13%%10%
AT+CMGF=1%13%
40 56>AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
56 72>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
72 83>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
83 89>%13%%10%OK%13%%10%
GSM initialized
Enter a mobile number: +4915112345678
Now, enter SMS content: SENDING

Message:
test
AT+CMGS="+4915112345678"%13%
89 93>%13%%10%> 
test%26%%13%
89 113>%13%%10%> %13%%10%+CMGS: 113%13%%10%%13%%10%OK%13%%10%

COMPLETE!

Enter a mobile number:

As a result I still receive message string "??" on my mobile. (sms content is "test")

To check if modem has a problem. Can you execute this commands and post response?

AT+GMM
AT+GMR
AT&V

hi!,

here is the output in serial monitor when I entered the 3 commands:

Start Reset
End Reset
Ready for commands...
%-8%AT%13%%13%%10%
OK%13%%10%
AT+GMM%13%%13%%10%
Quectel_M10%13%%10%
%13%%10%
OK%13%%10%
AT+GMR%13%%13%%10%
Revision: M10BR06A06N32%13%%10%
%13%%10%
OK%13%%10%
AT&V%13%%13%%10%
ACTIVE PROFILE%13%%10%
%13%%10%
E: 1%13%%10%
%13%%10%
Q: 0%13%%10%
%13%%10%
V: 1%13%%10%
%13%%10%
X: 4%13%%10%
%13%%10%
S0: 0%13%%10%
%13%%10%
S2: 43%13%%10%
%13%%10%
S3: 13%13%%10%
%10%
5%13%%13%:1%10%
%10%
CLGDR0%10%
+MB%10%
%13%%10%
CI 1+%13%%10%
 %10%
%10%
CAR8CIST %13%%10%
%10%
00%10%
%10%
CA %10%
%10%
%10%
++SME ,%13%%10%
,O21,EHEO,41%10%
+EHI)244EO:8%10%
%10%
QE%13%%13%%10%
%10%
SS0%10%
O%13%

Can you read anything unusual from that?
Thanks for your help!

Hi,

Sorry for late response,

Can you execute this commands and post response?

AT+CSCS?
AT+CSMP?
AT+CMGF?
AT+QSMSCODE?

Thanks!.

hi davidgoth,

i startet with AT+CPIN=1234 and entered my PIN in case that was needed...
here is what Arduino outputs to serial monitor:

Start Reset
End Reset
Ready for commands...
AT+CPIN=1234%13%%13%%10%
+CPIN: READY%13%%10%
%13%%10%
OK%13%%10%
%13%%10%
Call Ready%13%%10%
AT+CSCS? %13%%13%%10%
+CSCS: "GSM"%13%%10%
%13%%10%
OK%13%%10%
AT+CSMP?%13%%13%%10%
+CSMP: 17,255,0,8%13%%10%
%13%%10%
OK%13%%10%
AT+CMGF? %13%%13%%10%
+CMGF: 0%13%%10%
%13%%10%
OK%13%%10%
AT+QSMSCODE?%13%%13%%10%
+QSMSCODE: 1%13%%10%
%13%%10%
OK%13%%10%

thanks for your feedback!

Hi!,

I find the “CSMP” not right due to this issue.
CSMP’s dcs setting is 8, which means this is in UCS2 coding, but the CSCS using “GSM” coding. Here is the conflict.

Just set AT+CSMP=17,255,0,0 first,then try to send SMS again..

If you have any doubt, reply this post.

hi,

I am glad that you still find new ways for me to try.
however even after following your instruction (see below) I am getting the same result (when sending "test" I am getting "??" as string within the sms).

any other ideas that i could try?
thanks a lot!!

Start commands...
Start Reset
End Reset
Ready for commands...
AT+CPIN=1234%13%%13%%10%
+CPIN: READY%13%%10%
%13%%10%
OK%13%%10%
%13%%10%
Call Ready%13%%10%
AT+CMGF=1%13%%13%%10%
OK%13%%10%
AT+CSMP? %13%%13%%10%
+CSMP: 17,255,0,8%13%%10%
%13%%10%
OK%13%%10%
AT+CSMP=17,255,0,0%13%%13%%10%
OK%13%%10%
AT+CSMP?%13%%13%%10%
+CSMP: 17,255,0,0%13%%10%
%13%%10%
OK%13%%10%

Try now changing character set to UCS2 with AT+CSCS="UCS2" and send any message. Post the results.

i followed your suggestion:

Start Reset
End Reset
Ready for commands...
%-8%AT+CPIN=1234%13%%13%%10%
+CPIN: READY%13%%10%
%13%%10%
OK%13%%10%
%13%%10%
Call Ready%13%%10%
AT+CSCS="UCS2"%13%%13%%10%
OK%13%%10%
AT+CSCS?%13%%13%%10%
+CSCS: "UCS2"%13%%10%
%13%%10%
OK%13%%10%

unfortunately there is no change in behavior.

message string "test" still leads to "??" when receiving the sms

any idea on how to fix that?

Hi,

Sorry, I forget to say you that you have to save CSCS configuration with AT&W.

1 - Change CSCS with: AT+CSCS="UCS2"
2 - Save with: AT&W
3 - Restart modem and check that it is saved with: AT+CSCS?
4 - Send SMS!!