Im doing a little porject with the Arduino. Its a GPS/GPRS system that when a SMS its receive, it will retreive the GPS info and send it back to a predifine number via SMS.
Parts used:
GPS Shield
Libelium.com GPRS shield
IM STILL developing this...so the code its not finished...I need to figure how to verify when a SMS is receive.....Any help would be great,...
#include <AFSoftSerial.h>
/*
*GPS-GPRS Module para Arduino.
*Basado en el modulo GPS de ladyada.net y el modulo GPRS de Libelium.com
*Cuando se recibe un mensaje de texto(SMS), tomo las coordernadas del GPS y las envio via SMS.
*Hecho por Alexander Veloz, 2008, alexander.veloz@gmail.com
*/
//GPS Conf
#define GPSrxPin 3 // GPS rx Pin
#define GPStxPin 4 // GPS tx Pin
#define GPSpowerpin 5 // GPS Power Pin
#define GPSRATE 4800 // GPS Baud Rate
//GPRS Conf
#define GPRSpowerpin 2 // GPRS Power Pin
#define GPRSRATE 115200 // GPRS Baud Rate
//Opciones GPS
#define RMC_ON "$PSRF103,4,0,1,1*21\r\n" // RMC on (1 hz rate)
#define RMC_OFF "$PSRF103,4,0,0,1*20\r\n" // RMC off
#define GGA_ON "$PSRF103,0,0,1,1*25\r\n" // GGA on (1 hz rate)
#define GGA_OFF "$PSRF103,0,0,0,1*24\r\n" // GGA off
#define GSA_ON "$PSRF103,2,0,1,1*27\r\n" // GSA on (1 hz rate)
#define GSA_OFF "$PSRF103,2,0,0,1*26\r\n" // GSA off
#define GSV_ON "$PSRF103,3,0,1,1*26\r\n" // GSV on (1 hz rate)
#define GSV_OFF "$PSRF103,3,0,0,1*27\r\n" // GSV off
#define WAAS_ON "$PSRF151,1*3F\r\n" // WAAS on
#define WAAS_OFF "$PSRF151,0*3E\r\n" // WAAS off
void switchGPSModule(){
digitalWrite(GPSpowerpin,HIGH);
delay(2000);
digitalWrite(GPSpowerpin,LOW);
}
void switchGPRSModule(){
digitalWrite(GPRSpowerpin,HIGH);
delay(2000);
digitalWrite(GPRSpowerpin,LOW);
}
AFSoftSerial GPSserial = AFSoftSerial(GPSrxPin, GPStxPin); // Puerto serial virtual para el GPS
void setup()
{
if (GPSpowerpin, GPRSpowerpin) {
pinMode(GPSpowerpin, OUTPUT);
pinMode(GPRSpowerpin, OUTPUT);
}
GPSserial.begin(GPSRATE); // Inicio comunicacion para GPS
switchGPSModule(); // Enciendo modulo GPS
GPSserial.println("Configurando GPS..."); // Mensaje iniciando GPS
delay(1000);
GPSserial.println(GGA_ON); // GGA on
GPSserial.println(RMC_OFF); // RMC off
GPSserial.println(GSA_OFF); // GSA off
GPSserial.println(GSV_OFF); // GSV off
GPSserial.println(WAAS_OFF); // WAAS off
delay(1000);
Serial.begin(GPRSRATE); // Inicio comunicacion para GPRS
switchGPRSModule(); // Enciendo modulo GPRS
Serial.println("Configurando GPRS..."); // Mensaje iniciando GPRS
delay(1000);
Serial.println("AT+CMGF=1"); // SMS en modo texto
}
void loop()
{
//aqui va el codigo principal
}


