Introduction: Custom Location SMS Using Linkit One !!

Picture of Custom Location SMS Using Linkit One !!


In this instructable I will show you how to send SMS using linkit one not only text but link to location also.Code credit goes to ehsmaes and I had used this in my project VG too.

Step 1: Things We Need

Picture of Things We Need

We need :-

  • Linkit one
  • battery
  • gsm antenna
  • gps antenna
  • push button
  • male to male jumper wires
  • breadboard

Step 2: Push Button

Picture of Push Button

Just insert push button in breadboard and also two jumper wires in its pinout and also attach one to ground and the other via resistor or simply to digital pin no.2.

Step 3: Other Setup and Code

Picture of Other Setup and Code

Join the GPS and GPRS antenna to likit one and also insert the sim card in its slot .Insert battery if you want to make it portable.The code is :-



gpsSentenceInfoStruct info; char buff[256]; char url[120]; int fix=0;

const int noofDest = 2; const char *numbers[] = {"0123456789", "0123456789"}; // nos that will receive the sms everytime char incoming_num[21] = "0123456789"; // this no.will only receive sms when we send any sms to this no. char message[256];

int ButtonPin = 2;

static unsigned char getComma(unsigned char num,const char *str) { unsigned char i,j = 0; int len=strlen(str); for(i = 0;i < len;i ++) { if(str[i] == ',') j++; if(j == num) return i + 1; } return 0; }

static double getDoubleNumber(const char *s) { char buf[10]; unsigned char i; double rev; i=getComma(1, s); i = i - 1; strncpy(buf, s, i); buf[i] = 0; rev=atof(buf); return rev; }

static double getIntNumber(const char *s) { char buf[10]; unsigned char i; double rev; i=getComma(1, s); i = i - 1; strncpy(buf, s, i); buf[i] = 0; rev=atoi(buf); return rev; }

float toWGS84(float nmeaCoord) { float degWhole = float(int(nmeaCoord/100)); float degDec = (nmeaCoord - degWhole*100)/60; return degWhole + degDec; }

void parseGPGGA(const char* GPGGAstr) { /* Reference: */ double latitude; double longitude; int tmp, hour, minute, second, num; if(GPGGAstr[0] == '$') { //latitude tmp = getComma(2, GPGGAstr); latitude = getDoubleNumber(&GPGGAstr[tmp]); tmp = getComma(3, GPGGAstr); // N or S float latWGS84 = toWGS84(latitude); if('S' == GPGGAstr[tmp]) { latWGS84 = -latWGS84; // negate if southern hemisphere coordinate } //longitude tmp = getComma(4, GPGGAstr); longitude = getDoubleNumber(&GPGGAstr[tmp]); tmp = getComma(5, GPGGAstr); // E or W float lonWGS84 = toWGS84(longitude); if('W' == GPGGAstr[tmp]) { lonWGS84 = -lonWGS84; // negate if western coordinate } sprintf(url,",%f", latWGS84, lonWGS84);

// location fix tmp = getComma(6, GPGGAstr); fix = getIntNumber(&GPGGAstr[tmp]); } else { Serial.println("No GPS data"); } }

void send_sms(char* number, char* message) { LSMS.beginSMS(number); for(int i = 0; i < strlen(message); i++) { LSMS.write(message[i]); } LSMS.endSMS(); }

void setup() { pinMode(ButtonPin, INPUT_PULLUP); Serial.begin(115200); LGPS.powerOn(); Serial.println("LGPS Powering on, waiting ..."); delay(3000); }

void loop() { LGPS.getData(&info); Serial.print((char*)info.GPGGA); parseGPGGA((const char*)info.GPGGA);

if(digitalRead(ButtonPin) == LOW) { if(fix != 0) { sprintf(message, "Please help me!.Current location: %s", url); } else { sprintf(message, "Help me. Last location: %s", url); } Serial.println(message); for(int i=0; i < noofDest; i++) { char num[20]; sprintf(num, numbers[i]); send_sms(num, message); } delay(5000); } // Answer incoming SMS by returning position if(LSMS.available()) { LSMS.remoteNumber(incoming_num, 20); if(fix != 0) { sprintf(message, "Current location: %s", url); } else { sprintf(message, "Last location: %s", url); } Serial.println(message); send_sms(incoming_num, message); LSMS.flush(); } }

Step 4: Done!!

Picture of Done!!

In your sketch save the phone numbers and then upload it to your linkit one and also try it once.It is interesting project and you can change the sentence too.

Thank you!!


zaikami (author)2015-12-22

I want prove my friends that I went to Havaii(not really:) )

DIY Hacks and How Tos (author)2015-12-21

Great idea for a messaging system. You could use this to get automated updates for number of automated projects.

Nice idea bro!! You are awesome!! In my school exb. Your project laser tripwire alarm was made and honoured too in juniors category and also mentioned there your name.:-)

About This Instructable




Bio: Thank you instructables!!
More by Gursimran Singh 425:Plant BoxDIY CNC For 60$ (Large Work Area)Advanced Mosquito Repeller and Swatter
Add instructable to: