NodeMCU ESP8266 12e With GPS & OLED Display

65,769

84

35

Introduction: NodeMCU ESP8266 12e With GPS & OLED Display

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.

3 People Made This Project!

Recommendations

  • Microcontroller Contest

    Microcontroller Contest
  • Automation Contest

    Automation Contest
  • Make it Glow Contest

    Make it Glow Contest

35 Comments

0
Phamaral
Phamaral

5 months ago

After a lot of fiddling i got it to work, but i only get GPS data with
the RX pin disconnected. As soon as i connect it i stop getting data.
Does anybody have a clue on what might be going on here?

1
PriyankC
PriyankC

1 year ago

Dude, You forgot to provide the github URL.

0
code25
code25

1 year ago

Hi sir!

Is there any way to add an SD card to log data? Thanks

0
RüçhanÇataklı
RüçhanÇataklı

1 year 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
vmed
vmed

Tip 2 years ago

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

0
yigitozen
yigitozen

Reply 2 years ago

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

0
vmed
vmed

Reply 2 years 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
yigitozen
yigitozen

Reply 2 years 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
vmed
vmed

Reply 2 years 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
yigitozen
yigitozen

2 years ago

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

0
yigitozen
yigitozen

Question 2 years ago

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

0
iamchinnapat
iamchinnapat

4 years ago

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

image.jpeg
0
vmed
vmed

Reply 2 years 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
Conor M
Conor M

Reply 3 years ago

Same, everything works apart from the gps

0
RicardoS216
RicardoS216

Reply 2 years 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
ZulfanC
ZulfanC

Reply 3 years ago

me too

0
ramgrandhi
ramgrandhi

Question 2 years 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
AdeyemiA7
AdeyemiA7

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