Do-it-yourself GPS tracker based on GY-NEO6M is easy. Brief description of Arduino GPS tracker Hatire Arduino settings window

After several experiments with Arduino, I decided to make a simple and not very expensive GPS tracker with coordinates sent via GPRS to the server.
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, for a total of about 1500 rubles (about 500 rubles for the arduino, a little less for the GSM module, a little more for the 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 windowsill, no buildings close by) 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 the 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 (other than the one connected to USB Serial), so you have to use software. 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 bench” 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 not be enough.

Connection
The module is also controlled via the 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 assemble it on Mega, and here the first unpleasant surprise awaits us: the TX pin of the module falls on the 7th pin of 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, and receive 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 from 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 extensive data transfer capabilities. Starting from voice calls and SMS and ending with GPRS itself. 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 using the 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 points are quite far from each other. 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.

The search time for satellites in the passenger seat of a car is a couple of minutes.

conclusions

Creating a GPS tracker on Arduino with your own hands is possible, although not a trivial task. The main question now is how to hide the device in the car so that it is not exposed to harmful factors (water, temperature), is not covered with metal (GPS and GPRS will be shielded) and is not particularly noticeable. For now it just lies in the cabin and connects to the cigarette lighter socket.

Well, we also need to correct the code for a smoother track, although the tracker already performs the main task.

Used devices

  • Arduino Mega 2560
  • Arduino Uno
  • GPS SkyLab SKM53
  • SIM900 based GSM/GPRS Shield
  • DC-DC 12v->5v 3A converter

Personal GPS transmitters

Today, progress is proceeding at such a pace that devices that were previously bulky, expensive and highly specialized are quickly losing size, weight and price, but gaining many new functions.

This is how devices based on GPS technology reached pocket gadgets and firmly settled there, giving people new opportunities. It is especially worth highlighting individual GPS transmitters.

Essentially, these are the same GPS trackers, only designed for use not on a vehicle, but by a person in everyday life.

Depending on the model, several various devices. In its simplest form, it is simply a small box without a display, which allows you to control the movements of children, animals or some other objects, on which it is fixed.

Inside it is located GPS module, which determines coordinates on the ground, a GSM/GPRS module that transmits information and receives control commands, as well as a power source that ensures autonomous operation for a long time.

Functionality of GPS transmitters

As the functionality increases, the following capabilities of the device appear:


Options for GPS transmitters

Depending on the configuration, transmitter housings may differ significantly. Various models have executions in the form cell phones, classic navigators, or even wristwatches.

The colorful design of special versions and useful additions allow children to treat these devices not as “parental spies”, but as fashionable and practical gadgets.

As an advantage, it is worth mentioning the fact that many versions of the device can do without subscription fee for the services of specialized operators, and all the necessary information is sent to the client directly via the Internet or SMS messages, which allows significant savings on the maintenance of such equipment.

Articles about GPS trackers

In this article I will show how to use a gsm module with arduino using the sim800L as an example. The same instructions are quite suitable for using any other gsm modules, for example, sim900, etc., because all modules work in approximately the same way - this is the exchange of AT commands through the port.

I will show the use of the module with arduino using the example of an SMS relay, which can be used to control the device remotely via SMS commands. This can be used in conjunction with car alarms, etc.

The module is connected to Arduino via the UART interface of a software serial port operating on 2 and 3 digital pins of Arduino nano.

Working with Arduino with GSM modules

To power the module, a voltage in the range from 3.6V to 4.2V is required, this means that you will have to use an additional voltage stabilizer, since the Arduino has a 3.3 volt stabilizer installed, which is not suitable for powering the module, the second reason to install an additional stabilizer is that the GSM module is serious load, since it has a weak transmitter that provides stable connection with a cellular station. Power for the Arduino nano is supplied to the VIN pin - this is a stabilizer built into the Arduino that ensures the module operates over a wide voltage range (6-10V). The relay module is connected according to the given program text to pin 10 of the Arduino nano and can easily be changed to any other that works as a digital output.

