Celular Shield with SM5100B & Arduino Mega

Good morning

I've bought the 'Celular Shield with SM5100B' from Sparkfun.

My Arduino is a Mega.
I have several doubts. I'm using a code from http://tronixstuff.wordpress.com/2011/01/31/tutorial-arduino-and-gsm-cellular-–-part-two/
I don't understand (I don't have experience to understand it) if I have to create a 'fake' serial port using Pin 2 and Pin 3.
I don't understand if I have to use "cell.print(incoming_char)" or "Serial1.print(incoming_char)".

Actually I have this connection... SB5100B as shield, applied on Mega (not showed on picture)

I launch the program but nothing happens... and should appear some like this...

  • +SIND: 1 means the SIM card has been inserted;
  • the +SIND: 10 line shows the status of the in-module phone book. Nothing to worry about there for us at the moment;
  • +SIND: 11 means the module has registered with the cellular network
  • +SIND: 3 means the module is partially ready to communicate
  • and +SIND: 4 means the module is registered on the network, and ready to communicate

I have a power supply 12V 2A connected to Arduino
Here is the code...

//Include the NewSoftSerial library to send serial commands to the cellular module.
#include <NewSoftSerial.h>
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.

//GSM
int mobilenumber=xxxxxxxxx; //9 digits. should put also country indicator as 00351xxxxxxxxx??

void setup() {

Serial.begin(9600);
cell.begin(9600); //GSM
Serial.println("Em comunicacao...");
delay(35000); // give the GSM module time to initialise, locate network etc.

}

void loop() {//GSM
//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.
}
}

Please let me know
Thanks on advance
Best regards

Pedro Ferrer

Did you read the bit about changes needed if you are using a Mega?

Finally, the example sketches will be different. Mega will not use the NewSoftSerial library, instead we use the Serial1 port. Please use the following Mega-equivalent sketches for this article: Example 27.1 and 27.2.

//Include the NewSoftSerial library to send serial commands to the cellular module.
#include <NewSoftSerial.h>  
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.

Apparently not...

Hello PaulS

Thanks by your comment.
You're right!
I've download the wrong example...

Example 27.2 (Mega version)

This line have 2 examples...
Example 27.2 - https://sites.google.com/site/tronixstuff/home/arduino-tutorial-series-files/example27p2.pde?attredirects=0&d=1
Mega - https://sites.google.com/site/tronixstuff/home/arduino-tutorial-series-files/example27p2mega.pde?attredirects=0&d=1

I didn't understood at the time...
Now I've download the correct one.

But I don't understand one (step by step...) thing... I stile have to connect jumper on D2 and D3 on GSM module?

I'll try now...

Thanks on advance
Best regards

Pedro Ferrer

Good night

Finally I can send messages from PLC to my mobile phone.
It's just the beginning!

char incoming_char=0; //Will hold the incoming character from the Serial Port.
char mobilenumber[] = "xxxxxxxxx"; // Replace xxxxxxxx with the recipient's mobile number

void setup() {
Serial.begin(9600);
Serial1.begin(9600); //GSM
Serial.println("Em comunicacao...");
delay(35000); // give the GSM module time to initialise, locate network etc.
}

void loop() {//GSM
//If a character comes in from the cellular module...

while(Serial1.available()){
if(Serial1.available() >0){
incoming_char=Serial1.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
Serial1.print(incoming_char); //Send the character to the cellular module.
}
}

Serial1.println("AT+CMGF=1"); // set SMS mode to text
Serial1.print("AT+CMGS=");
Serial1.print(34,BYTE); // ASCII equivalent of "
Serial1.print(mobilenumber);
Serial1.println(34,BYTE); // ASCII equivalent of "
delay(500); // give the module some thinking time
Serial1.print("PIPPO");
Serial1.println(26,BYTE); // ASCII equivalent of Ctrl-Z
delay(15000); // the SMS module needs time to return to OK status
Serial.print("Msg enviada com sucesso");

do // loop temp just to test sketch
{
delay(1);
} while (1>0);
}

What I receive on PLC start up

Em comunicacao...

+SIND: 1

+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1

+SIND: 3

+SIND: 11

+SIND: 4
Msg enviada com sucesso

Message received on mobile was 'PIPPO'.

Thanks
Best regards
Pedro Ferrer

Hello

One year and half has gone... on this time the GSM were keep it on the bottom of the drawer.
Last few days I've tried to put it back, but without success... I receive some trash by serial.

I'm using Arduino 0023 exe

It's strange, because the Arduino is the same, USB cable is the same, 12V power suplly is the same, SIM card is the same, laptop and OS are different... I'm using Windows 7.

Without power supply connected, I have reasonable correct information...

But with 12V power supply on Arduino, plus USB cable... Jesus!

I've tried with other Arduino Mega (2560 instead 1280)...
Changed 12V power supply...
Changed 220AC socket...
Changed USB cable...
Changed SIM card...
But the problems remains...

I read some about serial speed... that by default came with 115200, but on my case I doubt, because before worked well with 9600!

I don't know what to think!
I'm desperate...

Thanks on advance
Pedro Ferrer

You get these trash characters with the hardware serial or did you go back to the SoftwareSerial implementation?

How is your current wiring?

Hello Pylon

You can see my wiring on post #1, the image it's attached.
I still use Serial1, since I'm using Mega.

Thanks

You can see my wiring on post #1, the image it's attached.

That picture shows a Mega connected to an ethernet shield, incompletely. What is that supposed to tell us about how you connected the Cellular shield to the Mega?

Hello PaulS

Just to show that:

Pin 19 Arduino is connected to pin2 SM5100B
Pin 18 Arduino is connected to pin3 SM5100B

Thanks

This will not work because you also need a GND connection as well as some source of power. The shield uses the VIN pin so you have to supply at least about 5V there.

Edit: Have you checked the jumpers on the shield to be in RX/TX position and not pin 2/3?

Hello Pylon

The SM5100B is a shield and I plug it on Arduino directly.
I suppose that 5V are on Vin.

if I put on RX/TX I can't see nothing on Arduino console, so I think that is well configured about that. (D2 and D3)

Thanks
Pedro Ferrer

Any information you write is wrong. You first wrote that the wiring is as in the picture but there only two pins are connected. No you tell us that that shield is completely plugged in. Does that mean you have made the connections on the picture just additionally?

Is something else connected to the Arduino?

Have you tried other baud rates on Serial1? Maybe the module has been configured to another baud rate in the mean time, this may have happened unintentionally. The default baud rate is 115200.

Hello

I have the SM5100B plugged in Arduino.

Also have 2 jumpers connected:
Pin 19 Arduino is connected to pin2 SM5100B
Pin 18 Arduino is connected to pin3 SM5100B

Also tried bigger baud rates without success...

Can be some problems on my USB port?

Thanks.
Pedro Ferrer

Also tried bigger baud rates without success...

Which ones? All available as device baud rates?

Can be some problems on my USB port?

Don't think so, I don't see any relation to the USB port.

Do you have some USB2Serial adapter (FTDI cable, Arduino USB2Serial LIght, etc.)? That way testing different baud rates would be easier.

Hello

I have a Max232 converter... I've bought a few months ago, tested with usb/serial convert.

This weekend I'll test apply it on GSM.

Thanks
Pedro Ferrer