Positionsmeldung mit GPS und SMS (GPS/GSM SIM 808) - Teil 3

In first part of the blog series we had the Easter Bunnies hide the Easter eggs with GPS support. In the second part, the search then presented us with the challenge of first determining our current position and then calculating course and distance to the target. I hope that was fun for everyone involved.

Before the GPS receiver disappears in the drawer by next year, we will use it for a tracking system, because the SIM 808 can not only transmit the GPS position via its COM interface to the Micro Controller, but also send it as SMS via the integrated GSM system. In addition to the hardware used so far, we only need a Sim card, which can come from virtually any provider without password protection and with sufficient credit. If possible, take a card that matches your mobile contract, because SMS in the same network or from the same provider are free of charge or at least cheaper .

What do we need? As for the first two parts:

Number Component
1 Micro Controller, e.g. the Uno R3 compatible MC
1 LCD, e.g. the LCD-Keypad-Shield
1 GPS/GSM Module SIM 808 (this time with Sim card)
Rechargeable battery or battery


Essentially, the two sketches in this blog are based on the position determination from Part 1, supplemented by shares from the two example sketches SIM808_SendSMS and SIM808_SMSread, which were installed when the DFRobot library was built in.

There are different approaches for our tracker, which are suitable for different applications. As a first case, we consider the regular position reporting after a defined time interval has elapsed, otherwise the position could be changed by a certain distance, so our SIM 808 reports the position of the truck every hour or all 100 km.

In the second case, the position message should be event-oriented. This is possible firstly by using our microcontroller with the help of sensors e.g. for position and acceleration (accident?) or turn on/off the ignition of the vehicle. Or secondly, the position is to be sent on request, so we send from our smartphone an SMS to the SIM 808, and receive an answer within a few seconds (assuming each has connection).

For the first case, we supplement the position sketch with shares of the example sketch SIM808 to SendSMS. The shares of software serial and the initialization of SIM808 are already present in our position sketch. Let's focus on the fat printed lines:


#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
//Mobile phone number,need to change
#define PHONE_NUMBER "187*******39"
//The content of messages sent
#define MESSAGE "hello,world"
//#define PIN_TX 10
//#define PIN_RX 11
//SoftwareSerial mySerial(PIN_TX,PIN_RX);
//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
DFRobot_SIM808 sim808(&Serial);

void setup() {
  //mySerial.begin(9600);
  Serial.begin(9600);
  //******** Initialize sim808 module *************
  while(!sim808.init()) {
    delay(1000);
    Serial.print("Sim808 init error\r\n");
  }
  Serial.println("Sim808 init success");
  Serial.println("Start to send message ...");

  //******** define phone number and text **********
  sim808.sendSMS(PHONE_NUMBER,MESSAGE);
}

void loop() {
  //nothing to do
}

 

So we need to enter  the phone number PHONE_NUMBER of our smartphone to which the message is to be sent, then define MESSAGE (see also 2. Sketch) and copy the line with the method sim808.sendSMS to our sketch. The previousSMS and SMS interval variables control the time interval for regular SMS position messages.

Download Sketch:


/*****************************************************************************
GPS with LCD display
Based on DFRobot library sim808 and example SIM808 and GetGPS from Jason. [Laughs] dfrobot.com
Suitable for UN, nano and compatible MCUs and LCD1602 keypad Shield
Offset for MEZ = 1 hour, if applicable. customize for MESZ --> Offset=2
The time and day are adjusted shortly after midnight, but not month and year.

Connections:
Connecting TX of GPS to A3 = GPIO 17 of LCD keypad
Connect the GPS RX with A4 = GPIO 18 of the LCD keypad

The surroundings of the texts were replaced by the escape sequences.
lcd.print ("\xE1"); // issues an e
lcd.print ("\xEF"); // issues an island
lcd.print ("\xF5"); // issues a U
lcd.print ("\xE2"); // issues a t
lcd.print ("\xDF"); // issues a
lcd.print ("\x22"); // issues a "\x22");
lcd.print ("\xE4"); // issues an M
lcd.print ("\xF4"); // issues an O
*****************************************************************************/
'35; include
'35; include
';define PIN TX 17
';define PIN RX 18

//Mobile phone number, need to change
'35; define PHONE'u NUMBER "0049 yourPhoneNumber"
char MESSAGE[160] ="";

