Forum >Sending SMS from BLUNO
General

Sending SMS from BLUNO

userHead visualxl 2014-05-28 00:17:27 7584 Views19 Replies
I am using a BLUNO running version 1.8.

At the same time, I am also using a GSM shield.

The SMS is only sent if I bring up the Serial Monitor. Otherwise, if I connect the BLUNO to external power supply, no SMS will be sent. Why is that so?

Kindly assist.
Code: Select all
/*
* Send SMS to somewhere
* Author: Syahmul Aziz
* Written on 23/5/2014
* Reference: SendSMS by Arduino GSM
*/
// Include the GSM library
#include <GSM.h>
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess;
//GSM gsmAccess(true); //for debugging purposes
GSM_SMS sms;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
Serial.println("SMS SENDER BLUNO");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected) {
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else {
Serial.println("Not connected");
delay(1000);
}
}
//send message. I did not put it in a loop because I only want it to send once
sendSMS();
}
void loop() {
}
void sendSMS() {
// send the message
char remoteNum[20] = "98997412"; // telephone number to send sms
// sms text
char txtMsg[200] = "Sending from BLUNO sendSMS."; //sms content
// send the message
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("SMS sent");
}
After browsing through a couple of forum, I have to use this instead.
Code: Select all
GSM gsmAccess(true);
2014-06-05 23:29:44 Can you paste the errors here?
Maybe we can find out what causes the conflict.
I suppose if these 2 libraries are causing conflict, there should be a bug listed on Arduino bug list?

Perhaps you dont need to include them both. Just create a new:
Code: Select all
SoftwareSerial myotherSerial(10, 11); 
userHeadPic Jose
2014-06-05 23:29:44 Can you paste the errors here?
Maybe we can find out what causes the conflict.
I suppose if these 2 libraries are causing conflict, there should be a bug listed on Arduino bug list?

Perhaps you dont need to include them both. Just create a new:
Code: Select all
SoftwareSerial myotherSerial(10, 11); 
userHeadPic Jose
2014-05-30 23:21:28 Nope Jose. What I mean is that, if the indicator did not light up, I need to reset the board because the GSM is not able to initialise properly for some reason. Of course if you run the SendSMS sample, it will straight away work. No issue. :)
Code: Select all
#include <GSM.h>
#include <TinyGPS.h>
#include <SoftwareSerial.h>
You are gonnat get compilation errors if either GSM or SoftwareSerial is included.
userHeadPic visualxl
2014-05-30 23:21:28 Nope Jose. What I mean is that, if the indicator did not light up, I need to reset the board because the GSM is not able to initialise properly for some reason. Of course if you run the SendSMS sample, it will straight away work. No issue. :)
Code: Select all
#include <GSM.h>
#include <TinyGPS.h>
#include <SoftwareSerial.h>
You are gonnat get compilation errors if either GSM or SoftwareSerial is included.
userHeadPic visualxl
2014-05-30 22:52:39 With just the indicator you got it working? Fair enough, well, at least is working right?

What trouble are you referring? getting that to work means the arduino GSM library with bluno ?
userHeadPic Jose
2014-05-30 22:52:39 With just the indicator you got it working? Fair enough, well, at least is working right?

What trouble are you referring? getting that to work means the arduino GSM library with bluno ?
userHeadPic Jose
2014-05-30 22:20:02 Yes its working. Its just that you have to put an indicator at the point that you want to know whether the GSM has been initialised or not. In my case, I have a switch and LED.

Oh yeah, just so you know, we are not talking about the same GSM shield. I noticed that most posts in this forum were referring to the GSM/GPS shield.

I am using this GSM shield http://arduino.cc/en/Main/ArduinoGSMShield

And I am having trouble in getting that to work with the GPS module. They said, its a library issues. Any idea?
userHeadPic visualxl
2014-05-30 22:20:02 Yes its working. Its just that you have to put an indicator at the point that you want to know whether the GSM has been initialised or not. In my case, I have a switch and LED.

Oh yeah, just so you know, we are not talking about the same GSM shield. I noticed that most posts in this forum were referring to the GSM/GPS shield.

I am using this GSM shield http://arduino.cc/en/Main/ArduinoGSMShield

And I am having trouble in getting that to work with the GPS module. They said, its a library issues. Any idea?
userHeadPic visualxl
2014-05-30 21:43:00 i was wondering about that. They are different serial ports right? so baudrate from each port should not affect I guess...
Anyway, as far as i know. BLE baudrate can also be set remotely
ie. from the cellphone application.

So GSM is working with BLE on your tests?
userHeadPic Jose
2014-05-30 21:43:00 i was wondering about that. They are different serial ports right? so baudrate from each port should not affect I guess...
Anyway, as far as i know. BLE baudrate can also be set remotely
ie. from the cellphone application.

So GSM is working with BLE on your tests?
userHeadPic Jose
2014-05-30 16:45:00 In the end, I did not have to change the baud rate of the BLUNO.

1. Set baud rate once at 115200 since this is needed to for the BLE to operate.
2. GSM shield uses a baud rate of 9600 internally, so we don't have to worry about that.
3. Created an "initialised()" function that light up a green LED. I call "initialised()" after setting up the GSM so that I know that GSM has been setup successfully.
4. If the LED did not light up after 40 seconds, I RESET the board.

And that's it.
userHeadPic visualxl
2014-05-30 16:45:00 In the end, I did not have to change the baud rate of the BLUNO.

1. Set baud rate once at 115200 since this is needed to for the BLE to operate.
2. GSM shield uses a baud rate of 9600 internally, so we don't have to worry about that.
3. Created an "initialised()" function that light up a green LED. I call "initialised()" after setting up the GSM so that I know that GSM has been setup successfully.
4. If the LED did not light up after 40 seconds, I RESET the board.

And that's it.
userHeadPic visualxl
2014-05-29 03:07:30 How do I change the baud rate to make the GSM and RSSI on PERIPHERAL work? userHeadPic visualxl
2014-05-29 03:07:30 How do I change the baud rate to make the GSM and RSSI on PERIPHERAL work? userHeadPic visualxl
2014-05-29 01:43:06 From what I read,

GSM shield from arduino uses UART. However, it utilises pin 2 and 3 of the Arduino using SoftwareSerial internally. So, you don't have like to configure the SoftwareSerial manually. It has already been configured. Its just a plug and play shield.

You might be right on the GSM network connectivity thing. I have not try the delay after initialising the board though because the delay simply means that the arduino do nothing right? But there are a couple of interesting things that I noticed with this shield.

1. It won't work if the baud rate of the Serial is not 9600.
2. I attached an LED to indicate whether the GSM has been initialised or not. Sometimes, it just does not got initialised which I do not know why. So, in this case, if it does not get initialised, I simply RESET the board like 1 - 2 times in average before it works.
3. Because the GSM only works on baud rate of 9600, there is no way that you can get the RSSI (other than Serial Monitor). I am referring to storing the RSSI to a variable. You can't do that because the Serial will always be empty.

So yeah, right now, I am trying to figure out how do I make the GSM works while at the same time getting the RSSI.


Baud Rate Stats for retrieving the RSSI on PERIPHERAL:
1. CENRAL: 115200
    PERIPHERAL: 115200 ->This combination works

2  CENTRAL: 9600
    PERIPHERAL: 115200 -> This combination works

3. CENTRAL: 9600
    PERIPHERAL: 9600 -> This combination do not work

4. CENTRAL: 115200
    PERIPHERAL: 9600 -> This combination do not work
userHeadPic visualxl
2014-05-29 01:43:06 From what I read,

GSM shield from arduino uses UART. However, it utilises pin 2 and 3 of the Arduino using SoftwareSerial internally. So, you don't have like to configure the SoftwareSerial manually. It has already been configured. Its just a plug and play shield.

You might be right on the GSM network connectivity thing. I have not try the delay after initialising the board though because the delay simply means that the arduino do nothing right? But there are a couple of interesting things that I noticed with this shield.

1. It won't work if the baud rate of the Serial is not 9600.
2. I attached an LED to indicate whether the GSM has been initialised or not. Sometimes, it just does not got initialised which I do not know why. So, in this case, if it does not get initialised, I simply RESET the board like 1 - 2 times in average before it works.
3. Because the GSM only works on baud rate of 9600, there is no way that you can get the RSSI (other than Serial Monitor). I am referring to storing the RSSI to a variable. You can't do that because the Serial will always be empty.

So yeah, right now, I am trying to figure out how do I make the GSM works while at the same time getting the RSSI.


Baud Rate Stats for retrieving the RSSI on PERIPHERAL:
1. CENRAL: 115200
    PERIPHERAL: 115200 ->This combination works

2  CENTRAL: 9600
    PERIPHERAL: 115200 -> This combination works

3. CENTRAL: 9600
    PERIPHERAL: 9600 -> This combination do not work

4. CENTRAL: 115200
    PERIPHERAL: 9600 -> This combination do not work
userHeadPic visualxl
2014-05-28 22:16:48 I'm thinking if the GSM and Bluno are serial compatible? Does the GSM has a configuration switch on board?
is it using SPI  or UART?


Do you need a delay after the board has being initilized? Maybe the GSM network has to be initilized and wait until the network has full contectivity?

Can you put some Serial.print lines to debug and check out where is getting stuck?
is the send SMS function started? or is stuck before that?
userHeadPic Jose
2014-05-28 22:16:48 I'm thinking if the GSM and Bluno are serial compatible? Does the GSM has a configuration switch on board?
is it using SPI  or UART?


Do you need a delay after the board has being initilized? Maybe the GSM network has to be initilized and wait until the network has full contectivity?

Can you put some Serial.print lines to debug and check out where is getting stuck?
is the send SMS function started? or is stuck before that?
userHeadPic Jose
2014-05-28 00:17:27 I am using a BLUNO running version 1.8.

At the same time, I am also using a GSM shield.

The SMS is only sent if I bring up the Serial Monitor. Otherwise, if I connect the BLUNO to external power supply, no SMS will be sent. Why is that so?

Kindly assist.
Code: Select all
/*
* Send SMS to somewhere
* Author: Syahmul Aziz
* Written on 23/5/2014
* Reference: SendSMS by Arduino GSM
*/
// Include the GSM library
#include <GSM.h>
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess;
//GSM gsmAccess(true);  //for debugging purposes
GSM_SMS sms;
void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println("SMS SENDER BLUNO");
  // connection state
  boolean notConnected = true;
  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected) {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else {
      Serial.println("Not connected");
      delay(1000);
    }
  }
  //send message. I did not put it in a loop because I only want it to send once
  sendSMS();
}
void loop() {
}
void sendSMS() {
  // send the message
  char remoteNum[20] = "98997412"// tele** to send sms
  // sms text
  char txtMsg[200] = "Sending from BLUNO sendSMS."; //sms content
  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("SMS sent");
}
After browsing through a couple of forum, I have to use this instead.
Code: Select all
GSM gsmAccess(true);
userHeadPic visualxl