Connecting a GPS tracker to Arduino. Receiving and displaying GPS coordinates on Arduino

The GPS global positioning system has already become a part of our lives. Today it is difficult to imagine a mobile phone without a built-in GPS module. This satellite system navigation allows you to track any objects, determine their coordinates and speed of movement. Now GPS is available not only to companies developing relevant equipment, but also ordinary radio amateurs, which already use the popular Arduino boards to the fullest. IN this material we will consider connecting a miniature GPS tracker to the board Arduino Pro Mini. The PG03 MiniGPS tracker is used as a test subject.



This tracker, in addition to direct geographic coordinates, shows the direction of movement, the distance traveled and the speed of movement. Unfortunately, it does not record information, so by connecting it to the Arduino, you can access this data and do whatever you want with it.


First, the tracker needs to be disassembled. Below are images of a disassembled GPS tracker.




The heart of the tracker is the Venus638FLP GPS chip. Its 44th pin is the output of the UART interface (TxD). You can solder a wire directly to this pin, or you can find a testing pin on the board, to which it is also connected this conclusion. Below are images of the pin locations of the microcircuit and how to connect to the desired pin.





Now let's take a compact Arduino Pro Mini board and an SD card module to record NMEA protocol data. The connection diagram for the Arduino Pro Mini and the SD card module is as follows:



Connecting module pins for SD cards:


GND to GND
VCC to 3.3V
MISO to pin 12
MOSI to pin 11
SCK to pin 13
CS to pin 10

Connecting the GPS tracker pins:


GND to GND
Pin 2 (Arduino) to Pin 44 (GPS)

It is better to take power from the GPS tracker (3.7 V). Since its battery has low energy capacity, it is preferable to connect external battery, for example, from mobile phone at 1400 mAh, as shown in one of the pictures above.


Now you need to download the TinyGPS library, you will also need a library for working with SD cards and the SoftwareSerial library, which can be found in Arduino\libraries.



In the following piece of code you can choose what data to write:


