reading SMS using sm5100

Hello everyone,

I'm using arduino uno and sm5100b GSM module to read a SMS and send it [using ethernet shield] to a server.
while testing, I found that when sending a msg from an iPhone with the number 53, my server gets the number 53.
But when I sent the same SMS from a blackberry, I got "005003".

Any idea?

Any idea?

The problem is on line 37 of your code.

It's nothing to do with the code.
Even if I just use a sample code that will output SMS to a Serial monitor - I'll get the same result.
I guess I'm missing something regarding the encoding of the text using the GSM module...

For example, I sent 4 SMS from 4 different cellular phones.
the first two messages are from an iPhone [the content of the SMS was the number 13] and a Nokia E71 [the number 15]
the next two were from a Nokia 7230 [sent the number 20] and a blackberry [the number 33]:

+CMT: "+XXXXXXXXXXX","++XXXXXXXXXXX1","11/10/13,19:38:15+08",2
13
+CMT: "+XXXXXXXXXXX","+XXXXXXXXXXX","11/10/13,19:39:24+08",2
15

+CMT: "+XXXXXXXXXXX","+XXXXXXXXXXX","11/10/13,19:40:14+08",6
200F00320030

+CMT: "+XXXXXXXXXXX","+XXXXXXXXXXX","11/10/13,19:40:38+08",4
00330033

Liad:
It's nothing to do with the code.

So you say. Yet there is not much else that anyone can help you with across a BBS.
From a probabilistic perspective, the issue may be:
(1) some of these models of phones screw up short numeric messages -- 0.000000000%
(2) something in the electronics you have configured has this effect -- 0.0000%
(3) the firmware or library of the 5100 is doing this -- 1%
(4) there's a bug in your code -- 99%

Why not just look at the code?

What happens to successive messages from the BB or any of the other phones? If you send 123 and 234 and other patterns from the "working" and "non-working" phones, do you get the same results consistently for the same message? Is there a pattern in the way things appear wrong?

What happens if you swap SIMs between "working" and "non-working" phones? Is the problem triggered by the SMSC?

Hey,

thanks for your quick response..

The example code that I use to monitorl the serial output:

/* SparkFun Cellular Shield - Pass-Through Sample Sketch
SparkFun Electronics Written by Ryan Owens CC by v3.0 3/8/10
Thanks to Ryan Owens and Sparkfun for sketch */
#include <NewSoftSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h>         //Used for string manipulations
char incoming_char=0;      //Will hold the incoming character from the Serial Port.
NewSoftSerial 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);
cell.begin(9600);
Serial.println("Starting SM5100B Communication...");
}
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.
Serial.print(incoming_char);  //Print the incoming character to the terminal.
}
//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.
}
}

Some more outputs using a blackberry [swapped SIMs as well - still sends in the same format]
This time, the first SMS contains the number 33 [as before], the second one - the number 123.

+CMT: "+XXXXXXXXX","+XXXXXXX","11/10/13,20:56:07+08",4
00330033

+CMT: "+XXXXXXXXX","+XXXXXXXXX","11/10/13,20:56:40+08",6
003100320033

Thanks.

I wonder if one or more of the phones is set to PDU format . Send a text string and see how it comes out

Liad:

/

00330033

003100320033

Well, this looks like 4-digit zero-filled hexadecimal representations of the original strings. 0x33 == '3', 0x31 == '1'. The PDU theory sounds good to me.

The sketch you posted is just the monitor passthrough from http://tronixstuff.wordpress.com/2011/01/19/tutorial-arduino-and-gsm-cellular-part-one/
What commands did you send to the module to read the SMS?

Reading http://www.sparkfun.com/datasheets/Cellular%20Modules/CEL-09533-SMS-APPNOTES-V1.0.pdf
there are different commands for retrieving a PDU format vs text format SMS.

Yes, I'm using text mode.

These are the commands I sent to the module....

AT+CNMI=3,3,0,0
AT+CMGF=1
AT+CMGD=1,4

How can I know when to read it as text and when as PDU?
Should I always use PDU mode? will it solve the problem?

##Update:

I set the module to PDU mode (CMGF=0) and sent two messages: 1 from an iPhone the other from the Blackberry with the same content.
I used http://www.smartposition.nl/resources/sms_pdu.html to interpret it.
The difference between those two messages was in the TP-DCS [Data coding scheme]
the iPhone sends SMS using default alphabet while the blackberry uses UCS2 (16bit)...

Now I need to build a script that will identify which coding the phone uses, then translate the content with the appropriate decoder[that I need to build? how?]

I found this post after ripping my hair out for 6 hours.

My solution was the phone that was sending the text.

My phone (the one sending) has a setting for the format of the text messages to be sent, I had changed it to Unicode to enable Smileys.

This setting forced the phone to send PUD format.

I switched the setting to Automatic and everything works fine now.

FYI My phone is Android S6

Settings > Messaging > Text