Software Serial mySerial(PIN TX,PIN RX);
SIM808 sim808(&mySerial); //Connect RX,TX,PWR
//DFRobot SIM808 sim808(&Serial);

// LCD has in I2C adapter, data transfer with Pins D4 to D7
'35; include
//LCD pin to Arduino
//const int pin BL = 15;
const int pin EN = 9;
const int pin RS = 8;
const int pin D4 = 4;
const int pin D5 = 5;
const int pin D6 = 6;
const int pin D7 = 7;

LiquidCrystal lcd(pin RS, pin EN, pin D4, pin D5, pin D6, pin D7);

// Offset for Time, here UTC to MEZ / MESZ
// Summertime MESZ: 2, Wintertime MEZ: 1
\35; define Offset 1

// intermittent time control
unsigned long previousMillis = 0;
const long interval = 1000;
unsigned long previousSMS = 0;
const long SMS interval = 300000;

// Buttons
int buttonInput =-1;
int buttonSelect = 0;

int YEAR = 2021;
int MONTH = 0;
int DAY = 0;
int DAYLCL = 0;
int HOUR = 0;
int HOURLCL = 0;
int MINUTE = 0;
int SECOND = 0;
float LAT = 0.0;
int LATDD = 0;
float LATMMmmmm = 0.0;
int LATMM = 0;
int LATDDWP = 0;
float LATMMmmWP = 0.0;
float LATSSs = 0.0;
float LON = 0.0;
int LONDDD = 0;
float LONMMmmmm = 0.0;
int LONMM = 0;
int LONDDWP = 0;
float LONMMmmWP = 0.0;
float LONSSs = 0.0;

