NodeMCU ESP8266 12e With GPS & OLED Display

52,633

74

32

About: EZtech electronics

In this Instructable I will describe how to hookup a Ublox 6m GPS module and an OLED display to the NodeMCU or ESP8266-12e wifi module to display your current GPS location and other info.

Check out my Youtube Video describing this. Youtube Video

Step 1: Ingredients - What You Will Need

In this Instructable I will describe how to hookup a Ublox 6m GPS module and an OLED display to the NodeMCU or ESP8266-12e wifi module to display your current GPS location and other info. With a little extra programming you could use it to broadcast your GPS location to the internet using the wifi on the esp8266, and upload it to ioadafruit or another MQTT cloud server. Maybe attach it to your dog a see where and how much he roams around the yard!

Step One: The ingredients

1. You'll need an ESP8266 - e12 wifi module

2. An OLED display ($5- $10 from Ebay)

3. A Ublox 6m GPS receiver or similiar model

4. A breadboard and some jumper wires

Step 2: Hooking It Up

1. First place the ESP8266 on a breadboard

2. Connect a jumper wire from the Ground and Output VCC of the ESP to the power and ground rails of the breadboard.

3. Connect the Ground and VCC of the GPS and the Oled Display to the power rails of the breadboard. Make sure Ground is to (Ground -) and VCC is to the (Red +)

4. Connect the SCL Pin of the Oled display to the ESP D1 pin (the Yellow wire in the picture), and connect the SDA Pin of the Oled display to D2 pin (the Blue wire in the picture) These are your I2C communication connections.

5. Connect the TX pin of the GPS to the D6 pin of the ESP (the Blue wire), and connect the RX pin of the GPS to the D7 pin of the ESP (the white wire) These are your Serial communication pins. You could choose just about any data pins you like, but you will also have to make the necessary changes in the code.

Here is a link to a pinout diagram of the ESP-12e Board to assist you.

Acrobotic Pinout

Step 3: Upload the Code

First, I assume you have the Arduino IDE already installed (preferably 1.6.4 or later) and that you have installed all the necessary libraries such as: TinyGPS plus, Software Serial, and the Adafruit OLED display library. You can get these from Github.

If not, install the latest version of the Arduino IDE and the libraries first.

I also assume you have installed all the necessary drivers for your computer to recognize the ESP8266, if not Adafruit has an excellent tutorial here. Adafruit ESP8266 Tutorial This is crucial if this is your first time using the ESP8266

Next, go to github and download the code and run it in the Arduino IDE.

Enter your latitude and longitude into the area of code "Home_LAT =" and "Home_LNG=" below

Compile it and upload to your NodeMcu esp-12e, In the Arduino IDE be sure to select your correct board (ESP-12E Module in my case) and the Memory size - 4M(3M SPIFFS)

Go for a walk or drive and watch your GPS position update, remember to keep your eyes on the road.

4 People Made This Project!

Recommendations

  • Arduino Contest 2019

    Arduino Contest 2019
  • Woodworking Contest

    Woodworking Contest
  • Classroom Science Contest

    Classroom Science Contest

32 Discussions

0
None
RüçhanÇataklı

7 days ago

hi, ı want to made with gps coordinates and speedometer . this project similar, but only difference ı use 20x4 lcd screen. I need code .So can you help to me ?

1
None
vmed

Tip 4 months ago

Hi, how can I set the correct time? It gives me one hour less

4 replies
0
None
yigitozenvmed

Reply 3 months ago

Hey, displayed time is GMT. (In my case three hours less.)
Add your local time zone for correct time.

0
None
vmedyigitozen

Reply 3 months ago

Hi, thanks for answering. In which line of the code should I change the time, in my case it is Spain. Thank you

0
None
yigitozenvmed

Reply 3 months ago

Please find the matching lines of code and replace with the following:

if((gps.time.hour()+1)%24){display.print("0");}
display.print((gps.time.hour()+3)%24); // GPS time UTC
display.print(":");
if(gps.time.minute()<10){display.print("0");}
display.print(gps.time.minute()); // Minutes
display.print(":");
if(gps.time.second()<10){display.print("0");}
display.println(gps.time.second()); // Seconds

This will also turn 5:8:12 to 05:08:12

0
None
vmedyigitozen

Reply 3 months ago

Sorry to bother you but the code does not have those lines.

#include // Tiny GPS Plus Library
#include // Software Serial Library so we can use other Pins for communication with the GPS module
#include // Adafruit oled library for display
Adafruit_ssd1306syp display(11,10); // OLED display (SDA to Pin 11), (SCL to Pin 10)

