4

members

Medium Basics: Project 081f ESP8266 ESP-12E module, NEO-6M GY-GPS6MV2 GPS module - GPS clock web server

of Acoptex.com in ESP8266 ESP-12

Basics: Project 081f

Project name: ESP8266 ESP-12E module, NEO-6M GY-GPS6MV2 GPS module - GPS clock web server

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, web server, display on Google Maps, API key for Google Maps

Attachments: sketch1, sketch2 and 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. 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

General

We will learn how to use ESP8266 ESP-12E module with NEO-6M GY-GPS6MV2 GPS 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.

A simple local web server is created using NodeMCU and the location details are updated on its webpage. 

Project sequence:

  1. The GPS module receives data from satellites;
  2. ESP8266 ESP-12E WiFi module starts webserver and waits for a client to get connected to the webserver.
  3. Once client is connected to the webserver, ESP8266 ESP-12E WiFi module sends location details to connected client. 
  4. The location details are displayed on a simple webpage designed using HTML.

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


 

3V3
Vcc
GND
GND
D1 (GPIO5)
RX
D2 (GPIO4)
TX

 

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

3V3            VCC
GND           GND
D1 (GPIO5) RX
D2 (GPIO4) TX

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. Getting the API key for Google Maps

There are three steps to creating a Google map with a marker on your web page:

  1. Create an HTML page (you can find aout how to do it here);
  2. Add a map with a marker (you can find aout how to do it here);
  3. Get an API key (we will show you how to get it).

You need a web browser. Choose a well-known one like Google Chrome (recommended), Firefox, Safari or Internet Explorer, based on your platform.

So, how to get the API?

  1. You need to have a GMAIL account and be logged in to it.
  2. Go to the Google Cloud Platform Console.
  3. Tick the box on and click on Agree and Continue.
  4. Create or select a project. Click on Create.
  5. Type the project name (you can have up to 12 projects) and click on Create button.
  6. Click on +ENABLE APIS AND SERVICES button to enable the API and any related services.
  7. Click on Maps JavaScript API.
  8. Click on Enable button.
  9. Click on Credentials.
  10. Click on Create Credentials button and select API key.
  11. The API key will be created.
  12. Click on Close button.
  13. You can rename and set the API key restrictions. 
  14. Click on Save button.
  15. Copy the entire API code from this page to your text editor.
  16. Replace the value of the YOUR_API_KEY parameter in the URL with your own API key (that's the API key that you've just obtained) in sketch2.
  17. To prevent quota theft and secure your API key, see Using API Keys. (Optional) Enable billing. See Usage Limits for more information.

3. 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. Open, modify. compile and upload one of the sketches (sketch1sketch2attached to your ESP8266 ESP-12E module. If everything went as expected, you should see a “Done uploading” message. You will need to modify sketch2 with your API key to display Google Maps on your web page. Replace the SSID and password in the sketch1 and sketch2 with your own data.
  7. Open the Serial Monitor at 9600 baud. Press RST button on your ESP8266 ESP-12E module to reset it.


  8. You will see the local IP address of your Nodemcu (in our case - 192.168.0.121).
  9. Open any browser from a device (PC, cell phone, tablet) that is connected to the same router that your Nodemcu is. Type the IP address (we had 192.168.0.121) which you have seen in Arduino IDE serial monitor and press Enter button.
  10. If you use sketch1 you will see the table with GPS data and link to Google Maps. When you click on it the position of your Nodemcu will be displayed on Google Maps.
  11. If you use sketch2 you will see the table with GPS data and Google Maps with the position of your Nodemcu.
  12. 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 will need to modify sketch2 with your API key to display Google Maps on your web page.

Replace the SSID and password in the sketch1sketch2 with your own data.

The URL format which was used to display position :

http://maps.google.com/maps?&z={INSERT_MAP_ZOOM}&mrt={INSERT_TYPE_OF_SEARCH}&t={INSERT_MAP_TYPE}&q={INSERT_MAP_LAT_COORDINATES}+{INSERT_MAP_LONG_COORDINATES}

You can read more about Google map parameters here.
Google Maps show the message "For development purposes only" when you try to show it on your webpage because Google Maps is no longer free. You have to associate a credit card so that you can get billed if your site has requests that exceed the $300 credit they give you monthly for free. That is why you get the watermarked maps. For more information, see here.
A common problem with the new billing system is that you now have to activate each API separately. They all have different pricing (some are even free), so Google makes a point of having you enable them individually for your domain. If you're still getting a restricted usage message after you've enabled billing, find out what API you need exactly for the features you want to offer, and check if it's enabled. The API settings are annoyingly hard to find.
  1. Go here.
  2. Then you select your project in the dropdown.
  3. Go to library on the left pane.
  4. Browse the available APIs and enable the one you need.
Summary

We learnt how to use ESP8266 ESP-12E module with NEO-6M GY-GPS6MV2 GPS 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

Project resources:

  • See attachments on the begining of this project description


Other projects of Acoptex.com

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 09-05-2019
Viewed: 681 times