10

members

Easy Basics: Project 081g ESP8266 ESP-12E, NEO-6M GY-GPS6MV2 GPS, 0.96" I2C OLED - GPS data display

of Acoptex.com in ESP8266 ESP-12

Basics: Project 081g

Project name: ESP8266 ESP-12E module, NEO-6M GY-GPS6MV2 GPS module, White 0.96" I2C OLED display module  - GPS data display

Tags: Arduino, Arduino Uno, ESP8266 ESP-12E module, ESP, ESP8266, WI FI module, ESP-12E, LoLin NODEMCU V3, NODEMCU, 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, position, date, Arduino GPS real time clock, UTC time, 0.96" I2C, White OLED display module, 128x64, 128x32, GMS096A, Adafruit Monochrome OLED, SSD1306, White 0.96" I2C OLED display module, I2C/TWI Interface

Attachments: sketch1 and library1, library2 

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. 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

2. Jumper cables F-F

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

4. ESP8266 ESP-12E module with micro USB cable 1pc

5. 0.96" I2C OLED display module 1 pc

General

We will learn how to use ESP8266 ESP-12E module with NEO-6M GY-GPS6MV2 GPS module and White 0.96" I2C OLED display module to display GPS data.

GPS stands for Global Positioning System and it is used to find out location, altitude, speed, date and time in UTC. In this project we are going to interface a GPS module with NodeMCU.

Project sequence:

  1. The GPS module receives data from satellites;
  2. Nodemcu board receives GPS data from the GPS module;
  3. Nodemcu board prints GPS data on the white 0.96" I2C OLED display 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 0.96" I2C OLED display module

You can read more about it here.

Understanding the NEO-6M GY-GPS6MV2 GPS module

You can read more about it here.

Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

You can read more about it here.

Signals and connections of the 0.96" I2C OLED display module

The nice thing about the 128x64 OLEDs is that they can be used with I2C (+ a reset line) or SPI. SPI is generally faster than I2C but uses more pins. It's also easier for some microcontrollers to use SPI. 

Make sure that you connect the power pins correctly. Some modules have GND and VCC swapped around. Don't blow up your display!

Data - Connected to I2C SDA if Adafruit OLED display module

Clk - SCK (Serial Clock) - SPI communication.The clock pulses which synchronize data transmission generated by the master. Connect to I2C SCL if Adafruit OLED display module.

SA0 (DC or D/C) - This is Data/Command control pin. When it is pulled HIGH , the data at D[7:0] is treated as data. When it is pulled LOW, the data at D[7:0] will be transferred to the command register. In I2C mode, this pin acts as SA0 for slave address selection.

RST (RES) - This pin is reset signal input. When the pin is pulled LOW, initialization of the chip is executed. Keep this pin HIGH during normal operation.

CS - (Chip Select) - the pin that the master can use to enable and disable specific devices.

3.3vo (3.3v) - this is the power pin. Should be connected to +3.3 VDC pin of Arduino board.

Vin - this is the power pin. 3 to 5V power supply. All OLEDs are safe to use with 3.3V logic and power.

VCC - this is the power pin. Can be connected to +5VDC or +3.3VDC pin of Arduino board (depends on the display module). All OLEDs are safe to use with 3.3V logic and power.

GND - ground. Connected to Arduino board GND pin.

SDA - Serial Data Line. Connected to Arduino Uno SDA or Analog pin A4. 

SCL - Serial Clock Line. Connected to Arduino Uno SCL or Analog pin A5.

D0 - Master In Slave Out (MISO) - SPI communication. The Slave line for sending data to the master. 

DI (DIN) - Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. 

NC - 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.

Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

TX - transmit pin. GPIO pin

RX  - receive pin.  GPIO pin

3V3 (or 3V or 3.3V) - power supply pin (3-3.6V). 

GND ( or G) - ground pin.

RST - reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

EN - Chip enable. Keep it on high (3.3V) for normal operation.

Vin - External power supply 5VDC.

D0-D8 - GPIO (General Purpose Input Output) pins 

D5-D8 - SPI interface

D1-D2– I²C/TWI Interface

SC (or CMD) - (Chip Select) - the pin that the master can use to enable and disable specific devices. GPIO pin

SO (or SDO) - Master In Slave Out (MISO) - SPI communication. The Slave line for sending data to the master. GPIO pin

SK (or CLK) - SCK (Serial Clock) - SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin

S1 (or SD1) - Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin

S2 (or SD2) - GPIO pin

S3 (or SD3) - GPIO pin

VU (or VUSB) - external power 5VDC.

A0 - ADC output.

RSV - reserved

Wiring

ESP8266 ESP-12E module -> NEO-6M GY-GPS6MV2 GPS module

VV (5V)       VCC (GPS module can be used with 3V3 or 5V power)
GND           GND
D6 (GPIO12) TX
D7 (GPIO13) RX

ESP8266 ESP-12E module -> White 0.96" I2C OLED display module

3V3            VCC
GND           GND
D1 (GPIO5) SCL
D2 (GPIO4) SDA

Step by Step instruction

1. Adding ESP8266 platform to Arduino IDE

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 OS.

  1. Download and install the Arduino IDE. You can download it here 
  2. Open Arduino IDE. 
  3. Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
  4. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)
  5. Open Boards manager. Go to Tools -> Board -> Boards Manager…

  6. There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install
  7. The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.

2. Uploading sketch to ESP8266 ESP-12E development board

If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. 

Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture's driver (CH340)  for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.

If you have CP2102 chip then  you need to download the manufacture's driver for this chip and install it in your PC. Driver for MacWindowsLinux or more.. 

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your ESP8266 ESP-12E module into your PC USB port.
  4. Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
  5. Select the correct com port.
  6. Modify, compile and upload one of the sketches attached to your ESP8266 ESP-12E module. If everything went as expected, you should see a “Done uploading” message. 
  7. Press RST button on your ESP8266 ESP-12E module to reset it.
  8. It will take some time before you will get the proper data. Time will be updated first, then date and then the other GPS data (when blue led on GPS module starts to flash).

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 can change coordinates of your waypoint here (positive cardinal numbers N, E; negative S, W): static const double WAYPOINT_LAT = 51.508131, WAYPOINT_LON = -0.128002; // change coordinates of your waypoint

You can also modify the GPS data which you want to display on OLED screen - just comment lines which you do not need and uncomment required. There are speed in MPH or KM/H, date, altitude in FT or M, number of satellites and other data available

Summary

We learnt how to use ESP8266 ESP-12E module with NEO-6M GY-GPS6MV2 GPS module and White 0.96" I2C OLED display module 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.

Libraries:

  • See attachments on the begining of this 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. 
  • 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.
  • Adafruit_ssd1306syp 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. 

Project resources:

  • See attachments on the begining of this project description


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

Published at 10-05-2019
Viewed: 6302 times