Projects / GPS speedometer and location display

GPS speedometer and location display

Intermediate1.3 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. ESP32GPS12.97N

    Wire the GPS

    VCC to VIN, GND, GPS TX to GPIO16, GPS RX to GPIO17.

  2. ESP3211.1 mASSD1306

    Wire the OLED

    SDA 21, SCL 22, 3V3 and GND.

  3. ESP32USB

    Upload

    Upload and power it from a USB power bank.

  4. ESP32

    Go outside

    Take it outdoors with a clear view of the sky. The first fix can take 1 to 5 minutes. The module's LED blinks once a second when it has a fix.

  5. ESP32

    Ride or walk

    Walk, cycle or ride as a passenger and watch the speed.

In short

How do you build a GPS speedometer and location display?

A NEO-6M GPS module feeds an ESP32, which shows speed, satellites, latitude and longitude on an OLED. You need ESP32 DevKit V1, GPS module NEO-6M, SSD1306 OLED Display, USB A to micro-USB cable (data) and Jumper wires female to female (40 pcs). It takes 5 steps and about 75 minutes.

Level
Intermediate
Time
About 75 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
GPS VCC / GNDESP32 VIN (5 V) / GNDModule power (it has a 3.3 V regulator)
GPS TXESP32 GPIO16 (RX2)NMEA sentences in
GPS RXESP32 GPIO17 (TX2)Only needed to change settings
OLED SDA / SCL / VCC / GNDGPIO21 / GPIO22 / 3V3 / GNDDisplay

Code

Arduino IDE with the ESP32 board package. Install "TinyGPSPlus" by Mikal Hart and "Adafruit SSD1306".

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <TinyGPSPlus.h>
#include <Adafruit_SSD1306.h>

TinyGPSPlus gps;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, 17);   // NEO-6M default speed
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(SSD1306_WHITE);
}

void loop() {
  while (Serial2.available()) gps.encode(Serial2.read());
  static unsigned long drawn = 0;
  if (millis() - drawn < 500) return;
  drawn = millis();
  oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0);
  oled.print("Sats: "); oled.println(gps.satellites.isValid() ? gps.satellites.value() : 0);
  if (gps.location.isValid() && gps.location.age() < 2000) {
    oled.setTextSize(3); oled.setCursor(0, 14);
    oled.print(gps.speed.kmph(), 0); oled.setTextSize(1); oled.println(" km/h");
    oled.setCursor(0, 46); oled.print(gps.location.lat(), 5); oled.print(", "); oled.print(gps.location.lng(), 5);
  } else {
    oled.setCursor(0, 24); oled.print("Waiting for a fix...");
    if (millis() > 10000 && gps.charsProcessed() < 10) { oled.setCursor(0, 40); oled.print("No data: check TX wire"); }
  }
  oled.display();
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Indoors"Waiting for a fix", 0 to 3 satellites
Outdoors after a few minutes6 or more satellites, your location to 5 decimals
Standing still0 to 2 km/h (small GPS jitter)
WalkingAbout 4 to 6 km/h

If it does not work

"No data: check TX wire"

GPS TX must go to GPIO16. Check the module LED is on.

Never gets a fix

Go fully outdoors and wait 5 minutes. A cold start needs open sky.

Speed jumps while still

Show 0 when the speed is below 2 km/h.

Safety

Never look at the screen while riding or driving.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the GPS speedometer and location display?

ESP32 DevKit V1, GPS module NEO-6M, SSD1306 OLED Display, USB A to micro-USB cable (data) and Jumper wires female to female (40 pcs). GPS module NEO-6M: Comes with a ceramic patch antenna.

How long does the GPS speedometer and location display take to build?

About 75 minutes for a intermediate maker, in 5 steps.

How do I know the GPS speedometer and location display works?

Indoors: "Waiting for a fix", 0 to 3 satellites. Outdoors after a few minutes: 6 or more satellites, your location to 5 decimals. Standing still: 0 to 2 km/h (small GPS jitter).

No data: check TX wire: what should I check?

GPS TX must go to GPIO16. Check the module LED is on.

Never gets a fix: what should I check?

Go fully outdoors and wait 5 minutes. A cold start needs open sky.

Speed jumps while still: what should I check?

Show 0 when the speed is below 2 km/h.

Safety: what should I check?

Never look at the screen while riding or driving.