GPS speedometer and location display
Build it step by step
0 of 5 doneWire the GPS
VCC to VIN, GND, GPS TX to GPIO16, GPS RX to GPIO17.
Wire the OLED
SDA 21, SCL 22, 3V3 and GND.
Upload
Upload and power it from a USB power bank.
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.
Ride or walk
Walk, cycle or ride as a passenger and watch the speed.
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
Wiring
| From | To | Why |
|---|---|---|
| GPS VCC / GND | ESP32 VIN (5 V) / GND | Module power (it has a 3.3 V regulator) |
| GPS TX | ESP32 GPIO16 (RX2) | NMEA sentences in |
| GPS RX | ESP32 GPIO17 (TX2) | Only needed to change settings |
| OLED SDA / SCL / VCC / GND | GPIO21 / GPIO22 / 3V3 / GND | Display |
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.
| Check | Expected |
|---|---|
| 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) |
| Walking | About 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 →
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.
