6

I'm thinking of replacing my car's radio panel with a custom built Raspberry Pi device, something like this device.

However, it's usefulness would be much larger, if I could get information from the on-board computer that's built into the dash-board, in particular the immediate fuel consumption. Together with a GPS sensor it would be possible to analyze and optimize fuel efficiency per km at different speeds and landscapes.

How difficult, if possible at all, would it be to read this kind of data?

5
  • I think reading it from the onboard computer would not be too difficult, there are HW devices for it desgined to interface with the Pi.
    – Max
    Jun 24, 2016 at 12:02
  • as one of the answers suggested, ELM327 sounds ideal. (Lookout for ones that claim to have version 2.1. They're chinese knockoffs which can potentially damage your car) If you're using an Android tablet instead of a Pi, which may easier? you may use this library to talk to ELM327 over Bluetooth github.com/pires/obd-java-api
    – Madushan
    Jul 23, 2016 at 12:24
  • 1
    also, note that ELM327 doesnt implement any security (apart from the well known PIN code for bluetooth pairing) so if you do use it, beware that anyone in range, may potentially connect to it and read/change parameters of your car. Changing certain OBD/ECU parameters of a road going vehicle is a violation of law.
    – Madushan
    Jul 23, 2016 at 12:29
  • @Madushan I guess from security perspective it'd be better to use an ODB<->USB cable then.
    – Petr
    Jul 23, 2016 at 13:27
  • 1
    yea. It probably isn't a huge issue as not many people walk around looking for ELM327s hooked up to random cars and trying to connect to them. Plus the vehicle has to have at least ACC power with the key at ignition for the OBD2 port to work. But something to keep in mind.
    – Madushan
    Jul 23, 2016 at 13:51

3 Answers 3

6

You cannot easily "tap" into any ECU/PCM. Depending on what year your vehicle is, it could be a simple set of analog gauges which you could tap into the signal line, but you'll need to do some hardware design to convert the signals to usable data.

If it's a newer vehicle, you'll have to deal with the canbus protocol and that will be very difficult.

Your best option is to get an OBD2 (ob-board diagnostics II) adapter which will allow you to capture the data the ECU/PCM is broadcasting. What it broadcasts are PIDs (programmable identifiers). For example, a PID would be speed, engine RPM, engine coolant temp, etc.

In order to get fuel consumption, you'll need to do some calculations. Fuel level/Fuel consumption is not a PID that the ECU/PCM commonly broadcasts even if it is shown on the dashboard. The dashboard/gauges will be controlled via canbus while the PIDs will be broadcast using OBD2 protocol.

With your pi you can connect to the OBD2 adapter (Get one for ~$30-$90 in amazon) via bluetooth or wifi and then read which ever PIDs you want.

CAN bus https://en.wikipedia.org/wiki/CAN_bus

OBD2 Getting Started with OBD-II

Additionally, you can just get an obd2 adapter and use an android phone/tablet and run Torque Pro which will do everything you're looking for. I use this all the time in my cars when I'm at the track or testing modifications. It will do all the calculations for you for fuel mileage/consumption.

Here is a screen shot I took of Torque reading some of the available PIDs for my car.

enter image description here

1
  • OBD Sounds exactly what I need. I'll give it a try and report back.
    – Petr
    Jun 24, 2016 at 16:26
5

If your car has a OBD2/ODBII port then it is achievable. I'd imaging the simplest way would be to use a ELM327 type cable or even a bluetooth adapter to provide the interface between the pi and the car.

1
  • 1
    Note that the latest Raspberry Pi 3 has bluetooth built-in, so you might only need a BT OBD-II adapter and some software.
    – TMN
    Jun 24, 2016 at 17:48
3

To affirm Max's answer, yes this shouldn't be too difficult. Here's a great link to get you started http://www.cowfishstudios.com/blog/obd-pi-raspberry-pi-displaying-car-diagnostics-obd-ii-data-on-an-aftermarket-head-unit

Very cool project, it'll be interesting to see how it turns out for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .