Unlock Your Car’s Data: Building an Arduino Uno R3 OBD2 Performance Monitor

When I first shared my Raspberry Pi OBD-II Carputer project, the response from the car and tech communities was incredible. It became clear that there’s a significant interest in leveraging OBD-II data with single-board computers. Inspired by talks and discussions at tech conferences, particularly around hacking OBD-II, I realized the potential was even greater than initially imagined. However, developing the original obdPi project further revealed some limitations, especially concerning boot time and power management when using a Raspberry Pi in a car environment. This led me to explore a different path, one that leverages the simplicity and speed of the Arduino Uno R3 Obd2 interface.

Raspberry Pi vs. Arduino Uno R3 for OBD2 Car Monitoring

The primary hurdle with the Raspberry Pi for in-car applications was its boot time. Even with a streamlined Raspbian setup, it took around 20-30 seconds to become fully operational from a cold start. For a carputer designed to display real-time data upon ignition, this delay was significant. While solutions like Sleepy Pi aim to mitigate this, they still rely on the Pi’s inherent boot-up process. Reflecting on the project’s core aim – replicating the real-time performance monitoring of displays like the Subaru WRX multifunction display – I began to question if the Raspberry Pi was, in fact, overkill.

Example of a Subaru WRX boost gauge on the multifunction display, inspiring the Arduino OBD2 project.

This realization led me to the Arduino platform. The Arduino, particularly the Arduino Uno R3, presented itself as a compelling alternative, primarily due to its simplicity and near-instantaneous boot capability. When comparing the Raspberry Pi and Arduino Uno R3 for OBD2 projects, the strengths of each become apparent. The Raspberry Pi, with its full operating system, is powerful and versatile but requires a stable power supply and lacks built-in sensors. Conversely, the Arduino Uno R3 excels in simplicity, expandability, and rapid boot times. However, it doesn’t possess the processing power and multitasking abilities of the Pi. For a dedicated OBD2 performance monitor, the Arduino Uno R3‘s strengths, especially its fast boot time, outweighed the Pi’s broader capabilities.

Diving into the Arduino Uno R3 OBD2 World

To explore the Arduino Uno R3 OBD2 potential, I started with an Arduino Uno R3 board, readily available from Amazon and various electronics retailers. The initial setup was remarkably straightforward. With just a standard USB 2.0 cable and the Arduino IDE installed on my laptop, the Arduino Uno R3 was up and running in minutes. The ease of use of the Arduino platform was immediately apparent. Coming from the sometimes complex Raspberry Pi environment, the Arduino IDE’s simplicity and the abundance of clear, concise tutorials were refreshing. Within a short time, I had basic sketches running and even connected my existing obdPi 16×2 OLED display to the Arduino Uno R3.

Arduino Uno R3 connected to a 16×2 OLED display for initial OBD2 data visualization.

Researching existing Arduino OBD2 projects led me to Freematics, a company specializing in OBD2 Arduino hardware. They offer a range of wired and wireless OBD2 adapters. For this project, I opted for the Freematics V2 UART Adapter.

Freematics V2 UART OBD2 adapter, simplifying connection and power for Arduino projects.

Simplifying OBD2 Connection with Freematics

The Freematics V2 adapter significantly simplified the Arduino Uno R3 OBD2 connection. Utilizing the OBD-II interface, it provides a single-cable solution for both power and OBD-II data access. It’s designed to work seamlessly with Freematics’ ArduinoOBD library. A fundamental sketch using this library is surprisingly simple:

#include <wire.h>
#include <obd.h>

COBDI2C obd;

void setup() {
  // we'll use the debug LED as output
  pinMode(13, OUTPUT);
  // start communication with OBD-II adapter
  obd.begin();
  // initiate OBD-II connection until success
  while (!obd.init());
}

void loop() {
  int value;
  // save engine RPM in variable 'value', return true on success
  if (obd.read(PID_RPM, value)) {
    // light on LED on Arduino board when the RPM exceeds 3000
    digitalWrite(13, value > 3000 ? HIGH : LOW);
  }
}

This code snippet demonstrates how much easier it is to establish an Arduino OBD2 connection compared to configuring Bluetooth OBD-II on a Raspberry Pi. The single-cable convenience of the Freematics adapter further enhances the simplicity. With the basic OBD2 data retrieval working, the next step was to enhance the display beyond the basic OLED.

Upgrading to a Touch LCD Shield for Enhanced Visualization

Initially, I considered reusing the 16×2 OLED from the original obdPi project. However, this would have required additional wiring within the car. Exploring the Freematics website again, I discovered their 3.5″ Touch LCD Shield for the Arduino Mega.

Built by DFRobot, this shield is designed for direct integration with the V2 UART cable. It features pre-wired male connectors at the display base, perfectly suited for this project. I ordered the LCD shield and also picked up an Arduino Mega from a local Microcenter (Amazon also stocks Megas).

Note: While Freematics offers a kit including the LCD Shield, Mega, and V2 Cable, purchasing the Mega separately proved to be slightly more cost-effective.

