Instructables

SM5100B GPRS and General Notes

Picture of SM5100B GPRS and General Notes
This instructable is for the use of the SM5100B-D shield from sparkfun: https://www.sparkfun.com/products/9607
Its no good to you for the other GSM shields, Sorry.

I spent so, so long hacking at this stupid shield trying to make sense of the +SIND's  and other rubbish - these things do work, they just test your patience. The minimal and poorly written documentation is useful if not as frustrating, hopefully this will save you some time.

Dont take this all for gospel, Im not an electronics or programming whizz, I have just persevered and learnt a few things.
Please feel free to question anything written here and Ill try to update the instruct-able if you can contribute.
 
 
Remove these adsRemove these ads by Signing Up

Step 1: Things to consider


I have found some good resources,
The most useful being some actual working code:
https://github.com/tobek/SM5100B-GPRS/blob/master/...
&
A good intro into setup
http://tronixstuff.com/2011/01/19/tutorial-arduino...


Some things to note:
1) Software serial is not the best option, in my tests it doesn't keep up with the serial output from the GSM module, and if you cant keep up then the data is dropped and your stuck. Software serial is ok for grabbing the return codes from your AT commands but when it comes to receiving your actual data, like http responses - it just doesn't keep up at all. I have seen mention that the 9600 baud rate that the SM5100B-D is set to is not fast enough, I have not found this to be true, as long as I use a hardware UART I get all the data back from the shield.

2) Power - you cant run this shield from the Arduino Power - you just cant. I tried to ignore these warnings, dont waste your time. Feed it 5 volts from a transformer or battery capable of supplying 2-3 amps. You will find that if you dont it will just keep overdrawing on your Arduino when it goes to transmit and everything will just reset.

3) Antenna, you need one.
I have actually been able to get +SIND:4 without one, but I have been getting full reception with one of those tiny little duck Antennas - I got two for a couple of dollars right here:http://www.electrodragon.com/?product=quad-band-ce... For Australians - You can pick up an antenna from Jaycar - pricey but dont have to wait on delivery: http://www.jaycar.com.au/productView.asp?ID=AR3310

4) Documentation, the official AT command set documentation comes in handy, only the author truly knows what on earth he/she was trying to describe, its bad, real bad, but it comes in handy: https://www.sparkfun.com/datasheets/CellularShield...
I guess sparkfun wrote this more specific GPRS / IP stuff, as it kind of makes sense in comparison:
https://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCPIP%20App%20Note.pdf

cbrompton1 month ago

Hey Thanks for all your info on this. I have successfully made connection to my web server. I'm no t a C coder either but I would love to look at your library and perhaps have a go at it with you. send me a message if you are interested

BenHarper (author)  cbrompton1 month ago

G'day,

Sorry to say I dropped the ball on this.

I really needed a GSM modem in the end form my project so got a 3g dongle and connected it to a beaglebone, was allot of hassle trying to work with AT commands and strings and such when I really just needed full blown tcp routing.

I can dig up the code I had started for the library if your interested, its fairly basic but maybe its a starting point if you wish to pursue it? Library had some test scripts as well.

I've zipped them up and I PM'd you, reply if your interested in what I have so far and ill send it.

Hi!

I am working on a project and your info has been really helpfull! Could you plz send me a copy of your arduino library?

thanks!

BenHarper (author)  cristobalgh4 days ago

G'day Cristobalgh, were are you from mate?

I don't have your email so I have put it up on dropbox: https://dl.dropboxusercontent.com/u/57971816/5100B...

I don't remember what state the library is but I assume its as i left it.

Im not a great coder so its probably just a good reference for you to make your own code more than a fantastic library ready to use;)

Cheers

Ben

amir11223 months ago

Hey,

Can I please ask why did you need the USB serial adapter. Couldn't you connect to the one UART you have? I have Arduino Due with 4 UART and having trouble connecting it properly to the shield? How should it be connected as I get no response on the serial monitor.

Thank you

BenHarper (author)  amir11223 months ago

I was using a uno with only one UART, I needed that one UART for the module to talk to the arduino but also wanted to wanted to debug via the serial monitor which needs a UART as well so I needed the extra FTDI serial connection, you wont need it as you have 4 on board - I have since taken to the mega 2560 so I dont need that any longer either.

Are you getting no response at all from your aduino or the arduino is showing no response from the GSM module?

First Thank you.
On my cellular shield, the two connections that are soldered together are the two closest to the Rx Tx writing. According to the schematic and my understanding, this only enables the shield to send serial communication via ports 2,3. My connections:
Arduino Due connected to computer via USB.
Shield gets its power from 5v external power (capable of 2.5A) supply and both the shield and the board are connected to its ground.
Port 2 of shield connected to Tx1 of Arduino
Port 3 of shield connected to Rx1 of Arduino.
I have also tried to used ports 0,1 of the shield labelled Rx Tx and connect them to Arduino serial 1. Anyway still nothing appears on Arduino IDE serial monitor but starting serial communication.
Any help will be much appreciated...
BenHarper (author)  amir11223 months ago

And did you try the amended code I added in the comment below?

I think port two on the GSM module is TX and should go to the RX of your arduino - I know that looks strange as the markings show RX TX for 0 & 1 and so you would guess that it was RX TX for 2 & 3 - but no its TX RX for pins 2 & 3 on the GSM shield.

Try that simple swap first, then if no good - troubleshoot with some ideas below:

Connect TX0 to RX1, and RX0 to TX1 - then start the serial montitor

You should get the "Starting SM5100B Communication..." bouncing backwards and forwards between your serial connections and printing over and over on your serial monitor - If so your Code is working fine.

If so, then connect pin 2 of GSM Sheild (confusingly it seems pin two is TX not pin 3 as i would have guessed) to your Serial 1 RX and restart the shield and the arduino.

Also remember when your searching for the serial connection, restart the GSM sheild after making changes as it goes through its setup and then goes quiet, so you may not see anything and think its not working, but in reality its just waiting for you to talk to it - So reset gsm shield and see if you get any serial data.

If your not getting any serial data resembling

+SIND: 11

+SIND: 3

+SIND: 4

ÐèÐèÐ

+SIND: 1

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

+STIN:0

+SIND: 4

then at this point then you need to work out why your GSM shield is not communicating. Even if your baud rates are mismatched you should at least get a whole lot of rubbish characters showing up. If you get nothing get your oscilloscope then probe the TX pin of the shield , if you don't have an oscilloscope consider buying one - you need one - even a super cheapie of eBay is worth every dollar * 1000, without a scope everything is just a big old guess).

Otherwise if you have a logic analyser you can use that to check the TX line from GSM Module, or maybe even get by with a multimeter. Or if you have a FTDI cable or other TTL serial to USB cable you can connect the RX of that to the TX of the GSM Module and see if you can capture any serial data. You really need to have at least one if not all of these test equipment options to work out whats going on - otherwise your just jumping pins everywhere in random combinations hoping something will work.

Hey Ben,

I did what you said and it does work. The problem was with the pins. Thank you for that. However, now I have another issue. I am trying to connect both the shield (serial 3 on Due) and a puprletooth jamboree bluetooth module (Serial2 on Due). When both are connected to Due only the BT module works and the cellular shield stops responding. Both are connected to an external power source. Any idea as to why? Is the board unable to drive both together?

Thank you.

BenHarper (author)  amir11223 months ago
No, board can talk on all 4 serial connections almost at same time, it buffers incoming data so it can process it as it has time, I believe, either way I have communicated on all 4 connections before to test this theory and it's no prob. Please attach photo and code sample and I'm sure it's something I can see going wrong
BenHarper (author)  amir11223 months ago

Maybe I know why theres nothing coming back to you, if you are using the code from step 4, you will need to remove the software serial part and just apply one of your other hardware serial UART ports instead so something like

#include
#define GSMSerial Serial1 // the hardware serial will now be known as GSMSerial

#define SMSerial Serial //

char incoming_char=0; //Will hold the incoming character from the software Serial Port.
void setup()
{
//Initialize serial ports for communication.
SMSerial.begin(9600);
GSMSerial.begin(9600);
SMSerial.println("Starting SM5100B Communication...");
}
void loop()
{
if(GSMSerial.available()>0) //If a character comes in from the cellular module...
{
SMSerial.write(GSMSerial.read()); //write it out to the serial monitor so we can see it
}
if(SMSerial.available() >0) //If you type something into the serial monitor
{
incoming_char=SMSerial.read(); //Get the character coming from the terminal
GSMSerial.print(incoming_char); //Send the character to the cellular module.
}
}


And then your serial (Serial 0) which comes out of the USB port (and pins 0&1) will be your serial monitor connection and what ever ports your second UART (serial1) is connected to will be the ones you connect over to the GSM module.

Also - dont sit the GSM module on top of your arduino, sit it beside for testing and run link wires over to it like in my photo. The GSM module is using pins 0&1 for its serial link, if you stick the boards together it will be talking to your aduino over the same pins (0&1) that your arduino is talking to the computer on.

Sorry if this is obvious, but just in case your not aware - the USB serial interface, shares the pins 0 & 1 - so you will find anything getting sent up and down the USB cable is also using those pins 0&1, and if you try to use them for other purposes (by accidentally putting a shield on top which tries to use the same pins, like this GSM shield does)then there will be a big old miscommunication.

I guess this is where your problem is - let me know if its not the case.

So in short.

Use your USB for degugging via serial montor

Dont stack the shield on the top of your Arduino!

Use pins 19 (RX) and 18 (TX) on your due to connect to the GSM module

ANd lastly, when you put it all together in the end and want to be able to stack the shield on top without the pins 0&1 double up, there is a trace on the GSM module that you can solder or desolder (forget the details) and it changes the pins that the GSM module is using - Youll have to read into that cause I have forgotten how it works

arei2_113 months ago

Great job! I'm also writing my TCP library (I need only a GET connection). Now I'm thinking which is the best method to capture an error from the module when connection is lost using the virtual serial port.

This is a part of my code.

void SerialTCP::sendData(String DOM, String URL)

{

String toReplace = GETCONST;

toReplace.replace("!", URL);

toReplace.replace("<", DOM);

int l = toReplace.length() * 2;

int i = 0;

this->print("AT+SDATASEND=1,");

this->print(l);

this->print(",\"");

while(i < toReplace.length())

{

if(toReplace.charAt(i) == '(')

{

this->print("0A");

}

else

{

this->print(toReplace.charAt(i), HEX);

}

i++;

}

this->println("\"");

}

Where GETCONST = "GET /! HTTP/1.1(Host:<(("

Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!