Skip to content

StanKatsyuk/esp32speedometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Here's the complete markdown formatted specifically for GitHub:

ESP32 GPS Digital Speedometer

A high-precision digital speedometer built with ESP32, featuring a color OLED display and GPS functionality. This project provides accurate speed readings, trip tracking, and a demo mode for testing along with a custom boot screen. My 1971 BMW 2002 has a mechanically driven speedometer and it's not always accurate. I needed something I can use on a per-need basis. I also wanted to try out working with a NEO-6M module which is just a few bucks online.

LILYGO T2 ESP32

Features

  • Customizable boot screen
  • Real-time GPS speed tracking
  • Configurable "High Speed" warning to alert driver when exceeding specified speed
  • Bright OLED color display (96x64 pixels)
  • Trip meter with reset functionality
  • Satellite acquisition indicator
  • Demo mode for testing
  • Average speed calculation
  • Total distance tracking
  • Battery powered operation (~3-4 hours on 450mAh LiPo)

Wiring

Hardware Requirements

  • LILYGO T2 V1.6 ESP32 Development Board with OLED Display (SSD1331)
  • NEO-6M GPS Module
  • 3-Position SPDT Slide Switch (for trip/odometer toggle)
  • 3-Position SPDT Slide Switch (for battery power)
  • 10kΩ Resistors
  • 3.7V LiPo battery (450mAh tested)
  • Jumper wires
  • USB-C cable for programming

Software Requirements

Arduino IDE Dependencies

  • ESP32 board support TTGO T2
  • Adafruit_GFX library
  • Adafruit_SSD1331 library
  • TinyGPS++ library

Boot Screen Conversion Script Dependencies

  • Python 3.x
  • PIL (Python Imaging Library)
  • NumPy

Wiring Diagram

Display Connection (Built into LILYGO T2)

ESP32 Pin | Display Pin
----------|------------
GPIO14    | SCLK
GPIO13    | MOSI
GPIO15    | CS
GPIO16    | DC
GPIO4     | RST

GPS Module Connection

ESP32 Pin | GPS Module
----------|------------
GPIO12    | TX
GPIO2     | RX
3.3V      | VCC
GND       | GND

Trip Switch Connection

ESP32 Pin     | Switch
--------------|------------
GPIO34        | Outside Pin
GND           | Middle Pin
3.3V --- 10kΩ | Outside Pin (GPIO34)

Installation

  1. Install the necessary ESP32 board support into your Arduino IDE
  2. Install required libraries through Arduino Library Manager:
    • Adafruit_GFX
    • Adafruit_SSD1331
    • TinyGPS++
  3. Clone this repository
  4. Open esp32-gps-speedometer.ino in Arduino IDE
  5. [Optional] Use image_to_bitmap.py to convert an image to bitmap - See Custom Boot Screen
  6. Select "ESP32 Dev Module" as your board
  7. Upload the code to your ESP32

Custom Boot Screen

To create your own boot screen:

  1. Install Python dependencies:
pip install pillow numpy
  1. Prepare your image:

    • Size: Will be resized to 96x64 pixels
    • Format: Any format supported by PIL (PNG, JPG, etc.)
  2. Convert the image:

python image_to_bitmap.py input_image.png output.h
  1. Replace the contents of image_data[] array in the main code with the generated bitmap data

Usage

  1. Power up the device via USB or battery power
    • Battery operation: Use the power rocker switch to turn on/off
    • USB operation: Device powers on automatically
  2. Wait for the custom logo splash screen
  3. Device will show satellite acquisition screen
  4. Once satellites are acquired (usually 4+ satellites), speed will display
  5. Use the slide switch to toggle between total and trip distance
  6. Press the IO36 button on TTGO to enter/exit demo mode

Operating Modes

  • Normal Mode: Displays actual GPS speed and distance
  • Trip Mode: Shows resettable trip distance
  • Demo Mode: Simulates speed for testing (useful for development)

Power Management

The device supports two power modes:

  • USB-C powered: Automatic power-on when connected
  • Battery powered: 3.7V LiPo with ~3-4 hours runtime on 450mAh battery
    • Built-in charging when USB is connected
    • Power rocker switch for battery operation

Technical Details

  • Speed Range: 0-120 MPH (configurable in code)
  • GPS Update Rate: 1Hz
  • Display Resolution: 96x64 pixels
  • Power Supply: 5V USB or 3.7V Li-Po battery
  • Current Consumption: ~100mA typical
  • Battery Life: ~3-4 hours on 450mAh LiPo

Future Development

  • Design 52mm gauge pod enclosure
  • Improve power efficiency
  • Add configuration options for display preferences
  • Create simple webapp for managing system settings
  • Implement speed logging capability

License

MIT

Acknowledgments

  • TTGO for the T2 ESP32 board design
  • Adafruit for the display libraries
  • Mikal Hart for TinyGPS++

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors