connecting a MKR GSM 1400 to a uno issues

Hi,

I’ve been trying to follow several tutorials and various rebuilds have left me struggling to work out why I can’t get the uno to send an sms via the GSM 1400. I have pulled apart what I think is the problem with my code and hopefully somebody can fill in the blanks.

I have a project where I am trying to link device measurements in the uno to a GSM1400. Presently I have pin 7 of the uno as a RX from the GSM TX and pin 8 (the TX) from the UNO through a CD4050 level shifter to the RX of the GSM1400.

I can get the GSM1400 to work fine using the MKRGSM.h libraries but struggle to make sense out of the SoftwareSerial libraries. I’ve now been bashing about for a couple of days trying to get this to work. I’ve stripped down the code to the following:

#include <SoftwareSerial.h>

//Uno RX pin 7 → TX pin 14 on GSM
//Uno TX pin 8 → RX pin 123 on GSM
SoftwareSerial mySerial(7, 8);

void setup() {
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); //open a serial port
delay(100);
}

void loop() {
//Send information to GSM
SendMessage();
Serial.print("Serial available: ");
Serial.println(Serial.available() );

if (Serial.available()>0) {

Serial.println(“Data in buffer”);
}

Serial.print(“My Serial available 1”);
Serial.println(mySerial.available() );
if (mySerial.available()>0) Serial.write(mySerial.read());
Serial.print(“My Serial available 2”);
Serial.println(mySerial.available() );
Serial.print(“My Serial read”);
Serial.println(mySerial.read());
delay(1000); //How often does this process want to happen
}

void SendMessage() {
Serial.println(“Send Message Routine”);

mySerial.print(“AT+CMGF=1”); //Sets the GSM Module in Text Mode
Serial.println(“Send Message Routine 1”);
delay(1000); // Delay of 1000 milli seconds or 1 second

mySerial.println(“AT+CMGS=”+44XXXXXXXXXX"\r"); // Replace X with recipient mobile number
Serial.println(“Send Message Routine 2”);
delay(1000);

mySerial.println(“I am SMS from GSM Module”);// The SMS text you want to send
Serial.println(“Send Message Routine 3”);
delay(100);

mySerial.println((char)26);// ASCII code of CTRL+Z

delay(1000);
}

This gives the following single cycle me the following when I’m monitoring:

Send Message Routine
Send Message Routine 1
Send Message Routine 2
Send Message Routine 3
Serial available: 0
My Serial available 10
My Serial available 20
My Serial read-1

I’m trying to find a way of diagnosing the issue but struggling to understand why My Serial Read is -1 from my reading about the AT commands.
I am not entirely sure why mySerial.available() changes either side of the Serial.write(mySerial.read()) command in the way it does either.

Anything useful would be greatly appreciated.
Nick

What do you call a GSM 1400? Is this an Arduino MKR GSM 1400?? (If so what is the code running on that MKR GSM 1400?)

Your loop makes no sense either, you try to read data from software serial not know!no if there is something there (will get you -1)

SoftwareSerial mySerial(7, 8);

You can't use the smiley face pin for SoftwareSerial.

J-M-L:
What do you call a GSM 1400? Is this an Arduino MKR GSM 1400?? (If so what is the code running on that MKR GSM 1400?)

Your loop makes no sense either, you try to read data from software serial not know!no if there is something there (will get you -1)

Yes, I did mean the Arduino MKR GSM 1400. I assumed (possibly wrongly) from all of the examples and the tutorials I have read, nobody has mentioned the code on the GSM controller. I was assuming the SoftwareSerial library communicated in a parent(UNO)-child(GSM) coding manner. If not, why do numerous examples use the AT modem commands at the UNO rather than at the GSM level?

The mySerial.read() comment is me trying to get some information back from the GSM I can use to find out where the program is going wrong. I would have assumed that somebody would have put some method in place to communicate where things are not working from the perspective of the GSM controller...but I can't find anything on the net. I agree its not working, which is why I am asking for help after reading rather a lot of information on the web over the past few days and very little of it seems to be useful if the system doesn't link perfectly the first time you put it all together. At present most of the information I have, is adapted from SIM900 examples. Most people who get into problems, don't often post how they actually solved the issues... the thread just dies.

SO:
-Am I supposed to have code on the Arduino MKR GSM 1400 to complete the serial communication when connected to the UNO?
-Is there some diagnostic methods I can use to test the serial connection? I am struggling to find a way to identify when/where the process/connection is not working and I am struggling to find this information?

the Arduino MKR GSM 1400 is a full Arduino, it's not a side modem you drive through Serial with AT commands. You can program its Atmel SAMD21 processor directly and leverage through the libraires the SARAU201 GSM module

you probably don't need the UNO at all.

J-M-L:
the Arduino MKR GSM 1400 is a full Arduino, it's not a side modem you drive through Serial with AT commands. You can program its Atmel SAMD21 processor directly and leverage through the libraires the SARAU201 GSM module

you probably don't need the UNO at all.

I was trying to link a project that I have completed on the UNO with GSM capability. I will look into converting the UNO code into the MKR GSM1400 instead. It seems this might be the easier approach.

NereisNick:
I was trying to link a project that I have completed on the UNO with GSM capability. I will look into converting the UNO code into the MKR GSM1400 instead. It seems this might be the easier approach.

probably !

if not and you want to do what you had in mind, you would need to develop code on the MKR GSM1400 to listen to the serial port, understand what’s being asked (like send an SMS with text “hello world” to number +1233333333 and then the MKR GSM1400 would do that