void setup()
mySerial. (9600);
Serial. (9600);
Icd. (16,2); // initialize the lcd
Clear. ();
Icd.setCursor (0,0); //Count starts at zero, first sign, then line
lcd.print (AZ- Delivery.com ");
Icd.setCursor (0,1); // 0=First character, 1=second line

/******** Initialize sim808 module ***********
while(! sim808.init(){
delay(1000);
Serial. ("Sim808 init error\r\n");
  }

Turn on the GPS power******
if(sim808.attachGPS())
Serial. ("Open the GPS power success");
ed
Serial. ("Open the GPS power failure");
}

void loop()
buttonInput = Button();
switch (buttonInput)
case 0: Serial. ("0");buttonSelect=0; break;
case 1: Serial. ("1");buttonSelect=1; break;
case 2: Serial. ("2");buttonSelect=2; break;
case 3: Serial. ("3");buttonSelect=3; break;
Case 4: Serial. ("4");buttonSelect=4; break;
default: break;
  }



if (millis() -previousMillis >= interval) {
Get GPS data
if (sim808.getGPS(){
YEAR = 2021;
    MONTH = sim808. GPS What?
    DAY = sim808. GPSdata. What?
    DAYLCL = DAY;
    HOUR = sim808. GPSdata.hour What?
    HOURLCL = HOUR + Offset;
    MINUTE = sim808. GPSdata. What?
    SECOND = sim808. GPSdata What?
    if (HOURLCL>24) {
      HOURLCL = HOURLCL-24;
      DAYLCL = DAYLCL + 1;}
    Serial. (sim808. GPS );
    Serial. ("/")
    Serial. (MONTH)
    Serial. ("/")
    Serial. (DAY);
    Serial. ("")
    Serial. (HOUR)
    Serial. (":);
    Serial. (MINUTES)
    Serial. (":);
    Serial. (SECOND)
    LAT = sim808. GPSdata.lat What?
    LATDD = int(LAT);
    LATMMmmmm = (LAT -LATDD)*100;
    LATMM = int(LATMMmmmm);
    LATSSs = (LATMMmmmm -LATMM)*60;
    LON = sim808. GPSdata.lon What?
    LONDDD = int(LON);
    LONMMmmmm = (LON -LONDDD)*100;
    LONMM = int(LONMMmmmm);
    LONSSs = (LONMMmmmm -LONMM)*60;
    Serial. ("latitude:")
    Serial. (LATDD)
    Serial. (b)
    Serial. (LATMMmmmm,4);
    Serial. ("'N');
    Serial. ("longitude:")
    if (LON<100.0) Serial. ("0");
    if (LON<10.0) Serial. ("0");
    Serial. (LONDDD)
    Serial. (b)
    Serial. (LONMMmmmm,4);
    Serial. ("'E');
    //The content of messages sent
    sprintf(MESSAGE, "SIM 808%02d.%02d.%4d,%02d:%02d,%02d.%02d.%02d.%02d E",DAY,MONTH,YEAR,HOUR,MINUTE,LATDD,LATMM,int(LATSSs),LONDDD,LONMM,int(LATSSs));

    /******** define phone number and text ********

    if (millis()-previousSMS>SMS interval) {
      Serial. ("uncomment for SMS");
      // sim808.sendSMS(PHONE NUMBER,MESSAGE);
      previousSMS = millis();
    }
    Other {
      Serial. (MESSAGE)
    }

    if (buttonSelect==0) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print (LATDD)
      lcd.print ("\xDF");
      int LATMM = int(LATMMmmmm);
      float LATSSs = (LATMMmmmm-LATMM)*60;
      lcd.print (LATMM)
      lcd.print ("');
      lcd.print (LATSSs,1);
      lcd.print ("\x22\\ N");
      Icd.setCursor (0,1);
      if (LON<100.0) lcd.print ("0");
      if (LON<10.0) lcd.print ("0");
      lcd.print (LONDDD)
      lcd.print ("\xDF");
      int LONMM = int(LONMMmmmm);
      float LONSSs = (LONMMmmmm-LONMM)*60;
      if (LONMM<10) lcd.print ("0");
      lcd.print (LONMM)
      lcd.print ("');
      if (LONSSs<10.0) lcd.print ("0");
      lcd.print (LONSSs,1);
      lcd.print ("\x22\ E");

    else if (buttonSelect==1) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print ("EUR:")
      if (DAYLCL<10) lcd.print ("0");
      lcd.print (DAYLCL)
      lcd.print (");
      if (MONTH<10) lcd.print ("0");
      lcd.print (MONTH)
      lcd.print (");
      lcd.print (sim808. GPS );
      Icd.setCursor (5,1);
      if (HOURLCL<10) lcd.print ("0");
      lcd.print (HOURLCL)
      lcd.print (":);
      if (MINUTE<10) lcd.print ("0");
      lcd.print (MINUTES)
      lcd.print (":);
      if (SECOND<10) lcd.print ("0");
      lcd.print (SECOND)
    }
    else if (buttonSelect==2) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print ("UTC:")
      lcd.print (sim808. GPS );
      lcd.print ("/")
      if (MONTH<10) lcd.print ("0");
      lcd.print (MONTH)
      lcd.print ("/")
      if (DAY<10) lcd.print ("0");
      lcd.print (DAY);
      Icd.setCursor (5,1);
      if (HOUR<10) lcd.print ("0");
      lcd.print (HOUR)
      lcd.print (":);
      if (MINUTE<10) lcd.print ("0");
      lcd.print (MINUTES)
      lcd.print (":);
      if (SECOND<10) lcd.print ("0");
      lcd.print (SECOND)
    }
else if (buttonSelect==3) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print (LATDD)
      lcd.print ("\xDF");
      lcd.print (LATMMmmmm,4);
      lcd.print ("'N');
      Icd.setCursor (0,1);
      if (LON<100.0) lcd.print ("0");
      if (LON<10.0) lcd.print ("0");
      lcd.print (LONDDD)
      lcd.print ("\xDF");
      if (LONMMmmmm<10.0) lcd.print ("0");
      lcd.print (LONMMmmmm,4);
      lcd.print (E); (E)
      else if (buttonSelect==4) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print (AZ- Delivery.com ");}
      //
      Turn off the GPS power
      // sim808.detachGPS();
      previousMillis = millis();
    }
  }
}

int Button()
int A0
// all buttons are connected to A0 via voltage divider
// Values of ADC are between 0 and 1023
If necessary, values must be changed slightly
A0 = analogRead(0); //
if (A0 <60) {
return 0;
  }
else if (A0 >= 60 &&A0 <250) {
return 1;
  }
else if (A0 >= 250 &&A0 <450){
return 2;
  }
else if (A0 >= 450 &&A0 <700){
return 3;
  }
else if (A0 >= 700 &&A0 <900){
return 4;
  }
Other {
return -1;
  }
} //end Button()

In the second case, we have to put the SIM 808 into reception mode. To do this, we use the bold-printed parts of the SIM808/SMSread example sketch:

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;
char phone[16];
char datetime[24];
//#define PIN_TX 10
//#define PIN_RX 11
//SoftwareSerial mySerial(PIN_TX,PIN_RX);
//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
DFRobot_SIM808 sim808(&Serial);

void setup() {
  //mySerial.begin(9600);
  Serial.begin(9600);
  //******** Initialize sim808 module *************
  while(!sim808.init()) {
    Serial.print("Sim808 init error\r\n");
    delay(1000);
  }
  delay(3000);
  Serial.println("Init Success, please send SMS message to me!");
}

void loop() {
  //*********** Detecting unread SMS ************************
  messageIndex = sim808.isSMSunread();
  Serial.print("messageIndex: ");
  Serial.println(messageIndex);

  //*********** At least, there is one UNREAD SMS ***********
  if (messageIndex > 0) {
    sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);

    //******In order not to full SIM Memory, is better to delete it*******
    sim808.deleteSMS(messageIndex);
    Serial.print("From number: ");
    Serial.println(phone);
    Serial.print("Datetime: ");
    Serial.println(datetime);
    Serial.print("Recieved Message: ");
    Serial.println(message);
  }
}

Unlike in the first sketch, we do not send the position message to a predefined number, but to the telephone number Phone of which a SMSmessage was received as trigger.

Little disappointment: Of course I tried to send a four-digit code and check for correctness before the reply SMS, but as noted in the first post of the series, the library is very time-critical and the additional if query has resulted in the transmission of the GPS position being interrupted. Maybe you can make it?

The longest I needed for line 163: composing the MESSAGE message:

sprintf(MESSAGE, "SIM 808%02d.%02d.%4d,%02d:%02d,%02d.%02d.%02d.%02d E",DAY,MONTH,YEAR,HOUR,MINUTE,LATDD,LATMM,int(LATSSs),LONDDD,LONMM,int(LATSSs));

Download Sketch:

 /****************************************************************************
GPS with LCD display
Based on DFRobot library sim808 and example SIM808 and GetGPS from Jason. [Laughs] dfrobot.com
Suitable for UN, nano and compatible MCUs and LCD1602 keypad Shield
Offset for MEZ = 1 hour, if applicable. customize for MESZ --> Offset=2
The time and day are adjusted shortly after midnight, but not month and year.

Connections:
Connecting TX of GPS to A3 = GPIO 17 of LCD keypad
Connect the GPS RX with A4 = GPIO 18 of the LCD keypad

The surroundings of the texts were replaced by the escape sequences.
lcd.print ("\xE1"); // issues an e
lcd.print ("\xEF"); // issues an island
lcd.print ("\xF5"); // issues a U
lcd.print ("\xE2"); // issues a t
lcd.print ("\xDF"); // issues a
lcd.print ("\x22"); // issues a "\x22");
lcd.print ("\xE4"); // issues an M
lcd.print ("\xF4"); // issues an O
*****************************************************************************/
'35; include
'35; include
';define PIN TX 17
';define PIN RX 18

"35; define MESSAGE LENGTH 160
char message[MESSAGE LENGTH]; // incoming message
char MESSAGE[MESSAGE U LENGTH] ="; // outgoing message
int messageIndex = 0;

char phone[16];
char datetime[24];

Software Serial mySerial(PIN TX,PIN RX);
SIM808 sim808(&mySerial); //Connect RX,TX,PWR
//DFRobot SIM808 sim808(&Serial);

// LCD has in I2C adapter, data transfer with Pins D4 to D7
'35; include
//LCD pin to Arduino
//const int pin BL = 15;
const int pin EN = 9;
const int pin RS = 8;
const int pin D4 = 4;
const int pin D5 = 5;
const int pin D6 = 6;
const int pin D7 = 7;

LiquidCrystal lcd(pin RS, pin EN, pin D4, pin D5, pin D6, pin D7);

// Offset for Time, here UTC to MEZ / MESZ
// Summertime MESZ: 2, Wintertime MEZ: 1
\35; define Offset 1

// intermittent time control
unsigned long previousMillis = 0;
const long interval = 1000;
unsigned long previousSMS = 0;
const long SMS interval = 300000;

// Buttons
int buttonInput =-1;
int buttonSelect = 0;

int YEAR = 2021;
int MONTH = 0;
int DAY = 0;
int DAYLCL = 0;
int HOUR = 0;
int HOURLCL = 0;
int MINUTE = 0;
int SECOND = 0;
float LAT = 0.0;
int LATDD = 0;
float LATMMmmmm = 0.0;
int LATMM = 0;
int LATDDWP = 0;
float LATMMmmWP = 0.0;
float LATSSs = 0.0;
float LON = 0.0;
int LONDDD = 0;
float LONMMmmmm = 0.0;
int LONMM = 0;
int LONDDWP = 0;
float LONMMmmWP = 0.0;
float LONSSs = 0.0;



void setup()
mySerial. (9600);
Serial. (9600);
Icd. (16,2); // initialize the lcd
Clear. ();
Icd.setCursor (0,0); //Count starts at zero, first sign, then line
lcd.print (AZ- Delivery.com ");
Icd.setCursor (0,1); // 0=First character, 1=second line

/******** Initialize sim808 module ***********
while(! sim808.init(){
delay(1000);
Serial. ("Sim808 init error\r\n");
  }

Turn on the GPS power******
if(sim808.attachGPS())
Serial. ("Open the GPS power success");
ed
Serial. ("Open the GPS power failure");
} //end setup()

void loop()
buttonInput = Button();
switch (buttonInput)
case 0: Serial. ("0");buttonSelect=0; break;
case 1: Serial. ("1");buttonSelect=1; break;
case 2: Serial. ("2");buttonSelect=2; break;
case 3: Serial. ("3");buttonSelect=3; break;
Case 4: Serial. ("4");buttonSelect=4; break;
default: break;
  }

if (millis() -previousMillis >= interval) {
Get GPS data
if (sim808.getGPS(){
YEAR = 2021;
    MONTH = sim808. GPS What?
    DAY = sim808. GPSdata. What?
    DAYLCL = DAY;
    HOUR = sim808. GPSdata.hour What?
    HOURLCL = HOUR + Offset;
    MINUTE = sim808. GPSdata. What?
    SECOND = sim808. GPSdata What?
    if (HOURLCL>24) {
      HOURLCL = HOURLCL-24;
      DAYLCL = DAYLCL + 1;}
    Serial. (sim808. GPS );
    Serial. ("/")
    Serial. (MONTH)
    Serial. ("/")
    Serial. (DAY);
    Serial. ("")
    Serial. (HOUR)
    Serial. (":);
    Serial. (MINUTES)
    Serial. (":);
    Serial. (SECOND)
    LAT = sim808. GPSdata.lat What?
    LATDD = int(LAT);
    LATMMmmmm = (LAT -LATDD)*100;
    LATMM = int(LATMMmmmm);
    LATSSs = (LATMMmmmm -LATMM)*60;
    LON = sim808. GPSdata.lon What?
    LONDDD = int(LON);
    LONMMmmmm = (LON -LONDDD)*100;
    LONMM = int(LONMMmmmm);
    LONSSs = (LONMMmmmm -LONMM)*60;
    Serial. ("latitude:")
    Serial. (LATDD)
    Serial. (b)
    Serial. (LATMMmmmm,4);
    Serial. ("'N');
    Serial. ("longitude:")
    if (LON<100.0) Serial. ("0");
    if (LON<10.0) Serial. ("0");
    Serial. (LONDDD)
    Serial. (b)
    Serial. (LONMMmmmm,4);
    Serial. ("'E');
    //The content of messages sent
    sprintf(MESSAGE, "SIM 808%02d.%02d.%4d,%02d:%02d,%02d.%02d.%02d.%02d E",DAY,MONTH,YEAR,HOUR,MINUTE,LATDD,LATMM,int(LATSSs),LONDDD,LONMM,int(LATSSs));

    /******** define phone number and text ********
    Detecting unread SMS
    messageIndex = sim808.isSMSunread();
    Serial. ("MessageIndex:")
    Serial. (messageIndex);

    At least, there is one UNREAD SMS
    if (messageIndex > 0) {
    sim808.readSMS(messageIndex, message, MESSAGE LENGTH, phone, datetime);

    In order not to full SIM Memory, is better to delete it
    sim808.deleteSMS(messageIndex);
    Serial. ("From number:")
    Serial. (phone);
    Serial. ("Datetime:")
    Serial. (date-time);
    Serial. ("Received Message:")
    Serial. (message)

    sim808.sendSMS(phone,MESSAGE);
  }

if (buttonSelect==0) {
Clear. ();
      Icd.setCursor (0,0);
      lcd.print (LATDD)
      lcd.print ("\xDF");
      int LATMM = int(LATMMmmmm);
      float LATSSs = (LATMMmmmm-LATMM)*60;
      lcd.print (LATMM)
      lcd.print ("');
      lcd.print (LATSSs,1);
      lcd.print ("\x22\\ N");
      Icd.setCursor (0,1);
      if (LON<100.0) lcd.print ("0");
      if (LON<10.0) lcd.print ("0");
      lcd.print (LONDDD)
      lcd.print ("\xDF");
      int LONMM = int(LONMMmmmm);
      float LONSSs = (LONMMmmmm-LONMM)*60;
      if (LONMM<10) lcd.print ("0");
      lcd.print (LONMM)
      lcd.print ("');
      if (LONSSs<10.0) lcd.print ("0");
      lcd.print (LONSSs,1);
      lcd.print ("\x22\ E");

    else if (buttonSelect==1) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print ("EUR:")
      if (DAYLCL<10) lcd.print ("0");
      lcd.print (DAYLCL)
      lcd.print (");
      if (MONTH<10) lcd.print ("0");
      lcd.print (MONTH)
      lcd.print (");
      lcd.print (sim808. GPS );
      Icd.setCursor (5,1);
      if (HOURLCL<10) lcd.print ("0");
      lcd.print (HOURLCL)
      lcd.print (":);
      if (MINUTE<10) lcd.print ("0");
      lcd.print (MINUTES)
      lcd.print (":);
      if (SECOND<10) lcd.print ("0");
      lcd.print (SECOND)
    }
    else if (buttonSelect==2) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print ("UTC:")
      lcd.print (sim808. GPS );
      lcd.print ("/")
      if (MONTH<10) lcd.print ("0");
      lcd.print (MONTH)
      lcd.print ("/")
      if (DAY<10) lcd.print ("0");
      lcd.print (DAY);
      Icd.setCursor (5,1);
      if (HOUR<10) lcd.print ("0");
      lcd.print (HOUR)
      lcd.print (":);
      if (MINUTE<10) lcd.print ("0");
      lcd.print (MINUTES)
      lcd.print (":);
      if (SECOND<10) lcd.print ("0");
      lcd.print (SECOND)
    }
    else if (buttonSelect==3) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print (LATDD)
      lcd.print ("\xDF");
      lcd.print (LATMMmmmm,4);
      lcd.print ("'N');
      Icd.setCursor (0,1);
      if (LON<100.0) lcd.print ("0");
      if (LON<10.0) lcd.print ("0");
      lcd.print (LONDDD)
      lcd.print ("\xDF");
      if (LONMMmmmm<10.0) lcd.print ("0");
      lcd.print (LONMMmmmm,4);
      lcd.print (E); (E)
    else if (buttonSelect==4) {
      Clear. ();
      Icd.setCursor (0,0);
      lcd.print (AZ- Delivery.com ");}
  //
Turn off the GPS power
// sim808.detachGPS();
previousMillis = millis();
    }
  }
} // end loop()

int Button()
int A0
// all buttons are connected to A0 via voltage divider
// Values of ADC are between 0 and 1023
If necessary, values must be changed slightly
A0 = analogRead(0); //
if (A0 <60) {
return 0;
  }
else if (A0 >= 60 &&A0 <250) {
return 1;
  }
else if (A0 >= 250 &&A0 <450){
return 2;
  }
else if (A0 >= 450 &&A0 <700){
return 3;
  }
else if (A0 >= 700 &&A0 <900){
return 4;
  }
Other {
return -1;
  }
} //end Button()

We will continue to try to correct the errors, the missing course and distance functions and the weaknesses in the position query at the DFRobot library. The result remains to be seen.

In the meantime, I wish you a lot of fun with this great GPS/GSM module and good luck adapting to your personal needs.

AmateurfunkFor arduinoProjects for advanced

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN