Go Down

Topic: Arduino Nano and GSM Shield --> Code hung! Please help (Read 3124 times) previous topic - next topic

helloworld23

Hello there,

im new here and don't have an amount of knowledge about arduino and co. But for school i have to do a project. I have to connect an arduino nano to the arduino GSM-Shield. No problem so far. Next step, i have to program a code to send a sms from the GSM to a mobile phone. So i clicked on File > Examples > GSM > SendSMS. Then the code appears. I flashed the code on the arduino and the upload was successful. Then i opened the terminal, and it printet out: "SMS Messages Sender". There it hung. I found out that the code:
Code: [Select]
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
  
  Serial.println("GSM initialized");


makes the problem. But I don`t know whats the matter? I already changed the GSM3 Library because it had an error --> http://forum.arduino.cc/index.php?topic=258591.0
But that couldn't fix the Problem.
Also the PIN number is written correctly.
Does anyone of you know what could be wrong??

With friendly greetings

helloworld23

dannable

Remove the PIN from the SIM card?

Use AT commands instead of relying on the library?

AT+CPIN
AT+CMGS
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

helloworld23

Hello,

how do i remove the PIN from the sim card? is there any syntax, which can do this or do i have to do it manually?

AT Commands: I have read about AT-Commands but don't really know how the work or what they do? can you give me any further information about AT-Commands and how to use them?

Thanks for reply

With friendly greetings

Lukas Leitner

dannable

I would remove the PIN manually. I wouldn't even have put it on in the first place.

If you locate a copy of a Serial Relay program/sketch (there is one on the page linked to in my signature) you can see the basic method of sending AT commands to the shield. You will need to tweak it to talk to your shield using pins 2 & 3.

Sending an SMS is as simple as issuing the AT command, which includes the recipients number, then send the body of the message, then ctrl+z to finish.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

SupArdu

hi,
another reason for the software hanging in gsmAccess.begin(...) can be that the autobaud function could not detect the baudrate.

This was a problem with my GSM shield, see the following link:

https://forum.arduino.cc/index.php?topic=349569.0

SupArdu
-------------------
have success
SupArdu

helloworld23

#5
Nov 17, 2015, 05:41 pm Last Edit: Nov 17, 2015, 08:32 pm by helloworld23
Hello again,

i removed the pin from the sim card, as you said, but it didn't work either. I also tried with AT commands but I don't get how they work. So i decided to upload a photo of my project so you can see how i connected the arduino to the gsm shield. The photo is attached. These pins i have connected:

Arduino 5V --> GSM 5V
Arduino GND --> GSM GND
Arduino TX1 --> GSM_RX
Arduino RX0 --> GSM_TX

Then I opened the code from arduino-examples "SendSMS". I also enabled the debugging mode to see whats wrong, the terminal put out this text:
SMS Messages Sender
gsm.begin()
AT%13%gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
gsm.begin() waiting for ready
Not connected
gsm.begin()

I just don't get what is wrong with this shield. Please help  :smiley-confuse:

With friendly greetings

helloworld23

dannable

You are turning the shield on? I don't see any connections to enable software power control.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

dannable

I am unfamiliar with the Nano, but I have a feeling that there is something wrong with your connections. The default library is trying to communicate with the shield using pins D2 & D3, but you seem to be using D0 & D1. Which pins does the Nano use to communicate with the Serial Monitor?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Go Up