It works like this: install a SIM card in the GSM module, turn on the power and send an SMS with the text “1” to the number SIM cards in order to turn on our relay, to turn it off we send an SMS with the text “0”.

#include
SoftwareSerial gprsSerial(2, 3); // set pins 2 and 3 for software port
int LedPin = 10; // for relay

void setup()
{
gprsSerial.begin(4800);
pinMode(LedPin, OUTPUT);

// setting up message reception

gprsSerial.print("AT+CMGF=1\r");
gprsSerial.print("AT+IFC=1, 1\r");
delay(500);
gprsSerial.print("AT+CPBS=\"SM\"\r");
delay(500); // delay for command processing
gprsSerial.print("AT+CNMI=1,2,2,1,0\r");
delay(700);
}

String currStr = "";
// if this line is a message, then the variable will take the value True
boolean isStringMessage = false;

void loop()
{
if (!gprsSerial.available())
return;

char currSymb = gprsSerial.read();
if ('\r' == currSymb) (
if (isStringMessage) (
// if the current line is a message, then...
if (!currStr.compareTo("1")) (
digitalWrite(LedPin, HIGH);
) else if (!currStr.compareTo("0")) (
digitalWrite(LedPin, LOW);
}
isStringMessage = false;
) else (
if (currStr.startsWith("+CMT")) (
// if the current line begins with “+CMT”, then the next message
isStringMessage = true;
}
}
currStr = "";
) else if (‘\n’ != currSymb) (
currStr += String(currSymb);
}
}

Video version of the article:

Tags: #Arduino, #SIM800L

Your mark:

Products used in this article:

← GPS logger on arduino | Relay control via COM port →

GSM scanner on RTL-SDR

| home| English | Development | FAQ |

Main characteristics of the scanner

The GSM scanner scans GSM downlink channels and displays information about signal strength and channel ownership of one of the three main operators cellular communications MTS, Beeline and Megafon. Based on the results of its work, the scanner allows you to save a list of identifiers base stations MCC, MNC, LAC and CI for all scanned channels.
A GSM scanner can be used to evaluate the GSM signal level and compare signal quality different operators, radio coverage assessments, when deciding on installing cellular signal amplifiers and adjusting their parameters, for educational purposes, etc.
The scanner runs under Windows and uses a simple and cheap receiver - RTL-SDR. You can read about RTL-SDR at:
RTL-SDR (RTL2832U) and software defined radio news and projects,
RTL-SDR – OsmoSDR,
RTL-SDR in Russian.
The RTL-SDR parameters determine the main characteristics of the scanner. Of course, a GSM scanner is not a replacement for normal measuring equipment.
The scanner is distributed free of charge, without any restrictions on use.
Current version supports the GSM 900 band and does not support GSM 1800. This is determined by the fact that the operating frequency of the RTL-SDR with the R820T tuner is limited to 1760 MHz. There is hope that the use of the experimental RTL-SDR driver will allow operation in at least part of the 1800 MHz range.

Launching the scanner

The latest version of the scanner can be downloaded from this link. Just unzip the file to a convenient location and run gsmscan.exe.
Previous versions scanner, a link to the repository with sources and other information related to the development are on the development page.
For the scanner to operate, the installation of RTL-SDR drivers is required; if they have not already been installed, this can be conveniently done using the Zadig program to describe the installation procedure.

Using the Scanner

Below is a view of the scanner program window:

The horizontal axis displays the GSM channel number in the form of ARFCN or in MHz, and the vertical axis shows the signal level in dBm. The height of the line shows the signal strength.

GSM module NEOWAY M590 communication with Arduino

If the BS identifiers have been decoded successfully and they correspond to the identifiers of the three major telecom operators, the lines are painted in the corresponding colors.
Drop-down lists at the top of the screen allow you to select an SDR receiver, if several are connected, range GSM work 900 or GSM 1800 and horizontal axis units ARFCN or MHz.
The buttons allow you to save a report on the scanner’s operation in the form of a list of decoded base stations, clear the results of BS decoding and obtain information about the program.

