ESP8266 Digital Speedo

The background of this project is that the speedo gear in my Ford KA wore out and that would mean swapping in the spare gearbox I had, and a lot of greasy work. It sounded like not a fun job, but coding up a wemos D1 mini to read a GPS module to display speed did sound like a bit more fun than a gearbox swap. So It was off to ebay to invest in a GPS board to connect to the wemos D1 mini and OLED display I had lying around.

Overview

The hardware consists of a Wemos D1 Mini and its matching 64×48 OLED shield while the software is written in arduino. There should be no reason why you could not modify the code to run on an arduino or with a larger display, but I find the Wemos D1 mini cheap and easy to use so I always have some on hand even if I am not using its built in wifi for the project in mind. The GPS module I used was an U-blox NEO 6M part number GY-GPS6MV2 that was under $8 on ebay.

Wiring the hardware

The Wemos D1 Mini and its stack-able OLED shield make the fist part of the project pretty simple and there is only 4 wires on the GPS module you need to connect too. VCC connects to the 3v3 pin, GND to GND,  RX to D6 and TX to D7.

The Code

The arduino code for this project is located on my git-hub page here

I have tried to put plenty of notes in the code so it should be easy to fiddle. I’m sure the Tiny GPS++ library would support Miles for those of you who like to live in the dark ages but you will need to figure that one out yourself! 

You will also need the following Arduino Libraries to get everything working.

Required libraries include:
Adafruit Graphics
https://github.com/adafruit/Adafruit-GFX-Library
A modified version of Adafruit’s SSD1306 library (This is important as the standard library won’t display on our tiny display correctly)
https://github.com/mcauser/Adafruit_SSD1306
Tiny GPS++
http://arduiniana.org/libraries/tinygpsplus

If you are already using the official Adafruit SSD1306 library for something else, you could place the two modified adafruit files (Adafruit_SSD1306.cpp and Adafruit_SSD1306.h) in the directory where you saved this project and then change line 50 of ESP8266-GPS-Digital-Speedo.ino from #include <Adafruit_SSD1306.h> to #include “Adafruit_SSD1306.h” so the arduino program knows to look locally for the modified files.  

Testing

I found that when testing the project you really need to be outside and moving around. sometimes its quick to find a lock and other times it can tak a few mins. I added a full stop after the KP/H text that only appears when there is a GPS Lock.

Other Notes:

For Head Up Display (HUD) mode you could change line 247 of adafruit_ssd1306.ccp in your library folder as below
change ssd1306_command(SSD1306_COMSCANDEC); to ssd1306_command(SSD1306_COMSCANINC);
Notes on using different fonts https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts

A shout out to these two projects for insperation and bits of code.
http://theelectromania.blogspot.it/2016/03/esp8266-esp-12e-nodemcu-and-ds18b20.html
https://github.com/mkconer/ESP8266_GPS/blob/master/ESP8266_GPS_OLED_Youtube.ino