0

members

Easy Basics: Project 053i NEO-6M GY-GPS6MV2 GPS module, 1.8 SPI TFT LCD module - GPS-based tracker

of Lex C in UNO

Basics: Project 053i

Project name: NEO-6M GY-GPS6MV2 GPS module, 1.8" SPI TFT LCD module  - GPS-based tracker

Tags: Arduino, Arduino Uno, NEO-6M GPS module, GY-NEO6MV2 GPS Module, GY-GPS6MV2, NEO6MV2, TinyGPSPlus library, TinyGPS++ library, NeoGPS library, UBOX, GPS clock with Neo 6M, GPS-based timing, time, date, position, speed, course, heading, distance, 1.8" SPI TFT LCD, 128x160 module, SD card, ST7735R, ST7735S, Adafruit, Adafruit_ST7735, ST7735B, HY-1.8 SPI, S6D02A1, KMR-1.8 SPI, TFT_ILI9163, Arduino Esplora, SainSmart

Attachments: NEOGPS_18LCD_sketchlibrary0,library1

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. NEO-6M GY-GPS6MV2 GPS module (it comes with an external antenna, and does’t come with header pins. So, you’ll need to get and solder some) 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5.Resistor 4 pcs (10 KOhm 1 pc, 1 KOhm 4pc, 150-470 Ohm 1 pc, 4.7KOhm 1 pc)

6.Breadboard half size or small size 1 pc

7. 1.8" SPI TFT LCD 128x160 module (there are quite a lot of different modules but all of them have the same working principle) 1pc

General

We will learn how to connect NEO-6M GY-GPS6MV2 GPS module, 1.8" SPI TFT LCD 128x160 module and use them to display GPS data: local time, date, day of week, position, speed, course and so on. We can also define waypoint (our destination), get the heading to waypoint and distance in km to waypoint.

Project sequence:

  1. The GPS module receives data from satellites;
  2. Arduino board receives GPS data (UTC time) from the GPS module;
  3. Arduino board calculates distance and heading to defined waypoint, converts UTC time to local time with time offset.
  4. Arduino board prints the GPS data and calculated data (heading, distance, local time) on the 1.8 SPI TFT LCD module.

GPS-Based Timing

GPS receivers can be used to provide highly accurate time information. For this reason the u-blox 6 Timing GPS module includes a specific Time Mode, which assumes a known antenna position and calculates a time pulse synchronized to either GPS or UTC (Coordinated Universal Time).

The base of all timing and frequency applications is the one pulse per second (1PPS) time pulse, which is synchronized to GPS time or UTC.

Single satellite navigation can be useful under poor GPS reception conditions. Time information can be heavily degraded due to multipath effects. To avoid such degradation choose an antenna that primarily receives satellites with high elevation angles. 

When adjusting the time pulse the user should take the electrical delay into account, due to the cable length connecting the antenna with the GPS receiver. In addition an arbitrary user delay can be considered to calibrate the time pulse to a given reference time.

Accuracy of time pulse

Configuration of the time pulse depends on the application. A low time pulse frequency e.g. 1 Hz is best for exact timing measurements. The accuracy of the time pulse can be measured in terms of a difference to a reference time. The reference time should be as accurate as possible and is normally generated by a GPS receiver, which is synchronized to a rubidium clock.

The timing error consists of three parts:

  1. A constant error caused by delay from the antenna cable and from the receiver.
  2. A short-time error from pulse to pulse related to generation and quantization of the time pulse.
  3. The position uncertainty caused by multipath effects or caused by different transit times to the ionosphere.

The first error term can be removed by assuming a certain cable delay in the configuration table. The second error term relating to the quantization error can be compensated by using the UBX-TIM-TP message. The last error term related to the multipath effect can be minimized by using an antenna with suitable antenna pattern in conjunction with single satellite navigation.

Frequency accuracy

A faster time pulse e.g. 8 kHz or more is used for accurate frequency measurements.

Frequency stability

Frequency stability depends on the observation time and is measured in terms of Allan deviation or phase noise. u-blox time pulse shows excellent long-term stability and reasonable short-term stability, but it is not designed for improved phase noise performance for reasons that will be discussed in the next sections.

Allan deviation

Allan deviation is typically measured for observation or integration intervals from 1 s to some 1000 s or even more. It is a time domain fractional frequency measure which was initially used to characterize oscillators suffering from aging and ambient effects. In this instance the Allan deviation, which is the square root of the Allan variance, provides better results than the standard deviation calculated from a set of data. A typical curve is shown in Figure 5. An observation interval around 1 s refers to short-term stability and above some seconds refers to long-term-stability. Because of the fractional frequency usage Allan deviation is dimensionless and plotted versus the observation interval.

Phase noise

Short-term stability with uncertainties lower than 0.1 s is measured in terms of phase noise. In practice, the noise power in a single sideband over a bandwidth of 1 Hz with respect to the frequency offset from the carrier is measured to characterize phase noise. If related to the total signal power, phase noise is given in dBc/Hz. Since the time pulse is derived from a 48 MHz clock it suffers from an additional jitter due to quantization or granularity of the clock. Be aware, that the time pulse is not designed for improved phase noise specification.  If necessary the customer must add an external circuit e.g. a phase lock loop. Picture below shows an example of how to improve phase noise performance. A phase lock loop is added to the time pulse output to synchronize the time pulse to an external oscillator. If additional holdover performance is required an oven-controlled oscillator should be used instead of a temperature-controlled oscillator.

Understanding the 1.8" SPI TFT LCD module

You can read more about it here.

Understanding the NEO-6M GY-GPS6MV2 GPS module

You can read more about it here.

Signals and connections of the 1.8" SPI TFT LCD module