Principles and features of work.

During operation, the program scans the operating frequency range with a step of 2.0 MHz (10 GSM channels) and digitizes the signal with a sampling frequency of 2.4 MHz. The scanning process consists of a fast pass through the entire range to measure signal strength and a slow pass to decode the BS identifiers.

One decoding step is performed after traversing the entire range to measure power. Thus, in the GSM 900 range, the signal level is updated approximately once every 2 s, and a complete decoding pass takes about 1 minute.
Due to the poor quality of the signal received from RTL-SDR, the probability of correctly decoding system information (SI) of the BS broadcast control channel (BCCH) is not high. Signal level fluctuations as a result of multipath propagation also reduce the likelihood of decoding system information. For these reasons, to obtain BS identifiers, it is necessary for the scanner to accumulate information over a period of about 10 minutes. But even in this case, not all channels provide this place sufficient signal level and quality for decoding even by the most ideal receiver. In addition, not all GSM channels are used to operate over GSM standard, as can be seen in the figure above, channels 975 - 1000 are occupied by Megafon to work on UMTS standard.
During operation, the scanner adds system information about new decoded channels to the general array of information on channels. But information about previously decoded channels is not erased when system information is not decoded at this step, and remains in the array. To clear this information, use the button to clear the BS decoding results.
When you click on the save report button, the accumulated results are saved in text file with a name made up of the name of the program, the date and time the data was saved. Below is an example of part of the report file:
The scanner is designed to work under Windows 7, 8.1 and 10. The work was tested with three copies of the RTL-SDR with the R820T tuner; other types of tuners were not tested.
A special version of the program has been compiled to work under Windows XP; it runs several times slower than the standard version.

Development.

The scanner program is supplied as is, without any warranties or liability. If you have reasonable ideas on how to expand the functionality or improve the performance of the scanner, we are ready to discuss the possibility of their implementation.
You can take part in the development of the scanner; to do this, visit the development page.
Further development of the GSM scanner is planned, possibly with your participation.

After several experiments with Arduino, I decided to make a simple and not very expensive GPS tracker with coordinates sent via GPRS to the server.
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, for a total of about 1500 rubles (about 500 rubles for the arduino, a little less for the GSM module, a little more for the 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 windowsill, no buildings close by) 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 the 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 bench” 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 not be enough.

Connection

The module is also controlled via the 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 assemble it on Mega, and here the first unpleasant surprise awaits us: the TX pin of the module falls on the 7th pin of 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, and receive 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 from 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 extensive data transfer capabilities. Starting from voice calls and SMS and ending with GPRS itself. Moreover, for the latter it is possible to execute an 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 using the 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.

Project diagram:

Hello friends, we have a large number of different spacecraft flying above our heads. Among them are approximately 90 extremely useful navigation satellites from the American GPS system, the Russian GLONASS, the European Galileo and the Chinese BeiDou. And today we will catch a signal from them.

First, a little theory: A satellite navigation system is a network of spacecraft that fly along previously known routes, accurately observing their orbit and trajectory, or are located at a known stationary point in a geostationary or geosynchronous orbit. Satellites fly on average at an altitude of about 20 thousand kilometers, and each is an ultra-precise atomic clock that continuously broadcasts its time to the entire planet. current time.

A radio signal propagating at the speed of light reaches the Earth with a delay of 60 to 90 milliseconds, this depends on the distance of the satellite. Knowing the exact location of the radio signal source by the time delay of its propagation, you can find out the exact distance to the satellite. And then, by triangulating distances to several known objects, you can find out where you are in space.

Imagine that this blue ball is our planet. Three satellites fly above it at an altitude of 20 thousand kilometers. When measuring the distance to the first one, you will receive information that you are somewhere on this circle - for now this is not very informative. The signal from the second satellite will clarify your location to two intersection points without reference to altitude. The signal from the third navigation satellite will indicate the height of these points above the surface and formally solve the navigation equation, reducing your location to two possible locations. In reality, one of these coordinates has incredible characteristics and is discarded, completely solving the problem. The signal from the fourth satellite does the same thing - it already unambiguously accurately solves the navigation equation.

Measuring the distances to each subsequent satellite increases the positioning accuracy and today it ranges from 1 to 3 meters with standard visibility of about 10 navigation satellites.

We've sorted out the theory, let's move on to practice. Nowadays different navigation modules are sold separately. The simplest and oldest ones only support signals from the American GPS observing system, on average 5-7 satellites. More advanced modules can also receive signals from the Russian GLONASS constellation, increasing the total number of satellites observed by an average of two times. There are also modules on sale that are combined with a compass; they are used for accurate navigation and course maintenance.

The satellites of different navigation systems are visible on the screen of my phone. The circles are GPS, the triangles are GLONASS, and the stars are the Chinese BeiDou. So my phone supports three different navigation systems and combining signals from them, increases the accuracy of location determination. Now there are 28 satellites above my head, and the signal is available from only 7. That is. my phone already knows in advance where each satellite is. And the missing signal from 21 satellites means that they are out of line of sight. The navigation signal is very weak, from the word VASCHE, it is almost not reflected, it is blocked by the terrain, buildings, the roof of a car - any metal above your head or on the side. Even snow falling outside the window interferes with good reception.

To implement the project, you will need a number of electronic modules: a programmable platform Arduino Nano, an OLED screen 128 by 32 points (it is connected via the I2C bus), a GPS module for connecting via UART, any lithium battery with a capacity above 200 milliamps, a protective-charging module for lithium and a boost converter to get 5 volts. I have three different types here, any one will do. I also planned to use a color RGB LED to indicate status, but abandoned this as the project progressed.

We connect the screen to Arduino and encounter the first difficulty. Standard Library The OLED screen takes up 20 kB, which is 70% of the microcontroller's memory and leaves virtually no space for the program. Previously, I was assembling an altimeter and was faced with the fact that any new line of code leads to memory overflow and the microcontroller freezes during operation. Therefore, I will use much more light library. It does not work with graphics and only displays text on an OLED screen, and it takes up only 1 KB of memory.

I separately connect the GPS module to the breadboard and see the first navigation data - a signal from space has been caught and processed. Now I display information on the screen. Class! Sees 4 satellites, now 3, and again 4, already 5! For better GPS reception, the module hangs outside the window on a wire.

During the development of the project I used GPS modules different types. Simple GPS and combined GPS with Glonass. We had to conduct a series of many-hour experiments to check the stability of operation. The modules turned out to be working, but with software libraries I had to tinker. Tried several different libraries, and TinyGPS+ was the only one that worked with all GPS modules at once.

In general, the library parses the NMEA protocol; it simply parses the data that the GPS module spits out twice per second. This is what an unprocessed data stream looks like.

As a result, my firmware allows you to connect almost any GPS module via UART with the NMEA data transfer protocol. In fact, these are the majority of modules that have RX and TX pins. I recommend taking the GPS module from Glonass, it sees more satellites, so its accuracy is higher. Links to all components and modules are in the description of this video.

The breadboard showed the full functionality of the system, now you can assemble everything in hardware. I will use a lithium battery as power; it will be connected to the protective board with charging. On this board, the lower resistor R3 sets the battery charging current, the default is 1 ampere, this is a lot for small batteries, so the resistor needs to be replaced. On the screen you see a plate with resistor values ​​for different charging currents. If your battery has a capacity of 500 milliamp hours, then you need to set the charge current no higher than this value. Those. you can set 200 or 300 milliamps, and not exceed 500.

Next, the voltage needs to be increased; the screen and GPS module are powered by 5 volts. We will do this using a boost voltage converter. These are usually installed in power banks to raise the voltage from 3.7 to 5 volts. I will be using the small green module, it can output up to 300mA and is more than enough for this project.

I have updated the firmware, now when loading the main screen displays the current exact time from satellites, the number of visible satellites and the current speed of the tracker, it jumps because there is an error in determining the location. When you press the button, the screen changes. The current speed value and the maximum value for the observation period are displayed here. On another screen there is the current distance to the zero point, the maximum recorded distance from it and the odometer.

I measure the sizes of all modules and try to arrange them as compactly as possible. But no matter how hard I tried, the thin screen did not fit in with the wide one. GPS receiver ohm Therefore, I decided to replace the screen with another OLED 128x64 pixels. This makes it more ergonomic and allows for a larger button. OLED screens are fully compatible and require minimal code correction, so firmware will be available for both versions of the device with a small screen and a large one.

The assembly diagram is simple. You need to connect the screen to the I2C bus, these are pins A4 and A5, the gps module is connected to the software serial port on pins D3 and D4. Button on pin D7. Battery power via protective module drag it to the switch, then to the boost converter, and connect the Arduino to 5 volts.

For convenient placement of the components, I will use a green breadboard 7 by 3 centimeters. To prevent the screen from hanging on the connector, I install it on plastic stands with 5 mm spacers. There will be a GPS receiver between the screen and the button. On the back of the board there will be an Arduino controller, a battery and a protective board. The battery will use thin lithium 350 milliamps, if I’m not mistaken, these are used in electronic cigarettes, but as I said, you can use any lithium battery.

I measure everything again, measure it and prepare a design for the housing for printing on a 3D printer. Literally 15 minutes on the TinkerCAD website and the project is ready to print. I transfer the file to a flash drive, launch it and off we go. Printing time is about 40 minutes, this is the first sighting body for trying out the placement of modules.

The board and button fit into place, but the screen was literally a millimeter short, and the internal stand was in the way. And so everything fits and is installed in its place. Great, I edit the project and print final version orange housing. After finishing printing, you must give the table time to cool and only then tear off the part, then the front side will be smooth and will not move.

I break off and clean the fixing edge of the plastic. Since I used ABS plastic, it is subject to post-processing with acetone. I apply it with a brush, the layers additionally stick together, and the body becomes stronger and acquires a gloss.

The board fits perfectly inside the case, the fasteners are aligned, the button does not stick. On one end there is a hole for the Arduino Nano connector, and on the other side for charging the battery. It turned out to be a little narrower, so I expand it with a scalpel.

The charging board has protrusions along the edges, they prevent the connector from being deepened, so I grind them down with a needle file. Now the board is well in its place.

IN general view the device will look like this. The housing is located on top. Under it there will be a micro switch, a breadboard with a screen, a GPS module and a button. There is also a step-up power converter on the side.

Separately for the switch, I cut a hole in the case with a scalpel, above the button. It is recessed into the body and will not interfere.

It's time to solder. I solder the first contact of the screen to the board, try it on - everything is correct and you can solder the remaining three contacts. Now the button. And be sure to clean off the flux with a brush. I solder the wires to the battery protection module.

When connecting, be sure to pay attention to the color of the wires. Incorrect colors occasionally come from China. In this case, I decided to desolder the connector and solder the wires directly for better contact. The procedure is complex and requires precision and care when soldering. Additionally, I fill the contacts with hot glue, this will protect the tracks and wire from accidental pulling out. And we immediately stuff the entire GPS module into heat shrink; this is not necessary, but it will additionally protect against mechanical damage and short circuits when mounted on a breadboard.

We also wrap the boost converter in heat shrink. To secure the modules I use double-sided tape. When installing the board, it turned out that there was not enough space for the wires, so I drilled holes in the center and put the power wires through there.

By the way, I recommend a cool cordless drill. It runs on a single 18650 battery and allows you to quickly drill similar holes on boards and in cases. Previously, for such work, I had to take the Dremel out of the case and plug it into a power outlet, but now I always have this drill at hand.

The upper part of the board is assembled, the wires are threaded and now you need to install the switch. To do this, we bite off the extra legs on it; only two are needed to supply and interrupt the power supply. We solder the wire on them and, as usual, heat shrink everything. Next, you can install the switch in its place and fill it with hot glue. Now it will be convenient to turn the tracker on and off.

