Go Down

Topic: Trying to send or receive a text message using MKR 1400 (Read 871 times) previous topic - next topic

starskii

Hello all, I'm very new and I think I'm missing something here.

I have an arduino MKR 1400 with arduino sim, my hope was to be able to send a test text to my own phone using the example software:

Code: [Select]
/*
 SMS sender

 This sketch, for the MKR GSM 1400 board,sends an SMS message
 you enter in the serial monitor. Connect your Arduino with the
 GSM shield and SIM card, open the serial monitor, and wait for
 the "READY" message to appear in the monitor. Next, type a
 message to send and press "return". Make sure the serial
 monitor is set to send a newline when you press return.

 Circuit:
 * MKR GSM 1400 board
 * Antenna
 * SIM card that can send SMS

 created 25 Feb 2012
 by Tom Igoe
*/

// Include the GSM library
#include <MKRGSM.h>

// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = "0000";

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Sender");

  // connection state
  bool connected = false;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop() {

  Serial.print("Enter a mobile number: ");
  char remoteNum[20];  // telephone number to send sms
  readSerial(remoteNum);
  Serial.println(remoteNum);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[]) {
  int i = 0;
  while (1) {
    while (Serial.available() > 0) {
      char inChar = Serial.read();
      if (inChar == '\n') {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if (inChar != '\r') {
        result[i] = inChar;
        i++;
      }
    }
  }
}


However, it says in the Serial that the message was sent, I never receive anything on my phone. What do I need to do to get this thing to work?

solidrhino5

Hi starski, I am having the same problem too. Hopefully someone who is knowledgeable about this board can provide some insight on why it doesn't work.

I have read that in order to get the signal to reach from the antenna to a cell tower it can draw upwards to 2 amps so it would be necessary to use a 3.3V LiPo battery with at least 2500mAh to satisfy that current demand.

However the tutorial does not mention this anywhere, not even in the "hardware required section" (granted it is mainly a tutorial around explaining the code)

The tutorial was last updated 3 years ago, so either it has worked for everyone until now or no one cares to  say anything about it. Maybe it is in need of an update?

Maybe we didn't register our sim cards and boards correctly? I thought as long as the board shows up on the device manager and you get an email confirming your SIM card is verified  everything would start singing kumbaya, but no.

Sorry I am not of much help but maybe my reply can help bring some more traffic into this topic. Post if you are able to figure things out please, as I will do the same.

starskii

I have since learned that the Arduino SIM can only connect with the Arduino IOT cloud and can't send text messages or transmit data outside of to the Arduino IOT cloud. A good alternative would be the Twilio SIM.

That being said I haven't gotten that information confirmed and it doesn't seem like there's enough documentation out there or enough people working with this board in this way to get solid information on the topic. I'm really hoping someone experienced with this kind of development eventually reaches out, but I've had no luck.

How about you?

solidrhino5

I looked up what you found in your previous post, it does seem like the board can only communicate with the Arduino IOT cloud. I also looked at Twilio and that does seem like a great alternative.

This is beside the point but I just assumed that tutorial that they put out supported their own SIM card's capabilities, I didn't know it was implied that tutorial only works with a third party SIM card that permits that kind of access.

However Arduino does say:

 "The Arduino SIM sends data only to the Arduino IoT Cloud. In this way, we provide you with a secure communication channel from device to dashboard. Once data reaches the Arduino IoT Cloud, it is possible to bridge it to other platforms and services via webhooks or the Arduino IoT API."

I feel like it would be very easily possible to take any signal from the board that goes to the Arduino IoT Cloud and use IFTTT (an applet like webhooks) to send a message to your cellular device. I haven't been able to figure this out yet but I feel like this is the way to go if you want to make it work with the stuff you currently have.

Go Up