Introduction
In the summer of 2015, while researching boost gauges for my Fiesta ST, a review of the 2016 Subaru WRX caught my attention. The reviewer highlighted the WRX’s central multi-function display, showcasing real-time vehicle data such as boost pressure and fuel economy. This feature, alongside the functionality of devices like the COBB AccessPort, sparked an idea: could I build my own in-car data display using a Raspberry Pi?
This thought quickly evolved into a project: creating a Raspberry Pi car computer that interfaces with my car’s OBD2 system. It seemed like an excellent opportunity to learn new skills and create a custom solution tailored to my needs. The initial plan involved several key learning areas:
- Python Programming: Mastering Python to control the system and process data.
- OLED Display Integration: Learning to wire and program a 16×2 OLED display for data output.
- OBD-II Data Retrieval: Understanding how to access vehicle diagnostics data via Bluetooth OBD2 adapters.
- Ignition-Based Power Supply: Designing a reliable power circuit that turns on and off with the car’s ignition.
- Lightweight Raspbian Configuration: Setting up a streamlined, headless Raspbian operating system.
Sharing this initial concept on online forums and boards yielded valuable feedback, including suggestions and alternative approaches.
One common suggestion was to simply use the Torque Pro app, a popular Android application already capable of displaying OBD2 data. While Torque Pro is feature-rich, I found its interface somewhat cluttered for my personal preferences. Moreover, using my phone as a dedicated display would mean mounting my 5″ Nexus to the windshield, potentially obstructing my view and tying up my phone which I often use for calls and music while driving.
Another suggestion involved using a pressure transducer directly connected to the Raspberry Pi to measure boost pressure. While feasible, my aim was broader than just monitoring boost. The OBD-II interface offered a standardized and readily accessible gateway to a wide spectrum of vehicle data, far beyond just boost readings. This versatility and wealth of information made the OBD2 route much more appealing for a comprehensive Raspberry Pi car computer project.
Researching Existing Raspberry Pi Car Computer Projects
To gain a better understanding and avoid reinventing the wheel, I researched existing Raspberry Pi car computer projects focused on displaying vehicle diagnostics and status data. One of the most documented projects was from CowFish Studios. Their project utilized a multi-color LCD and an older Python OBD-II library. While informative, their display choice and software were not exactly what I envisioned for my build.
CarBerry offered another promising project, boasting a polished and seemingly high-quality system. However, like CowFish Studios, CarBerry was designed to output to an LCD head unit. Furthermore, the cost, including shipping and necessary accessories, exceeded my budget for this DIY learning project.
Several other projects surfaced during my research, but many appeared outdated or lacked sufficient documentation to be practically useful. Ultimately, I decided to synthesize the best ideas and approaches from these projects, using them as inspiration and guidelines rather than direct templates. My goal was to create a unique Raspberry Pi car computer tailored to my specific requirements, focusing on an OLED display and a streamlined, efficient system.
Parts and Supplies for Your Raspberry Pi Carputer
As I embarked on this project, the Raspberry Pi 2 had just been released. I opted for the Vilros Raspberry Pi 2 Ultimate Starter Kit (the link directs to a newer Pi 3 kit, but the concept remains the same). Being new to electronics wiring, the starter kit seemed like a comprehensive package, providing almost everything needed to begin experimenting with Raspberry Pi GPIO wiring.
In addition to the starter kit, I procured the following components to complete my Raspberry Pi car computer:
- Adafruit 16×2 Character OLED Display: For clear and efficient data display, especially in sunlight.
- Bluetooth OBD-II Adapter: To wirelessly interface with the car’s OBD2 port and retrieve data.
- Bluetooth USB Adapter: To enable Bluetooth connectivity on the Raspberry Pi.
- Mausberry Car Power Supply Switch (Initially): For ignition-controlled power management (later replaced).
- UPS PIco (Alternative Power Supply): A more reliable solution for in-car Raspberry Pi power management.
- 12V to 5V Voltage Regulator: To step down the car’s 12V power to the 5V required by the Raspberry Pi.
- Various Wires, Connectors, and Breadboard: For prototyping and wiring the electronic components.
- Perspex Plastic Sheet: For creating a custom housing for the OLED display.
Important Note: When selecting an OBD-II Bluetooth adapter, invest in a quality unit. My initial cheap knock-off adapter proved unreliable and was eventually replaced with a more reputable brand. A reliable OBD2 adapter is crucial for consistent data communication with your Raspberry Pi car computer.
Wiring the OLED Display to the Raspberry Pi
With the Raspberry Pi starter kit providing a foundation in basic wiring, I moved on to integrating the OLED display. While numerous LCD options exist for the Raspberry Pi, I chose the Adafruit 16×2 character OLED display for several compelling reasons. Firstly, OLED technology eliminates the need for a separate backlight, simplifying wiring. Secondly, OLED displays offer superior readability in direct sunlight, essential for an in-car display. Finally, the green display color of this particular OLED model closely matched the aesthetics of the Fiesta ST’s gauge cluster, aiming for a cohesive, OEM-like appearance.
However, wiring documentation specifically for this OLED display with the Raspberry Pi was scarce. While Adafruit provides excellent tutorials for their LCDs, OLED support seemed less comprehensive. Undeterred, I proceeded, using the LCD wiring documentation as a general guideline.
My initial attempt at wiring resulted in a regrettable outcome – a fried display. After a quick exchange with Amazon, a replacement display was on its way, giving me a second chance. While awaiting the new OLED, I discovered a helpful forum post on raspberrypi.org specifically addressing wiring this OLED display. Following the advice in the forum, my second wiring attempt was successful.
For a detailed, step-by-step guide and wiring diagrams for connecting an OLED display to your Raspberry Pi car computer, please refer to the obdPi documentation.
Establishing Bluetooth and Serial Connections for OBD2 Data
With a functional OLED display, the next step was to enable communication between the Raspberry Pi and the Bluetooth OBD-II adapter. This involved configuring Raspbian to recognize and utilize the Bluetooth connection for serial data transfer.
This phase presented a significant learning curve, as finding comprehensive documentation for this specific scenario—Bluetooth OBD-II adapter to Bluetooth USB adapter to Python script within a headless Raspbian environment—proved challenging. Nevertheless, through persistent experimentation and research, I successfully established a working configuration. (Detailed instructions on Bluetooth setup and serial connection can be found in the “Bluetooth Setup” and “Serial Connection” sections of the documentation).
In essence, the process involves pairing the Bluetooth OBD-II adapter with the Bluetooth USB adapter connected to the Raspberry Pi using the Raspberry Pi’s Bluetooth utility. This Bluetooth connection is then mapped to a virtual serial port, which becomes accessible within Python using the pyserial library.
To automate this connection process upon system startup, entries were added to the /etc/rc.local
startup file, ensuring the Bluetooth pairing and serial port mapping are established automatically each time the Raspberry Pi car computer boots.
Python Scripts for OBD-II Data Acquisition and Display
With the display and communication infrastructure in place, the core task was to develop Python scripts to retrieve OBD-II data from the car and display it on the OLED screen.
My initial approach involved attempting to directly interact with the OBD-II interface using basic Python commands. While I achieved some limited success, it quickly became apparent that a more robust and efficient solution was needed. This led me to discover the invaluable python-OBD library.
python-OBD stood out due to its excellent organization, comprehensive features, and active development. The library’s author is highly responsive to user feedback, feature requests, and questions, fostering a supportive community around the project.
Leveraging python-OBD, I rapidly developed a functional script that successfully retrieved OBD-II data and displayed it on the OLED screen. The initial results, while promising, revealed areas for improvement in code efficiency and display smoothness, as seen in the flickering display.
Despite the initial imperfections, this milestone demonstrated the core functionality of the Raspberry Pi car computer, paving the way for the next significant challenge: providing reliable in-car power to the system.
Powering the Raspberry Pi Car Computer In-Car
Reliable in-car power management is crucial for any automotive Raspberry Pi project. During my research, the name Mausberry Circuits frequently appeared in Raspberry Pi automotive tutorials. I opted to order their 2A car-based power supply switch, designed specifically for Raspberry Pi car installations.
Mausberry car switches utilize both ignition-dependent and constant 12V power sources in a vehicle. They are engineered to supply power to the Raspberry Pi when the car is turned on and initiate a safe shutdown sequence when the ignition is turned off, preventing data corruption and ensuring proper system operation. In theory, these switches seemed like the ideal power solution for my project.
Installation involved wiring the Mausberry switch into the car’s fuse box using fuse taps, allowing for easy and non-destructive connection to the car’s electrical system. Initial testing appeared promising, with the switch seemingly functioning as intended.
However, after approximately 30 seconds of operation, the switch would abruptly cut power to the Raspberry Pi, forcing an unexpected shutdown. Extensive troubleshooting followed, involving testing various fuse combinations, wiring configurations, USB cables, and even direct connection to the car battery. Unfortunately, these efforts proved futile. Suspecting a faulty switch, I used a multimeter to test the Mausberry unit itself, confirming that the switch appeared to be the source of the power cutoff issue.
Attempts to contact Mausberry for support went unanswered for weeks. Giving them the benefit of the doubt, I ordered a second Mausberry switch, this time the 3A version. After another period of silence and uncertainty, the new switch arrived weeks later.
Regrettably, testing the new switch revealed the same power cutoff problem. Further experimentation with different cables, power sources, and fuses yielded no improvement. Frustration mounted, compounded by the lack of communication from Mausberry.
Fortunately, a reliable alternative emerged in the form of the UPS PIco from Pimodules. I contacted Pimodules directly, inquiring about the UPS PIco’s suitability for automotive applications. Their prompt and affirmative response instilled confidence, leading me to order the UPS PIco.
Despite the delays due to customs and international shipping, the UPS PIco arrived and immediately impressed with its build quality and features.
The setup guide was exceptionally clear and easy to follow. The UPS PIco utilizes a small 450mAh LiPo battery to provide backup power to the Raspberry Pi in case of power loss, such as when the car is turned off. It employs scripts to initiate a safe shutdown after a brief period of battery power, ensuring data integrity. The UPS PIco also offers optional cooling fan integration and provides readily accessible voltage and battery level information via status LEDs.
Thanks to the excellent documentation and well-designed hardware, I had the UPS PIco configured and working flawlessly within an hour. After months of power-related setbacks, the Raspberry Pi car computer finally had a dependable power solution, ready for in-car installation.
Installation and Testing in the Car
With the unreliable Mausberry circuit replaced by the UPS PIco, I needed to address voltage conversion. The Mausberry circuit had included a built-in voltage converter, but with its removal, a separate solution was required to step down the car’s 12V power to the Raspberry Pi’s 5V requirement. I sourced this voltage regulator from Amazon and wired it into the system.
With all components prepared, the installation phase began. I started by carefully threading the OLED display cable through the dashboard from the glove compartment, aiming for a discreet and clean installation.
The chosen location for the OLED display was just below the instrument cluster. This position seemed optimal for cable routing and display visibility without being overly intrusive.
Finally, the moment of truth arrived – a test drive. The fully assembled Raspberry Pi car computer sprang to life, displaying real-time OBD2 data as intended. After weeks of development and troubleshooting, witnessing the system function flawlessly in the car was a rewarding experience.
Following the successful initial test, I left the system installed for several weeks of real-world testing. While minor software refinements were still needed, no major hardware issues emerged, confirming the robustness of the Raspberry Pi car computer setup.
Creating a Custom OLED Display Housing
With the functional aspects of the Raspberry Pi car computer finalized, attention turned to aesthetics. The exposed green PCB of the OLED display contrasted starkly with the car’s dashboard, detracting from the desired integrated look. To address this, I decided to fabricate a simple housing for the OLED using perspex plastic purchased from a local home improvement store. This also presented a perfect opportunity to finally utilize a Dremel tool I had been wanting to acquire.
The housing was designed to be minimalist and functional, concealing the PCB while ensuring the display remained clearly visible and the connection pins accessible. The perspex was cut, shaped, and painted black to seamlessly blend with the car’s interior.
The finished housing significantly improved the visual integration of the OLED display, providing a cleaner and more professional appearance within the car.
Future Enhancements for the Raspberry Pi Car Computer
This journey, from initial concept to functional Raspberry Pi car computer, has been an invaluable learning experience. What began as a casual idea evolved into a demanding and time-intensive project, filled with late nights in the garage, countless hours of coding, and moments of both frustration and triumph.
To anyone considering a similar DIY automotive project, the key takeaway is perseverance. There will be setbacks, unexpected challenges, and moments where the project seems daunting. However, the satisfaction of overcoming these obstacles and realizing the final product makes the entire endeavor worthwhile.
The future of this Raspberry Pi car computer project holds exciting possibilities. A growing list of potential enhancements includes:
- Expanded Data Display: Incorporating more OBD2 parameters, such as intake air temperature, throttle position, and engine coolant temperature.
- Customizable Display Layouts: Developing software to allow users to customize the displayed data and screen layouts according to their preferences.
- Data Logging: Implementing data logging capabilities to record vehicle performance data for later analysis.
- GPS Integration: Adding GPS functionality to track location, speed, and other GPS-related data.
- Touchscreen Interface: Upgrading to a touchscreen display for interactive control and menu navigation.
These future developments aim to transform the current project from a simple OBD2 data display into a more sophisticated and versatile Raspberry Pi car computer, offering a wider range of features for automotive enthusiasts.
Thank you for following this DIY project. Building a Raspberry Pi car computer with OBD2 is a challenging but rewarding undertaking. It combines electronics, programming, and automotive knowledge, resulting in a unique and personalized in-car technology solution.
[