Creating a custom car performance display is a fantastic project for automotive enthusiasts and tech hobbyists alike. Inspired by integrated systems in modern vehicles and the versatility of platforms like the COBB AccessPort, this guide explores how to build your own Raspberry Pi Obd2 Gauges. This project leverages the power of a Raspberry Pi to tap into your car’s On-Board Diagnostics II (OBD2) system, displaying real-time data on a compact OLED screen. If you’re eager to monitor your vehicle’s performance metrics like boost pressure, engine temperature, and more, this DIY approach offers a customizable and insightful solution.
This project was born out of a desire for a dedicated boost gauge for a Fiesta ST, drawing inspiration from the multi-function displays found in vehicles like the 2016 Subaru WRX. The goal was to create a digital gauge system that was more tailored and less cluttered than existing smartphone apps, while also offering broader data access than standalone pressure transducers. The OBD2 interface became the clear choice for accessing a wide array of standardized vehicle data.
Embarking on this endeavor required learning several new skills, including:
- Python Programming: The primary language for interacting with the OBD2 data and display.
- OLED Display Wiring: Connecting and configuring a 16×2 OLED screen to the Raspberry Pi.
- OBD2 Data Retrieval: Establishing a Bluetooth connection to the car’s OBD2 port and extracting diagnostic information.
- Ignition-Based Power Supply: Designing a reliable power system that turns on and off with the vehicle’s ignition.
- Lightweight Raspberry Pi OS: Configuring a streamlined Raspbian operating system for optimal performance.
Initial discussions in online forums brought up existing solutions like Torque Pro, a popular smartphone app. While functional, these apps can be visually overwhelming and tie up a smartphone, which is often needed for other driving-related functions. Furthermore, the idea of a pressure transducer and digital display, though viable for boost alone, lacked the comprehensive data offered by the OBD2 system. The aim was to tap into the rich stream of information already available within the car’s computer.
Exploring Existing Raspberry Pi Car Computer Projects
Research revealed several projects aiming to create in-car computers for displaying vehicle data. CowFish Studios’ obd-pi project was a notable example, utilizing a multi-color LCD and Python. However, it employed an older Python OBD-II library and outputted to a larger LCD screen, which wasn’t ideal for a compact gauge setup.
CarBerry CarBerry’s offered a more polished system, but it was also designed for a larger LCD head unit display and came at a higher price point, making it less suitable for a budget-conscious DIY project focused on Raspberry Pi OBD2 gauges.
Other projects were either outdated or lacked sufficient documentation, leading to the decision to synthesize the best ideas from these inspirations and forge a unique path forward. The goal was a streamlined, efficient, and cost-effective Raspberry Pi OBD2 gauge system.
Essential Components for Your Raspberry Pi OBD2 Gauge
The Raspberry Pi 2 was newly released at the project’s inception, making it a perfect choice for its improved processing power. A comprehensive starter kit, like the Vilros Raspberry Pi 2 Ultimate Starter Kit (newer Pi 3 kit linked), provided many necessary components for GPIO wiring and basic electronics work.
In addition to the starter kit, these components are crucial for building your Raspberry Pi OBD2 gauges:
- Raspberry Pi: The brains of the operation. Raspberry Pi 3 or 4 are recommended for better performance.
- 16×2 OLED Display: The Adafruit 16×2 character OLED display offers excellent visibility, even in direct sunlight, and a display color that complements many car interiors for an OEM look.
- OBD-II Bluetooth Adapter: A quality Bluetooth OBD2 adapter is essential for reliable data retrieval. Avoid cheap knock-offs as they can be unreliable.
- Bluetooth USB Adapter (if needed): Some Raspberry Pi models have built-in Bluetooth. If not, a USB Bluetooth adapter is required.
- Jumper Wires: For connecting the OLED display and other components to the Raspberry Pi.
- Power Supply Components: Including a voltage regulator to step down the car’s 12V power to 5V for the Raspberry Pi, and potentially a UPS for safe shutdown.
- Enclosure Materials (optional): Perspex plastic or similar for creating a housing for the OLED display.
Wiring the OLED Display to the Raspberry Pi
With basic wiring skills acquired from the starter kit tutorials, the next step was connecting the OLED display. The Adafruit 16×2 OLED was chosen for its minimal wiring needs (no backlight required for OLED), sunlight readability, and color matching automotive displays.
However, wiring documentation specifically for this OLED model with Raspberry Pi was scarce. Using Adafruit’s general LCD wiring guides LCD documentation as a starting point, initial attempts unfortunately resulted in a fried display. After obtaining a replacement, a valuable forum post on raspberrypi.org provided crucial insights for successful wiring. The second attempt was successful, highlighting the importance of detailed and accurate wiring for Raspberry Pi OBD2 gauges.
For comprehensive wiring diagrams and a step-by-step guide for connecting your OLED display, refer to the obdPi documentation. Proper wiring is paramount for a functional Raspberry Pi OBD2 gauge setup.
Establishing Bluetooth and Serial Communication
With the OLED display operational, the next challenge was enabling communication between the Raspberry Pi and the Bluetooth OBD2 adapter. This involved configuring Raspbian to recognize the Bluetooth adapter and establish a serial connection for data transfer.
Finding specific documentation for this exact scenario – Bluetooth OBD2 adapter to Raspberry Pi via Bluetooth USB adapter in a headless Raspbian environment – proved difficult. However, through experimentation and research, a working configuration was achieved. (Detailed instructions can be found in the “Bluetooth Setup” and “Serial Connection” sections of the documentation).
In essence, the process involves pairing the Bluetooth OBD2 adapter with the Bluetooth USB adapter using the Raspberry Pi’s Bluetooth utilities. This Bluetooth connection is then mapped to a virtual serial port, accessible in Python using the pyserial library. Automating this pairing on startup was accomplished by adding commands to the /etc/rc.local
startup file, ensuring seamless operation of the Raspberry Pi OBD2 gauges every time the car is turned on.
Python Scripting for OBD2 Data Acquisition and Display
With the display and Bluetooth communication established, Python scripts were needed to retrieve OBD2 data and display it on the OLED screen. Initially, efforts focused on understanding the fundamentals of the OBD2 interface and writing basic scripts.
However, the python-OBD library proved to be a game-changer. This well-structured and actively maintained library simplified OBD2 interaction significantly. The library’s author is also highly responsive, providing excellent support and updates.
Leveraging python-OBD, a functional script was quickly developed to pull data and display it on the OLED screen. While initial iterations were not perfect, as seen by the flickering display in early tests, they demonstrated the core functionality of the Raspberry Pi OBD2 gauges. The focus then shifted to refining the code and addressing the power supply challenges.
Powering the Raspberry Pi in a Car Environment
Reliable power is crucial for any in-car electronics project. Mausberry Circuits was a frequently recommended company for Raspberry Pi car power solutions. Their 2A car power switch car-based power supplies was ordered, designed to provide power when the ignition is on and initiate a safe shutdown when the ignition is turned off. This seemed like the ideal solution for the Raspberry Pi OBD2 gauge project.
The Mausberry car switch was wired into the car’s fuse box using fuse taps, drawing power from both an ignition-dependent and a constant 12V source.
Initial tests appeared promising, but the switch consistently cut power to the Raspberry Pi after about 30 seconds, forcing abrupt shutdowns. Extensive troubleshooting, including different fuse combinations, wiring, and direct battery connection, yielded no improvement. Suspecting a faulty switch, multimeter testing confirmed that the Mausberry switch itself was the source of the issue.
Attempts to contact Mausberry customer support went unanswered. Despite this setback, a second 3A Mausberry switch was ordered, but it exhibited the same power cutoff issues. Frustration grew, and an alternative solution was sought.
Fortunately, the UPS PIco from Pimodules emerged as a viable alternative. Direct communication with Pimodules confirmed its suitability for car applications. The UPS PIco was ordered and, upon arrival, impressed with its build quality and comprehensive set up guide.
The UPS PIco utilizes a small LiPo battery to provide backup power during ignition shutdown, enabling a safe shutdown sequence. It also offers optional cooling fan support and monitoring of voltage and battery levels. Status LEDs provide visual feedback on power source. Configuration was straightforward, and within an hour, the UPS PIco was functioning flawlessly, finally providing a reliable power solution for the Raspberry Pi OBD2 gauges.
In-Car Installation and Testing
With a reliable power solution secured, the system was ready for in-car installation. Since the UPS PIco replaced the Mausberry voltage converter, a separate voltage regulator this was needed to step down the car’s 12V to 5V for the Raspberry Pi.
The OLED display cable was carefully routed through the dashboard from the glovebox to the gauge cluster area.
The OLED display was positioned beneath the main gauges for easy viewing and cable routing.
Finally, a test drive confirmed the successful installation. The Raspberry Pi OBD2 gauges system was fully functional and left in place for several weeks of testing, revealing only minor bugs that needed refinement.
Creating a Custom OLED Display Housing
With the core functionality complete, the final step was to improve the aesthetics of the installation. The exposed green OLED PCB contrasted with the car’s dashboard. A simple housing made from perspex plastic was constructed to provide a more integrated and finished look. This also provided an opportunity to use a Dremel tool for precision cutting.
Project Reflections and Future Enhancements
This journey of creating Raspberry Pi OBD2 gauges was a significant learning experience. What began as a simple idea evolved into a complex and time-consuming project, filled with both frustrations and triumphs. Countless hours were spent in the garage and at the computer, navigating the intricacies of Python and electronics.
This project demonstrates the value of perseverance and the rewards of seeing a challenging project through to completion. It’s a testament to the potential of the Raspberry Pi for automotive applications and the satisfaction of building custom car modifications.
Future plans for this Raspberry Pi OBD2 gauge project include refining the Python code for smoother data display, exploring additional OBD2 parameters to monitor, and potentially integrating more advanced features.
Thank you for following this project!
[