static const int RXPin = 12, TXPin = 13; // Ublox 6m GPS module to pins 12 and 13
static const uint32_t GPSBaud = 9600; // Ublox GPS default Baud Rate is 9600
const double Home_LAT = 39.44722; // Your Home Latitude
const double Home_LNG = -0.39192; // Your Home Longitude
TinyGPSPlus gps; // Create an Instance of the TinyGPS++ object called gps
SoftwareSerial ss(RXPin, TXPin); // The serial connection to the GPS device
void setup()
{
display.initialize(); // Initialize OLED display
display.clear(); // Clear OLED display
display.setTextSize(1); // Set OLED text size to small
display.setTextColor(WHITE); // Set OLED color to White
display.setCursor(35,20); // Set cursor to 0,0
display.println("GPS System");
display.setCursor(45,30);
display.println("VICTOR");
//display.println(TinyGPSPlus::libraryVersion());
display.update(); // Update display
delay(3000); // Pause 1.5 seconds
ss.begin(GPSBaud); // Set Software Serial Comm Speed to 9600
}
void loop()
{
display.clear();
display.setCursor(0,0);
display.print("Latitud : ");
display.println(gps.location.lat(), 5);
display.print("Longitud : ");
display.println(gps.location.lng(), 5);
display.print("Satelites : ");
display.println(gps.satellites.value());
display.print("ALtura : ");
display.print(gps.altitude.meters());
display.println("m");
display.print("Time UTC+1: ");
display.print(gps.time.hour()); // GPS time UTC
display.print(":");
display.print(gps.time.minute()); // Minutes
display.print(":");
display.println(gps.time.second()); // Seconds
display.print("Heading : ");
display.println(gps.course.deg());
display.print("Velocidad : ");
display.println(gps.speed.kmph());
unsigned long Distance_To_Home = (unsigned long)TinyGPSPlus::distanceBetween(gps.location.lat(),gps.location.lng(),Home_LAT, Home_LNG);
display.print("Km to Home: "); // Have TinyGPS Calculate distance to home and display it
display.print(Distance_To_Home);
display.update(); // Update display
delay(200);
smartDelay(500); // Run Procedure smartDelay
if (millis() > 5000 && gps.charsProcessed() < 10)
display.println(F("No GPS data received: check wiring"));
}
static void smartDelay(unsigned long ms) // This custom version of delay() ensures that the gps object is being "fed".
{
unsigned long start = millis();
do
{
while (ss.available())
gps.encode(ss.read());
} while (millis() - start < ms);
}

0
None
yigitozen

3 months ago

Great project, thanks. Note that, "KM to Home" is actually calculated and displayed in meters not KMs.

0
None
yigitozen

Question 3 months ago

Where exactly did you buy your OLED display. Mine is quite dim.

0
None
iamchinnapat

2 years ago

I used your code with my nodemcu and neo-m8n. It's can compile and upload but nothing happen.

image.jpeg
4 replies
0
None
vmediamchinnapat

Reply 4 months ago

The same thing happens to me, everything works even when the gps flashes, but no value works on the display. I have tried changing digital pins even with an arduino one in its corresponding TX and RX

0
None
RicardoS216Conor M

Reply 1 year ago

Tthere is a problem in instructions about TX and RX connections, TX in GPS must be conected to D7, and RX in GPS must be conected to D6.

0
None
ramgrandhi

Question 6 months ago

Thanks for the write-up. I just blew up my d1 mini :(

Keeping it aside, may i have the link to Github codefile you were referin gto?

0
None
AdeyemiA7

10 months ago

Please how do I know my GPS module is working put it out for several hours but not blinking LED to show its tracked satellite even though it prints on my serial terminal NMEA sentence with a lot of commas I tried boosting the battery power on the module but put the voltage on the wrong pin still printing NMEA sentence with a lot of commas

0
None
RicardoS216

1 year ago

Hello, I´m doing everything, step by step, but when I´m finishing compilation, I got this error:

collect2.exe: error: ld returned 1 exit status

Could you help me?, thanks.

1 reply
0
None
RicardoS216RicardoS216

Reply 1 year ago

I resolved the problem reported, it was about library incomplete, the program compiles very well. But, there is a problem in instructions about TX and RX connections, TX in GPS must be conected to D7, and RX in GPS must be conected to D6. Thanks so much for the project and information published, it was so usefull.

0
None
Jana Shree

1 year ago

When I use tinygps library i am getting this in my serial monitor please do help

I have surfed net and done many things but i could not correct it

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

0
None
RAJXDAVIEL

1 year ago

can i add a sd card to log the data