Go Down

Topic: SIM card issue with Arduino uno (Read 883 times) previous topic - next topic


May 29, 2018, 06:33 pm Last Edit: Jun 01, 2018, 04:52 pm by usenetfan
Hello gurus / guru-ettes,

Lately a student group created a mailbox that sent an SMS when mail arrived. I ordered a SIM900 GSM/GPRS ICOMSAT EXPANSION BOARD from Hobbyking for them, but they ran into issues getting Arduino to talk with the board. They tried everything Google had to offer with the latest IDE, but to no avail.

It was finally solved by backtracking the Arduino IDE to 1.6.5 when it started to work.

The question is, do I need to keep an installation of 1.6.5 for SIM projects, or, did we miss something?

This is the board.


did we miss something?
Obviously. Things like posting the code. Explaining exactly what the code does. Explaining how that differs from what you expect.

Downgrading to an older version of the IDE hardly seems like a necessary step.


Okay, here goes (I was just thinking if anyone had come across the same issue).

The thing is this: Using 1.8.5 with this code doesn't send the message. It does connect to the SIM card shield, and the SIM card finds the network, but this code works only if compiled in an early version of the IDE. Please ignore the comments in Finnish, or, learn Finnish with the code.

The piezo horn is used only to confirm the switch going down. This code does send the message.

Code: [Select]

 #include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2);
const int mySwitch = 6; // Muuttumaton muuttuja mySwitch on kytkennässä 6
int piezoPin = 7; // Muuttuja pilli on kytkennässä 7
// Määritellään muuttujan mySwitchDown arvoksi false
boolean mySwitchDown = 0;
boolean lastState = 0;

void setup()
  //Sammutetaan ledi
  digitalWrite(LED_BUILTIN, LOW);
  // Pinni joka määritelty  kytkimeksi on input pinni
  pinMode(mySwitch, INPUT);
  // Sisäinen ledi on yksi output pinni
  // määritellään mySwitch pinniin HIGH eli 5 volttia
  digitalWrite(mySwitch, HIGH);
  mySerial.begin(9600);   // Setting the baud rate of GSM Module 
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)

void loop()
   mySwitchDown = digitalRead(mySwitch);
    if (mySwitchDown != lastState) {
          if (mySwitchDown==LOW) {
    // Viive seuraavaan loopin alkuun
    // Arduinon sisäinen led syttyy
    digitalWrite(LED_BUILTIN, HIGH);
    // Pilli, hertsit(äänenkorkeus), viive
    tone(piezoPin, 1000, 500);
    // Viive, johon lisätään pillille annettu viive
    mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
    delay(1000);  // Delay of 1000 milli seconds or 1 second
    mySerial.println("AT+CMGS=\"+358505018555\"\r"); // Replace x with mobile number
    mySerial.println("I am SMS from GSM Module");// The SMS text you want to send
    mySerial.println((char)26);// ASCII code of CTRL+Z

  // Jos mySwitchDown ei toteudu
  } else {
    //Arduinon sisäinen ledi sammuu
    digitalWrite(LED_BUILTIN, LOW);
 } else {
 lastState = mySwitchDown;

 void RecieveMessage()
  mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS


Does getting rid of the code for diddling with the LED and reading switch states make any difference?

Every AT command causes a response from the modem. ASSuming that each returns OK, and that you can send the next one is NEVER a good idea.

Go Up