This color display uses SPI to receive image data. That means you need at least 4 pins - CLOCK, DATA IN, TFT CS and D/C. If you'd like to have SD card usage too, add another 2 pins - DATA OUT and card CS. 

Note: depending on the module you’re using, the pins may be in a different order.

LITE - this is the PWM input for the backlight control. Connect to 3-5VDC to turn on the backlight. Connect to ground to turn it off. Or, you can PWM at any frequency.

MISO (or SD_MISO or SDO) (Master In Slave Out) - this is the SPI Master In Slave Out pin, its used for the SD card. It isn't used for the TFT display which is write-only

SCLK (or SD_SCK or SCK or CLK or SCL) (Serial Clock) - The clock pulses which synchronize data transmission generated by the master. This is the SPI clock input pin.

MOSI (or DIN or SD_MOSI or SDA) (Master Out Slave In) - this is the SPI Master Out Slave In pin, it is used to send data from the microcontroller to the SD card and/or TFT

TFT_CS (Chip Select or Slave Select) - the pin on each device that the master can use to enable and disable specific devices. This is the TFT SPI chip select pin

Card_CS (or SD_CS) (Chip Select or Slave Select) - the pin on each device that the master can use to enable and disable specific devices. Used if you want to read from the SD card.

D/C (or A0 or DC or RS) - this is the TFT SPI data or command selector pin

RST (or RESET or RES) - this is the TFT reset pin. Connect to ground to reset the TFT! Its best to have this pin controlled by the library so the display is reset cleanly, but you can also connect it to the Arduino Reset pin, which works for most cases.

CS (or CE or SS) (Chip Select or Slave Select) - the pin on each device that the master can use to enable and disable specific devices.

VCC - this is the power pin. Can be connected to +5VDC or +3.3VDC pin of Arduino board.

GND - ground. Connected to Arduino board GND pin.

BL (or LED+) - this is the input for the backlight control. Connect to 3.3V or 5V DC (with resistor 40-150 Ohm) to turn on the backlight.

LED - 3.3V IO and Power Supply pin

LED- - this is the backlight control ground pin. Connect to GND pin of Arduino board.

NC - Not connected. This pin is not in use.

Signals and connections of the NEO-6M GY-GPS6MV2 GPS module

The NEO6MV2 GPS module comes with 4 connections: RX, TX, VCC and GND, which is quite easy to incorporate with using SoftwareSerial on an Arduino Uno or a serial interface on an Arduino Mega. The power supply of the NEO6M should be 3.6V at max according to the datasheet. The typical China-produced breakout-boards contain a voltage regulator so that 3-5V VCC so it does not harm the board. Since the digital pins also produce 5V, the voltage divider is used on the receivers RX channel since this is not regulated.

RX (or RXD) - receive pin. Connected to Arduino board TX pin.

TX (or TXD) - transmit pin. Connected to Arduino board RX pin.

VCC - power supply. Can be connected to +5VDC or +3.3VDC pin of Arduino board.

GND - ground. Connected to Arduino board GND pin.

PPS - Pulse per second. This is an output pin on some GPS modules. Generally, when this pin toggles, once a second, you can synchronize your system clock to the GPS clock.

Wiring

There are two ways to wire up these displays - one is a more flexible method Software SPI (you can use any pins on the Arduino) and the other Hardware SPI is much faster (4-8x faster, but you are required to use the hardware SPI pins) 

Note: different Arduino boards have different SPI pins. If you’re using another Arduino board, check the Arduino SPI documentation.

1. 1.8" TFT SPI display 128*160 v1.1 module with ST7735S IC

2. If you have other types of 1.8" TFT SPI display - check this project for wiring details.

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Verify and upload the NEOGPS_18LCD_sketch to your Adruino Uno.
  5. It will take some time before you will get the proper data. Local time will be updated first, then date and then the other GPS data (when blue led on GPS module starts to flash).
  6. You can check your position on this website.
  7. You can check the distance and bearing to waypoint on this website.

Summary

We learnt how to connect NEO-6M GY-GPS6MV2 GPS module, 1.8" SPI TFT LCD 128x160 module and use them to display GPS data.

Notes:

  • It takes for about half a minute or one to read the data by the GPS module initially when you run it, so do not panic for this it’s very usual.
  • It happens in some case that it is unable to detect the data that might be the issue with antenna, so unplug the antenna( if it is detachable) and attach it again.
  • If, code says “Check Connection”, then you should definitely check it twice, before giving up. Also, sometimes interchanging the TX and RX pins is preferable and surprisingly works.

Code

The TinyGPS++ library allows you to get way more information than just the location, and in a simple way. Besides the location, you can get: date, time, speed, course, altitude, satellites, hdop and so on. You can read more  about the TinyGPS++ library here.

You will need to define your waypoint: 

static const double WAYPOINT_LAT = 51.508131, WAYPOINT_LON = -0.128002; // change the waypoint coordinates

static const double WAYPOINT_LAT = 51.508131, WAYPOINT_LON = -0.128002; // change the waypoint coordinates

And the time offset:

#define time_offset   10800  // define a clock offset of 10800 seconds (3 hours) ==> UTC + 3

 Libraries

  • All libraries attached on the begining of the project description
  • TinyGPS++ library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.  You can read more about it here.
  • SoftwareSerial library included in Arduino IDE. The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn't work on Pin 13.
  • SPI library included in Arduino IDE. See more here.
  • Time library included in your Arduino IDE. You can read about it here.
  • TFT_ILI9163 library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here. Supports ILI9163 chip

Sketch

  • See attachments on the begining of this project


Other projects of Lex C
Easy Basics: Project 057a ACR122U NFC Reader of Lex C, Not selected 17-01-2018

Published at 30-04-2019
Viewed: 5653 times