I install the board into the case and secure it with four small screws. The corresponding holes are already provided on the housing supports. When I removed the protective film from the screen, I noticed a large gap between the display and the body. Therefore, I took a piece of transparent packaging from some electronics and cut glass out of it to fit the size of the window. And glued it with acetone to the plastic of the case.

We carry out the assembly according to the scheme, there are no difficulties or nuances here. Just pay attention, plus to plus, minus to minus. We connect the switch directly to the output of the charging module. This will turn off the entire power circuit and prevent battery drain.

After soldering all the wires to the modules, cover the bottom board with blue electrical tape. The Arduino controller with charging will be on top, and without insulation there is a possibility of shorting something.

I solder the protective module and secure it in place with hot glue.

I puddle the battery contacts and quickly solder the wire to them so as not to overheat the battery. On the one hand and on the other. After this you need to connect micro USB cable and supply power to the protective module, this will activate its operation.

Done, now you need to upload the firmware. We connect Arduino to the computer, go to the project page, a link to it is in the video description. Download the archive, unpack the files, install the libraries, open the required firmware version for the 32 or 64 point screen and load it into the controller. Everything worked the first time! Data from GPS rod. Cool!

I install the controller in its place, turn on the autonomous power supply... iiiiiiiii... nothing. The power LED on the Arduino is on, but the screen does not turn on. And that’s how tryndets happened, the reason for which I still don’t know. It took me several hours of work to get the tracker to work autonomously from the built-in battery.

At first I thought the small step-up power converter was the culprit. But checking with a multimeter showed a stable 5 volts. Next, I connected an autonomous power module that I had left over from another project, it is built on a large boost converter - and lo and behold, the tracker started up, but froze after a few seconds.

I charged the battery on it and placed the tracker on the window to catch satellites. Three minutes later, he picked up a signal from 4 satellites and determined the location. Well, that means it works and can probably be assembled? We change the boost converter, apparently the small one makes a lot of noise from the power supply.

To do this, I had to completely disassemble the tracker, unsolder all the wires and reassemble it again. The new power module will be located in the same place as the old one, only one stand had to be removed so that it would fit under the screen.

That's it, I twisted the wires into pigtails to avoid interference. Aaand... this bastard didn't turn on again. More precisely, it turned on and immediately froze with artifacts on the screen. So many hours of work and all for nothing. Replacing the converter did not help.

I tried installing capacitors on the power supply - nothing helped. The tracker refused to work autonomously, both from boost converters and from the laboratory power supply - it froze or did not turn on at all. But at the same time it worked perfectly from the Arduino USB connector.

Using the sequential shutdown method, I was able to find out that the OLED screen was to blame for this - but I still don’t understand why. The solution was found suddenly. During the next check of the autonomous power supply, I accidentally applied 5 volts to the VIN pin. I note that this pin! Not! designed to supply 5 volt power and requires a voltage of 7 to 12 volts.

But nevertheless, the tracker immediately started up and began to work stably. Those. It turns out that the small stabilizer was not the source of the problem, it was something else.

At the same time I decided to check the current consumption. From 5 volts the tracker consumed about 70 milliamps. And from 4 volts through a boost converter it turned out to be about 110 milliamps. Thus, my small 350 milliamp battery will last for three hours battery life. And I haven’t optimized the power supply yet, you can cut off the LEDs that are always on and still save the battery.

The tracker began to work completely stably, I left it on the window and after a few minutes it caught 4 satellites. Great

If you are interested in helping me understand the reason for the strange behavior of Arduino, then here is an introduction:

1 – The tracker works if it is powered via the Arduino USB connector.

2 – The tracker freezes and does not turn on if you power it through the Arduino 5V pin by applying 5 volts to it from any power source.

3 – The tracker freezes and does not turn on if 7 volts or more are applied to it through the Arduino VIN pin.

4 – The tracker works if it is powered with non-standard 5 volts through the same VIN pin.

The finished device is a universal autonomous speedometer, rangefinder, odometer and satellite accurate time clock in one housing.