Once the LCD shield arrived, assembling the setup was straightforward:

Arduino Mega 2560 paired with Freematics 3.5-inch Touch LCD Shield for a comprehensive OBD2 display.

Leveraging sample sketches from the Freematics Github repository, I quickly had the Arduino Uno R3 OBD2 monitor displaying data on the LCD shield.

Freematics LCD Shield displaying OBD2 data on Arduino Mega, showcasing initial functionality.

At this stage, Freematics had streamlined much of the process, providing a functional Arduino OBD2 performance monitor. However, I wanted to go further and customize the display with a more visually appealing GUI, inspired by aftermarket performance monitors.

Crafting a Custom GUI Inspired by COBB Accessport

With the hardware foundation in place, I shifted focus to software. While the Freematics Arduino libraries provided OBD2 data, the default display layout was basic. I envisioned a more user-friendly, GUI-based interface, drawing inspiration from devices like the COBB Accessport, a popular tool for ECU tuning and performance monitoring.

COBB Accessport V3, a commercial OBD2 performance monitor inspiring the Arduino project’s GUI design.

Although ECU tuning was beyond the scope of this project, the Accessport’s real-time performance data display and logging capabilities were highly appealing. My goal became to replicate a similar level of functionality and visual appeal using the Arduino Uno R3 OBD2 setup.

Developing the GUI: A Step-by-Step Process

I began by examining the example code in Freematics’ Github repository. I identified and removed unnecessary code to streamline the libraries for my specific needs. The original code lacked features like screen rotation and page-based layouts, which were crucial for my envisioned GUI. Consequently, I spent considerable time refactoring and optimizing the base libraries. After successfully implementing a portrait-oriented display, I proceeded to design and build the gauges and menus for the interface. The initial GUI development was incremental.

Early stage of Arduino GUI development, rendering basic lines for gauge layout.

Designing GUI elements from scratch provided a newfound respect for early GUI programmers. Through trial and error, I successfully created rotating gauges. Calculating endpoints and positioning labels and shapes required revisiting middle school geometry, proving surprisingly engaging.

Developing gauge labels and scales in the Arduino GUI, requiring geometric calculations.

Eventually, I had functional gauges and implemented touch input for cycling through different gauge screens. At this point, in-car testing was the next step, but first, a suitable mounting solution was needed.

Housing and Mounting the Arduino OBD2 Monitor

Taking inspiration from the Accessport’s form factor, I searched for a case for the Arduino Mega that could accommodate the LCD shield. The SunFounder Mega 2560 case, available on Amazon, appeared to be a suitable option.

SunFounder case for Arduino Mega 2560, providing protection and mounting options for in-car use.

Test fitting the Freematics LCD Shield onto the SunFounder Arduino Mega case, ensuring compatibility.

The case proved to be a perfect fit, allowing the LCD shield to be re-installed without any issues, with pin headers accessible. For in-car mounting, I chose an Anker air vent magnetic phone mount. This offered flexibility in positioning and, with the new case, provided a flat surface for attaching the magnetic patch.

Implementing a Hardware Kill Switch for Power Management

Since the Freematics adapter uses the OBD-II 12V pin for continuous Arduino power, a method to turn off the Arduino when the car is off was necessary. After considering software-based solutions, I opted for a hardware inline kill switch. I purchased LED inline power switches, modified them by extending the Freematics data lines, and added male/female 1×4 connector housings at both ends for easy integration.

Modifying an LED inline power switch to create a hardware kill switch for the Arduino OBD2 monitor.

Soldering and crimping connectors for the Arduino OBD2 power kill switch for easy integration.

Completed Arduino OBD2 power kill switch, ready for in-car installation and power control.

With the kill switch completed, the Arduino Uno R3 OBD2 monitor was ready for in-car installation. The Freematics adapter’s single cable made routing wires easy. I connected the kill switch, mounted the Arduino using the magnetic mount, and started the car for a test run.

In-Car Testing and Successful Deployment

Arduino OBD2 performance monitor mounted in a car using a magnetic vent mount, showing clean installation.

Driver’s view of the Arduino OBD2 monitor displaying boost and RPM gauges during in-car testing.

The video demonstration showcased working boost and RPM gauges. The project had reached a functional state, exceeding initial expectations. The remaining tasks were code refinement and adding more gauge displays.

Project Status and Future Inspiration

Unfortunately, life’s events, including moving houses, led to pausing the project. By the time I had time to revisit it, I had transitioned to a Subaru WRX, a car equipped with performance monitoring features similar to what I was developing. This diminished the immediate need for the Arduino OBD2 carputer in my own vehicle.

Subaru WRX, the car that indirectly led to the pause of the Arduino OBD2 project due to its built-in performance monitoring features.

Despite being on hold, I wanted to share this journey and the progress made on the Arduino Uno R3 OBD2 performance monitor. The working code is available on Github here. While I may explore new applications for this project in the future, for now, I hope this inspires others and provides a helpful resource. If you are interested in this project or have any questions, please feel free to reach out via email. I’m eager to see what you create!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *