hi guys,
i've started working on a project a few days ago, involving my Arduino uno with a GPRS shield v2.0 and and a relay module.
what i've been trying to do is send a text from my phone via sms to the GPRS shield with the hopes of it turning on the relay with a certain command. this relay would then come on and the wires in the relay lead to my truck remote starter, the relay is on a 5 second delay and this would start my truck. the Arduino would be left in my truck, now during the winter i would be able to start my truck from anywhere.
i found this code on youtube and have been testing it for the past couple days but i've had no luck.
this is the youtube link to the project i've been following: Tutorial: Start your car with a text message - YouTube
i've tried everything i could think of and cant find the problem.
i made sure i had all the right libraries, i've also tried with the original libraries and not the ones attached with the youtube link.
i have a sim card with 2g(gsm) capability, the green service indicator light only flashes every 3 seconds
i've made sure all of the wires are in right order more then once
i've made sure that the relay module works, by testing it alone with the Arduino board and a simple sketch
but every time i send the command nothing happens, i've also look on my carriers website on my account and it says i received a text message. i tested to see if i would receive messages even when the Arduino was off and the text message would not come up on the carriers site
the code does compile but i do get warnings, I've done lots of research on the warning but i don't really understand them. i only started playing around with the Arduino uno a couple months ago.
if anyone could help that would be amazing and much appreciate. If anyone also knows of a simpler or different sketch that i could use for a Arduino uno with GPRS Shield v2.0 that would be good too.
Thank you!
this is the code
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Suli.h>
#define PIN_TX 7
#define PIN_RX 8
#define BAUDRATE 9600
#define PHONE_NUMBER "+1xxxxxxxxxxx" //Add your cell phone number
#define START_COMMAND "Start" //Command you'd like to text
#define MESSAGE_SUCCESS "Vehicle is running."
#define MESSAGE_FAILED "Vehicle failed to start."
#define MESSAGE_DENIED "Access Denied."
#define MESSAGE_UNKNOWN "Uknown Command."
#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;
bool VEHICLE_RUNNING = false;
char phone[16];
char datetime[24];
const int relayPin = 12;
const int sensorPinOut = 11;
const int sensorPinIn = 10;
int relayState = LOW;
GPRS gprs(PIN_TX, PIN_RX, BAUDRATE); //RX,TX,PWR,BaudRate
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
while (0 != gprs.init()) {
powerSimOnOff();
Serial.print("Init Error.\r\n");
}
delay(5000);
powerSimOnOff();
Serial.println("Init Success, ready.");
pinMode(relayPin, OUTPUT);
pinMode(sensorPinOut, OUTPUT);
pinMode(sensorPinIn, INPUT);
digitalWrite(sensorPinOut, HIGH);
}
void powerSimOnOff() {
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
}
void loop() {
Serial.print("\r\nREADING SIM... ");
messageIndex = gprs.isSMSunread();
if (messageIndex > 0) { //At least, there is one UNREAD SMS
gprs.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);
gprs.deleteSMS(messageIndex);
Serial.print("\r\nFrom number: ");
Serial.println(phone);
Serial.print("Datetime: ");
Serial.println(datetime);
Serial.print("Recieved Message: ");
Serial.println(message);
if (strcmp(phone, PHONE_NUMBER)==0) {
if (strcmp(message, START_COMMAND)==0) {
//If the phone # and command are correct, start car.
Serial.print("STARTING VEHICLE.\r\n");
relayState = HIGH;
digitalWrite(relayPin, relayState);
delay(5000);
relayState = LOW;
digitalWrite(relayPin, relayState);
delay(10000);
} else {
//Phone number is correct, but unkown command was used.
Serial.print(MESSAGE_UNKNOWN);
gprs.sendSMS(PHONE_NUMBER, MESSAGE_UNKNOWN);
}
} else {
//Incorrect phone number.
Serial.print(MESSAGE_DENIED);
//gprs.sendSMS(PHONE_NUMBER, MESSAGE_DENIED);
}
//Determine if vehicle is running, uncomment to use.
//VEHICLE_RUNNING = (digitalRead(sensorPinIn) == HIGH);
VEHICLE_RUNNING = true;
if (VEHICLE_RUNNING) {
Serial.print(MESSAGE_SUCCESS);
gprs.sendSMS(PHONE_NUMBER, MESSAGE_SUCCESS);
} else {
Serial.print(MESSAGE_FAILED);
gprs.sendSMS(PHONE_NUMBER, MESSAGE_FAILED);
}
VEHICLE_RUNNING = false;
}
delay(2500);
digitalWrite(13, LOW);
delay(2500);
digitalWrite(13, HIGH);
}
these are the warnings
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino: In function 'void loop()':
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:112:51: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
gprs.sendSMS(PHONE_NUMBER, MESSAGE_UNKNOWN);
^
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:112:51: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:126:51: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
gprs.sendSMS(PHONE_NUMBER, MESSAGE_SUCCESS);
^
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:126:51: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:129:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
gprs.sendSMS(PHONE_NUMBER, MESSAGE_FAILED);
^
/Users/colebignucolo/Desktop/RemoteCarStart-master/RemoteCarStart/RemoteCarStart.ino:129:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Sketch uses 6648 bytes (20%) of program storage space. Maximum is 32256 bytes.
Global variables use 899 bytes (43%) of dynamic memory, leaving 1149 bytes for local variables. Maximum is 2048 bytes.