On the main screen after loading, the current time and date in Greenwich are displayed at the top, the second line is the current speed of 0.3 kilometers per hour and the maximum speed value that has been recorded since the time it was turned on - 26 kilometers per hour. On the third line, the current distance to the zero point is 530 meters and the maximum distance that has been achieved since switching on is 580 meters. On the fourth line, the odometer shows 923 meters and the number of satellites used.

The bottom line chars is the amount of data received from the GPS module.

When you briefly press the button, the screen display changes, and when you hold it for a long time, the tracker remembers the current location as a zero reference point for distance measurements. The second screen displays the current and maximum speed. The third screen contains information on the distance to the zero point. The fourth screen is the odometer. Fifth latitude and longitude.

You can reset the odometer and maximum values ​​by long-pressing the button on the screen with these parameters. Those. go to the odometer and hold the button pressed to reset it.

Let's move on to testing. Now the tracker sees 12 satellites. I set the current zero point and reset the odometer to zero. I do the same thing on a car odometer. Having traveled 1.2 kilometers according to the car’s speedometer, I saw the same 1205 meters on the GPS tracker. The current distance to the zero point in a straight line is 0.93 kilometers. And according to the map, those same 930 meters, so far everything is accurate.

I decided to measure a longer distance. Again I reset the readings to zero on the tracker and car. Having traveled 8.4 kilometers, I found on the tracker that the distance was shorter - only 7974 meters. In this case, the current distance to the zero point is 4,930 meters. Let's check it on the map, it turns out very accurately, the same 4,930 meters. It’s not clear, but why then the odometer is lying at 400 meters and which odometer is lying, on the car or the GPS.

Okay, it's time to print back cover and we will test again. I'm closing. The weight of the finished device turned out to be 55 grams, a lot, but not critical - at the end I will show you how to reduce it.

I arrived at the skating rink and decided to measure the hockey player’s speed. Damn, he still needs to remove the covers for speed. The result was a fierce speed, like a “Russian rocket” - 5 kilometers per hour. I walked, and all because the ceiling on the skating rink is insulated with reflective foil to keep out the cold. There is a signal from satellites, but it is not accurate.

Let's do one last test with mobile phone. The phone sees 7 satellites, and the tracker 9. I start logging and reset the odometer on the tracker. Well... let's go. After driving three kilometers, the phone and tracker showed identical values ​​on the odometer. 3017 versus 3021 meters is a super result, I did not expect such accuracy.

But the odometer glitched, as much as 12 thousand kilometers. Not sour. Previously, when debugging a program, I had already encountered such a glitch and the tracker was immediately moved 7 thousand kilometers. When I got home, I created a point in Google with zero latitude and longitude. It turned out that it is located in the Atlantic Ocean, not far from the coast of Ghana. Having measured the distance from it to my location, I got those same 7 thousand kilometers. It turns out that the GPS module sometimes skips zeros along the coordinates. This can be easily fixed by adding just one condition to the program code. And this glitch was not observed during tests.

I think the tracker turned out awesome; this is my first experience of working directly with GPS modules. Why is it needed? Such a tracker can serve as an autonomous speedometer or an independent odometer. It can be placed on a bicycle, car, toy or quadcopter. It also allows you to measure the distance in a straight line to a given point, zero values ​​are stored in non-volatile memory. Remembers the maximum achieved speed and distance values. It does all this autonomously and does not depend on anyone other than satellites. And of course, this is an accurate time clock. I need it to measure maximum speed and maximum distance from objects. That's right, you need to add more height to the screen to measure how high you rise!

Let's talk about how you can reduce weight; the easiest way to do this is by assembling the tracker on a platform Arduino Pro Mini at 3.3 volts. Then you will not need a boost converter, instead there will be a small linear stub at 3.3 volts, the GPS module works without problems on this voltage, and on the screen you will need to bypass the power stabilizer.

Well, I’ll immediately answer the question: is it possible to add a GSM module and control the tracker via SMS? Yes, you can. To do this, in addition to the module itself, you will also need to add processing of SMS commands to the program code and this should be a separate project.

