Board: standard Arduino Uno
GSM: Linksprite model
SIM: At&T prepaid Go Phone micro SIM
Hello!
We are trying to complete a project that involves sending a SMS message to a pre-programmed number on the condition that our Force Sensing Resistor / BME 280 Temp sensor sense the values that we have programmed. The current code that we have developed (see below) has been verified and uploaded successfully to our board several times. The FSR and BME are working, as well as the if/then statements that only run our "send SMS" subprogram if the FSR senses a force and the BME senses temperature above 30C.
Our SIM card was purchased through AT&T. We have activated it and put it in the GSM, but still have not been able to send any messages. We've tried calling it using the RecieveVoicemail example codes in the arduino GSM library, but the serial monitor did not show any evidence of a call. HOWEVER, our AT&T account history shows several of the calls that we sent to Arduino. It doesn't show any of the messages.
We have also tried using the other example codes for sending/recieving SMS found in the GSM library, but none have seemed to work.
If anyone has an idea of what we're doing wrong / what needs to be fixed, any help would be greatly appreciated!!! We're on a time crunch and the stress levels are sky high....
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <GSM.h>
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
#define PINNUMBER "xxxx" //Enter SIM pin number in place of xxxx
GSM gsmAccess;
GSM_SMS sms;
Adafruit_BME280 bme(BME_CS); // hardware SPI
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
unsigned long delayTime;
// char array of the telephone number to send SMS
// change the number 1-212-121-1212 to a number
// you have access to
char remoteNumber[20]= "1-212-121-1212";
// char array of the message
char txtMsg[200]="Test";
void setup() {
Serial.begin(9600);
Serial.println(F("BME280 test"));
Serial.println("SMS Messages Sender");
bool status;
// default settings for BME280
status = bme.begin();
if (!status) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
// GSM connection state
boolean notConnected = true;
}
//MAIN CODE LOOP
void loop() {
fsrReading = analogRead(fsrPin);
Serial.print("Analog reading = ");
Serial.print(fsrReading); // the raw analog reading
if (fsrReading >= 70)
{
printValues();
delay(delayTime);
if (bme.readTemperature() >= 30 ){ //if the Temperature is over 20 degrees Celsius
subroutineGSM(); //run the GSM code to send warning message.
delay(delayTime);
} else {
delay(delayTime);
delay(delayTime);
}
}
else
{
Serial.println("No force detected."); //Continue to loop until force is detected.
}
}
//DEFINE SUBPROGRAMS
void printValues() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" degrees C"); //Changed by Group IDK
Serial.println();
}
void subroutineGSM() {
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
// send the message
sms.beginSMS(remoteNumber);
Serial.println("Sending started");
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
THIS_IS_THE_ONE.ino (2.36 KB)