void gpsdump(TinyGPS &gps) ( float flat, flon; // Lat, Long float fkmph = gps.f_speed_kmph(); // Speed ​​in km/hr float falt = gps.f_altitude(); // +/- altitude in meters (seem to be elevation, in fact) float fc = gps.f_course(); // Course in degrees unsigned long age; gps.f_get_position(&flat, &flon, &age); (flat, 4); Serial.print(" lon "); Serial.print(" kms "); .print(fc); Serial.print(" elevation "); ///////////////////////// //////////////////////////////////////////////// ///////////////

Upload the sketch to the Arduino, insert an SD card formatted according to FAT32 and having a log.txt file in the root. Launch Serial Monitor and you will see the data being written to the SD card.



GPS modules allow your stand-alone device track your coordinates and movement parameters. This functionality is important for all kinds of trackers, smart collars and backpacks. In this article we have made an attempt brief overview GPS modules and programs for working with GPS on a computer. Connection to Arduino is considered using the example of the most popular NEO 6.0 module

Before you start GPS connection to Arduino, you need to learn how to test the module itself. To do this, we will definitely need a program that allows us to show the status of the device, the number of satellites caught and other test information. We tried to put together the most popular software for working with GPS on a computer.

U-Center

The u-center program is used to work with GNSS receivers from U-Blox. With this software You can test positioning accuracy, change the receiver configuration and conduct general diagnostics, process the received data and display them in real time. The receiver receives coordinates using GPS, GLONASS. The obtained information can be exported and displayed in Google Maps, Google Earth. The program allows you to create two-dimensional charts, histograms and other types of graphs. u-center can be used when working with multiple receivers.

U-Center software features:

  • Working with Windows;
  • Reading NMEA, SiRF data, UBX;
  • Output of received data in the form of text and graphs;
  • Data recording and playback;
  • Full control of the GPS module;
  • Possibility to change the configuration of the GPS module;
  • Record new configuration to the module;
  • Writing the configuration to a file in .txt format;
  • Module firmware update;
  • Possibility of cold, warm and hot start of the module.

The program allows you to evaluate the performance of the receiver, analyze its performance and set its settings. In addition to U-Center, other programs can be used, for example, Visual GPS, Time Tools GPS Clock and others.

Visual GPS

This program is used to display GPS data using the NMEA 0183 protocol in graphically. The program allows you to write GPS data log to a file. There are two modes of operation in the program - in the first, Visual GPS communicates with the GPS receiver, and in the second, Visual GPS reads NMEA readings from a file. The program has 4 main windows - Signal Quality, Navigation, Survey, Azimuth and Elevation.

Time Tools GPS Clock

This program works on Windows and any workstations, it checks the time from a standard NMEA GPS time receiver that is connected to the computer and allows you to synchronize the time on the PC. Displays information about time, date, GPS status, received from the receiver. The disadvantage of the program is the impossibility of highly accurate time determination, since GPS devices do not have a second pulse for serial port computer.

GPS TrimbleStudio

The software is used to work with the Copernicus receiver on Windows. The program displays received navigation data. The obtained coordinates can be selected on Google Maps, Microsoft Visual Earth. All installed settings receiver can be saved in a configuration file

Fugawi

The program is used to plan a route, GPS navigation in real time. The program allows you to record and save routes and waypoints on the maps. Navigation is carried out both on land and on water and in the air. The program uses various types digital cardstopographic maps, NOAA RNC standards, scanned copies of paper maps, Fugawi Street Maps.

3D World Map

In this program you can see the earth in three dimensions. It is used as a convenient geographical reference book in which you can find out information about 269 countries and thirty thousand settlements, take measurements between two points, and play audio recordings.

Review of GPS modules for Arduino

To work with Arduino there is large number various GPS modules. With their help you can determine the exact location ( geographical coordinates, altitude), speed of movement, date, time.

Module EM-411. The device is based on a high-performance SiRF Star III chip, which has low power consumption. The module has a large amount of memory for saving almanac data and supports the standard NMEA 0183 protocol. The cold start time is about 45 seconds.

VK2828U7G5LF. This module is based on the Ublox UBX-G7020-KT chip. With its help you can obtain coordinates using GPS and GLONASS. The receiver has a built-in memory into which settings can be saved. The module is equipped with a built-in ceramic antenna and operates using the NMEA 0183 protocol. The module supply voltage is 3.3-5V.

SKM53 GPS. One of the cheapest modules with low current consumption. Cold start time is approximately 36 seconds, hot start time is 1 second. 66 channels are used for positioning and 22 channels for tracking. The module has a built-in GPS antenna, the device provides high navigation performance when different conditions visibility.

Neo-6M GPS. The receiver is manufactured by u-blox. This module uses latest technologies to get accurate location information. Module supply voltage 3-5V. The line of devices is represented by types G, Q, M, P, V and T with their own unique characteristics. Cold start time is about 27 seconds.

locosys 1513. This module supports GPS, GLONASS, Galileo, QZSS, SBAS. Based on the MediaTek MT333 chip, which has low power consumption, high sensitivity and stable work in various conditions. The receiver has support for a text control protocol. Cold start time is approximately 38 seconds.

Arduino GPS module GY-NEO6MV2

The module uses the standard NMEA 0183 protocol for communication with GPS receivers. The receiver is a board on which the NEO-6M-0-001 module, voltage stabilizer, non-volatile memory, LED and battery are located.

Module specifications:

  • Supply voltage 3.3-5V;
  • Interface UART 9600 8N1 3.3V;
  • NMEA protocol;
  • Module weight 18 g;
  • Availability of EEPROM for saving settings;
  • Availability of built-in battery;
  • Possibility of connecting an antenna to the U-FL connector;
  • Cold start time is approximately 27 seconds, hot start time is 1 second;
  • Availability of more than 50 positioning channels;
  • Refresh rate 5 Hz;
  • Operating temperatures from -40C to 85C.

The module is widely used for quadcopters, definition current situation slow-moving objects and vehicles. The obtained coordinates can be loaded into google maps Maps, Google Earth and others.

After a cold start of the module, the download of the almanac begins. Loading time is no more than 15 minutes, depending on conditions and the number of satellites in the visibility zone.

Pinout: GND (ground), RX (UART data input), TX (UART data output), Vcc - 3.3V to 5V power supply.

To connect you will need a GY-NEO6MV2 module, an Arduino board, wires, and a GPS antenna. Pin connections: VCC to 5V, GND to GND, RX to pin 9 on Arduino, TX to pin 10. Then the Arduino needs to be connected to the computer via USB.

To work, you will need to connect several libraries. SoftwareSerial – Required to extend the hardware functionality of the device and handle the serial communication task. The TinyGPS library is used to convert NMEA messages into an easy-to-read format.

Checking operation through the U-Center program

As mentioned above, the module is manufactured by u-blox, so the U-Center program is used to configure the receiver.

When connected to the UART, the receiver sends messages using the NMEA protocol once per second. Using the program, you can customize the messages sent.

To configure the module, you need to connect it via a USB-UART(COM-UART) converter. You can configure the connection using the Receiver-Port menu. Once the connection is established, the green indicator will light up. The receiver will begin to establish connections with satellites, after which the current coordinates, time and other information will appear on the screen. All messages appear in the Messages window. In the View – Messages menu you can select messages that will be transmitted to the microcontroller. Depending on the task at hand, you can reduce the number of messages sent, which will increase the speed of data processing and facilitate the algorithm for parsing messages by the controller.

If communication with the satellite is not established, you need to check whether the antenna is connected. Then you need to check the supply voltage, it should be 5V. If the connection is still not established, you can place the module near a window or go out into an open area.

You can view the transmitted data through the View menu.

All messages begin with the $ symbol, the following characters are message identifiers. GP is global system, the next 3 letters show what information is contained.

RMC – the smallest navigation information (time, date, coordinates, speed, direction).

GGA – captured positioning information. Time, coordinates, altitude, location status, number of satellites are recorded.

Checking operation via Arduino IDE

You can also work with the module through the standard development environment Arduino IDE. After connecting the module to the board, you need to upload the sketch and look at the result. If an incoherent set of characters appears on the monitor, you need to adjust the speed of the Arduino interface with the computer and the speed of the module interface with the controller.

Sketch for displaying location data.

#include #include //connecting TinyGPS gps libraries necessary for operation; SoftwareSerial gpsSerial(8, 9); //numbers of pins to which the module is connected (RX, TX) bool newdata = false; unsigned long start; long lat, lon; unsigned long time, date; void setup())( gpsSerial.begin(9600); // setting the exchange rate with the receiver Serial.begin(9600); Serial.println("Waiting data of GPS..."); ) void loop())( if (millis () - start > 1000) //set a one second delay between data updates ( newdata = readgps(); if (newdata) ( start = millis(); gps.get_position(&lat, &lon); gps.get_datetime(&date, &time); Serial.print("Lat: "); Serial.print(" Long: "); (date); Serial.print(" Time: "); Serial.println(time); ) // check for data availability bool readgps() ( while (gpsSerial.available()) ( int b = gpsSerial.read( ); //there is an error in the TinyGPS library: data with \r and \n is not processed if("\r" != b) ( if (gps.encode(b)) return true; ) ) return false;

After the code is uploaded, you need to wait a few seconds (cold start time) so that the device can determine the location and start showing coordinates. As soon as the device starts working, the LED on the board will blink.

The latitude and longitude data will appear in the port monitor. The current GMT date and time will also be retrieved. You can set your time zone manually - this is done in the line Serial.print(static_cast(hour+8));

Conclusion

As you can see, getting started with GPS does not require any very complicated manipulations. Ready-made modules or shields that interact with Arduino via UART come to the rescue. To make it easier to write sketches, you can use ready-made libraries. In addition, any GPS module can be tested without Arduino by connecting it to a computer and using special software. Browse the most popular programs we have provided in this article.

What is GPS?

The Global Positioning System (GPS) is a satellite-based navigation system, consisting of at least 24 satellites. GPS works in any weather conditions anywhere in the world 24 hours a day without subscription fee or installation fees. GPS system Ideal for location determination in amateur radio projects using Arduino.

How does GPS work?

GPS satellites circle the Earth twice a day in a precise orbit. Each satellite transmits a unique signal and orbital parameters that allow GPS devices decode and calculate the exact location of the satellite. GPS receivers use this information and trilateration to calculate the user's exact location. Essentially, a GPS receiver measures the distance to each satellite relative to the amount of time it takes to receive the transmitted signal. When measuring distance from multiple satellites, the receiver can determine the user's position and display it.


To calculate your 2D position (latitude and longitude) and movement, the GPS receiver must receive signals from at least 3 satellites. With 4 or more satellites, the receiver can determine your 3D position (latitude, longitude and altitude). Typically, a GPS receiver will track 8 or more satellites, but this depends on the time of day and where you are on earth. Once your position is determined, GPS module will be able to calculate other information such as speed, distance to destination, etc.


GPS satellites transmit at least 2 low-power radio signals. Signals travel along line of sight, meaning they will pass through clouds, glass and plastic, but will not pass through most solid objects such as buildings and mountains. However modern receivers are more sensitive and can usually track these signals indoors. The GPS signal contains 3 various types information. First, there is a pseudo-random code, that is, an ID code that identifies which satellite is transmitting information. Secondly, ephemeris data is necessary to determine the location of the satellite and gives important information about the state of the satellite, current date and time. Third, almanac data, which tells the GPS receiver where each GPS satellite must be in certain time throughout the day, and display orbital information for that satellite and every other satellite in the system.

Connecting the NEO-6m GPS module to Arduino

Adding GPS capabilities to an Arduino project is quite simple. You just need to connect a GPS module, for example, NEO-6m, to the Arduino board. The connection diagram is shown below. For best reception signals, it is advisable to attach an antenna to the GPS module.


Interaction code between Arduino and NEO-6m GPS module

Below is a code (sketch) that allows you to receive data from the GPS module and display it on the LCD display screen.


#include #include #include float lat = 28.5458,lon = 77.1703; // create a variable for the latitude and longitude object SoftwareSerial gpsSerial(3,4); // lines RX, TX LiquidCrystal lcd(A0,A1,A2,A3,A4,A5); TinyGPS gps; // create a GPS object void setup())( Serial.begin(9600); // serial port //Serial.println("The GPS Received Signal:"); gpsSerial.begin(9600); // connect a GPS sensor lcd.begin(16,2 ) void loop())( while(gpsSerial.available())( // check gps data if(gps.encode(gpsSerial.read())) // decode gps data ( gps.f_get_position(&lat,&lon); // get latitude and longitude // display position lcd.clear(); lcd.setCursor(1, 0); lcd.print("GPS Signal"); //Serial.print("Position: "); //Serial.print("Latitude:"); //Serial.print(lat,6); Serial.print(";"); //Serial.print("Longitude:"); //Serial.println(lon,6); lcd.setCursor(1,0); ; lcd.setCursor(5,0); lcd.print(lat); //Serial.print(" "); ,LON:"); lcd.setCursor(5,1); lcd.print(lon); ) ) String latitude = String(lat,6); String longitude = String(lon,6); Serial.println(latitude+";"+longitude); delay(1000); )

After several experiments with Arduino, I decided to make a simple GPS tracker.
Used Arduino Mega 2560 (Arduino Uno), SIM900 - GSM/GPRS module (for sending information to the server), GPS receiver SKM53 GPS.
Everything was purchased on ebay.com, in the amount of about 1500 rubles (about 500 rubles for the arduino, a little less - GSM module, a little more - GPS).

GPS receiver

First you need to understand how to work with GPS. The selected module is one of the cheapest and simplest. However, the manufacturer promises a battery to save satellite data. According to the datasheet, a cold start should take 36 seconds, however, in my conditions (10th floor from the window sill, there are no buildings at all) it took as much as 20 minutes. The next start, however, is already 2 minutes.

An important parameter of devices connected to the Arduino is power consumption. If you overload the Arduino converter, it may burn out. For the receiver used, the maximum power consumption is 45mA @ 3.3v. Why the specification should indicate current strength at a voltage other than the required one (5V) is a mystery to me. However, the Arduino converter will withstand 45 mA.

Connection

GPS is not controlled, although it has an RX pin. For what purpose is unknown. The main thing you can do with this receiver is to read data via the NMEA protocol from the TX pin. Levels - 5V, just for Arduino, speed - 9600 baud. I connect VIN to VCC of the arduino, GND to GND, TX to RX of the corresponding serial. I read the data first manually, then using the TinyGPS library. Surprisingly, everything is readable. After switching to Uno, I had to use SoftwareSerial, and then problems began - some of the message characters were lost. This is not very critical, since TinyGPS cuts off invalid messages, but it is quite unpleasant: you can forget about the 1Hz frequency.

A quick note about SoftwareSerial: there are no hardware ports on the Uno, so you have to use the software one. So, it can only receive data on a pin on which the board supports interrupts. In the case of Uno, these are 2 and 3. Moreover, only one such port can receive data at a time.

This is what the “test stand” looks like.

GSM receiver/transmitter

Now comes the more interesting part. GSM module - SIM900. It supports GSM and GPRS. Neither EDGE, nor especially 3G, are supported. For transmitting coordinate data, this is probably good - there will be no delays or problems when switching between modes, plus GPRS is now available almost everywhere. However, for some more complex applications this may no longer be enough.

Connection

The module is also controlled by serial port, with the same level - 5V. And here we will need both RX and TX. The module is shield, that is, it is installed on the Arduino. Moreover, it is compatible with both mega and uno. The default speed is 115200.

We collect on Mega, and here the first one awaits us unpleasant surprise: The TX pin of the module falls on the 7th pin of the mega. Interrupts are not available on the 7th pin of the mega, which means you will have to connect the 7th pin, say, to the 6th pin, on which interruptions are possible. Thus, we will waste one Arduino pin. Well, for a mega it’s not very scary - after all, there are enough pins. But for Uno this is already more complicated (I remind you that there are only 2 pins that support interrupts - 2 and 3). As a solution to this problem, we can suggest not installing the module on the Arduino, but connecting it with wires. Then you can use Serial1.

After connecting, we try to “talk” to the module (don’t forget to turn it on). We select the port speed - 115200, and it is good if all the built-in serial ports (4 on mega, 1 on uno) and all software ports work at the same speed. This way you can achieve more stable data transfer. I don’t know why, although I can guess.

So, we write primitive code for forwarding data between serial ports, send Atz, silence in response. What's happened? Ah, case sensitive. ATZ, we get OK. Hurray, the module can hear us. Should you give us a call out of curiosity? ATD +7499... The landline phone rings, smoke comes out of the arduino, the laptop turns off. The Arduino converter burned out. It was a bad idea to feed it 19 volts, although it is written that it can operate from 6 to 20V, 7-12V is recommended. The datasheet for the GSM module does not say anywhere about power consumption under load. Well, Mega goes to the spare parts warehouse. With bated breath, I turn on the laptop, which received +19V via the +5V line from USB. It works, and even the USB didn't burn out. Thanks Lenovo for protecting us.

After the converter burned out, I looked for current consumption. So, peak - 2A, typical - 0.5A. This is clearly beyond the capabilities of the Arduino converter. Requires separate food.

Programming

The module provides ample opportunities data transfer. Starting from voice calls and SMS and ending, in fact, with GPRS. Moreover, for the latter it is possible to perform HTTP request using AT commands. You'll have to send several, but it's worth it: you don't really want to create a request manually. There are a couple of nuances with opening a data transmission channel via GPRS - remember the classic AT+CGDCONT=1, “IP”, “apn”? So, the same thing is needed here, but a little more cunning.

To get a page at a specific URL, you need to send the following commands:

AT+SAPBR=1,1 //Open carrier (Carrier) AT+SAPBR=3,1,"CONTYPE","GPRS" //connection type - GPRS AT+SAPBR=3,1,"APN","internet" //APN, for Megafon - internet AT+HTTPINIT //Initialize HTTP AT+HTTPPARA="CID",1 //Carrier ID to use. AT+HTTPPARA="URL","http://www.example.com/GpsTracking/record.php?Lat=%ld&Lng=%ld" //The actual URL, after sprintf with coordinates AT+HTTPACTION=0 //Request data GET method//wait for response AT+HTTPTERM //stop HTTP

As a result, if there is a connection, we will receive a response from the server. That is, in fact, we already know how to send coordinate data if the server receives it via GET.

Nutrition

Since powering the GSM module from an Arduino converter, as I found out, is a bad idea, it was decided to buy a 12v->5v, 3A converter on the same ebay. However, the module does not like 5V power supply. Let's go for a hack: connect 5V to the pin from which 5V comes from the Arduino. Then the built-in converter of the module (much more powerful than the Arduino converter, MIC 29302WU) will make from 5V what the module needs.

Server

The server wrote a primitive one - storing coordinates and drawing on Yandex.maps. In the future, it is possible to add various features, including support for many users, “armed/unarmed” status, the state of the vehicle systems (ignition, headlights, etc.), and possibly even control of the vehicle systems. Of course, with appropriate support for the tracker, which smoothly turns into a full-fledged alarm system.

Field tests

This is what the assembled device looks like, without the case:

After installing the power converter and placing it in the case from a dead DSL modem, the system looks like this:

I soldered the wires and removed several contacts from the Arduino blocks. They look like this:

I connected 12V in the car, drove around Moscow, and got the track:


The track turns out to be torn. The reason is that sending data via GPRS takes a relatively long time, and during this time the coordinates are not read. This is clearly a programming error. It is treated, firstly, by immediately sending a packet of coordinates over time, and secondly, by asynchronously working with the GPRS module.

There are many GPS modules and shields for Arduino, but many of them are quite expensive. If for some reason you need GPS in your project, the cheapest (without sacrificing quality!) options known to me will be a module based on the NEO-6M chip. On AliExpress, such modules are sold for 230 rubles ($4), including delivery to Russia. Let's try to figure out how to work with them.

Note: Typically, GPS does not work in the home. To catch a signal from satellites, you need to go outside or onto a balcony with the module, or at least place it next to a window. In addition, GPS may have poor reception in cloudy weather. Please also note that even outdoors and in good weather when first turned on The module may take several minutes to initialize.

TO Arduino module Connecting is not difficult, since it is powered by 5 V, and transmits data via UART at a speed of 9600 baud. When the module finds enough satellites to determine its location, it starts flashing a blue LED and transmits something like this via UART once a second:

$GPRMC,160709.00,A,5546.7229,N,03749.47557,E,2.578,228.26,170617,A*69
$GPVTG,228.26,T,M,2.578,N,4.774,K,A*39
$GPGGA,160709.00,5546.792,N,03749.475,E,1.07,4.00,172.3,M,13.3,M,*5C
$GPGSA,A,3,13,20,18,30,21,15,6.45,3.95,5.11*02

Here it’s easy to find the current coordinates (5546.79229,N and 03749.47557,E), as well as the date (170617) and time in UTC (160709). The numbers at the end of the lines after the asterisk are checksums. It is worth noting that if the module has not yet determined its GPS coordinates, it transmits slightly different data via UART. Detailed description How to decode all this data can be found in a document called U-blox 6 Receiver Description Including Protocol Specification.

Despite the fact that writing your own parser is quite simple, enough of them have already been written and debugged so as not to waste your time on it. Personally, I used the TinyGPSPlus library. Firmware code:

#include
#include
#include "LiquidCrystal_I2C.h"
#include "TinyGPS++.h"

const int DELAY = 100 ;
const int SWITCH_TIME = 5000 ;

LiquidCrystal_I2C lcd(0x3F, 16, 2) ;
SoftwareSerial gps_serial(A3, A2) ; /* RX, TX */
TinyGPSPlus gps_parser;

void setup()
{
Serial.begin(9600);
gps_serial.begin(9600);
lcd.begin();
}

String twoDigits(int x) (
if(x< 10 ) return "0" + String(x) ;
else return String(x) ;
}

int currentModeTime = 0 ;
bool showLocation = false ;

void loop() (
while (gps_serial.available() > 0) (
char temp = gps_serial.read () ;
Serial.write(temp);
gps_parser.encode(temp);
}

String lat = "Unknown" ;
String lng = "location" ;
if (gps_parser.location .isValid () ) (
lat = "Lat: " + String(gps_parser.location .lat () , 6 ) ;
lng = "Lng: " + String(gps_parser.location .lng () , 6 ) ;
}

String date = "Unknown date" ;
if (gps_parser.date .isValid () ) (
date = twoDigits(gps_parser.date .day () ) + "/" +
twoDigits(gps_parser.date .month () ) + "/" +
String(gps_parser.date .year () ) + " " ;
}

String time = "Unknown time" ;
if (gps_parser.time .isValid () ) (
time = twoDigits(gps_parser.time .hour () ) + ":" +
twoDigits(gps_parser.time .minute () ) + ":" +
twoDigits(gps_parser.time .second () ) + " UTC " ;
}

if (showLocation) (
lcd.setCursor(0, 0);
lcd.print(lat);
lcd.setCursor(0, 1);
lcd.print(lng);
) else ( // show date and time
lcd.setCursor(0, 0);
lcd.print(date);
lcd.setCursor(0, 1);
lcd.print(time);
}

Delay(DELAY) ;
currentModeTime + = DELAY;
if (currentModeTime >= SWITCH_TIME) (
lcd.clear();
showLocation = ! showLocation;
currentModeTime = 0 ;
}
}

The corresponding device in action.