That's it for today, if you liked this video, then I'm sure you will like it and share the link to the video with your friends.

Thanks for watching, good luck everyone and see you in new videos! Bye bye!

The data is saved in a spreadsheet dataGPS.csv, the format of which corresponds to the requirements of the service Google My Maps.

    Programming language: Arduino (C++)

Video instruction

What you need

How to assemble

gps-tracker.ino // library for working with devices via SPI#include // library for working with SD card#include // library for working with a GPS device#include // create an object of the GPS class and pass the Serial1 object to it GPS gps(Serial1) ; // LED pin#define LED_PIN A0 // button pin #define BUTTON_PIN 13 // pin CS micro-sd card#define CHIP_SELECT_PIN 9 // time interval for writing data to the card#define INTERVAL 5000 // set the array size for time, date, latitude and longitude#define MAX_SIZE_MASS 16 // array to store the current time char time[MAX_SIZE_MASS]; // record state bool stateRec = false ; // remembers the current time long startMillis = millis() ; void setup() ( // open the serial port to monitor actions in the program Serial.begin(115200); // wait until the monitor opens serial port // in order to track all events in the program// while (!Serial) ( // ) Serial.print ("Serial init OK \r\n") ; // open a Serial connection with the GPS module Serial1.begin(115200); // set the LED to output mode pinMode(LED_PIN, OUTPUT) ; // set the button to login mode pinMode(BUTTON_PIN, INPUT_PULLUP) ; // output information about initialization to the Serial port Serial.println("Initializing SD card...") ; // initialize the SD card while (! SD.begin (CHIP_SELECT_PIN) ) ( Serial.println ("Card failed, or not present" ) ; delay(1000 ) ; ) // output information to the Serial port Serial.println("Card initialized"); // create a dataFile object of the File class to work with files File dataFile = SD.open("dataGPS.csv" , FILE_WRITE) ; // if the file exists if (dataFile) ( // write the name of the future data to the memory card dataFile.println("Time, Coordinates, Speed" ) ; // close the file dataFile.close(); Serial.println("Save OK"); ) else ( Serial.println ("Error opening test.csv" ) ; ) ) void loop() ( // Record the button press if (! digitalRead(BUTTON_PIN) ) ( // change the state “recording” / “not writing” to the memory card stateRec = ! stateRec; // change the state of the indication LED digitalWrite(LED_PIN, stateRec) ; ) // if data came from the GPS module if (gps.available()) ( // read data and parse gps.readParsing(); // check the status of the GPS module switch (gps.getState () ) ( // everything is OK case GPS_OK: Serial.println ("GPS is OK" ) ; // if the specified time interval has passed if (millis() - startMillis > INTERVAL && stateRec) ( // save data to memory card saveSD() ; // remember the current time startMillis = millis() ; ) break ; // data error case GPS_ERROR_DATA: Serial.println("GPS error data" ); break ; // no connection with satellites case GPS_ERROR_SAT: Serial.println ( "GPS no connect to satellites") ; break ; ) ) ) // function for saving data to a memory card void saveSD() ( File dataFile = SD.open("dataGPS.csv" , FILE_WRITE) ; // if the file exists and has been opened if (dataFile) ( // reads the current time gps.getTime(time, MAX_SIZE_MASS); // write the time to the memory card dataFile.print(" \" " ) ; dataFile.print(time); dataFile.print(" \" " ) ; dataFile.print ("," ) ; dataFile.print(" \" " ) ; // read and write latitude and longitude coordinates to the memory card dataFile.print(gps.getLatitudeBase10(), 6); dataFile.print ("," ) ; dataFile.print(gps.getLongitudeBase10(), 6); dataFile.print(" \" " ) ; dataFile.print ("," ) ; dataFile.print(gps.getSpeedKm()); dataFile.println("km/h"); dataFile.close(); Serial.println("Save OK"); ) else ( Serial.println ("Error opening test.csv" ) ; ) )