Search code examples
c++linuxapiraspberry-piraspbian

Custom dashboard for car; Reading OBD II data using C++?


So I am in a bit of a dilemma, I want to create a LED dashboard using my Raspberry Pi, the only problem is how am I going to read the data to the Raspberry Pi using C++? I am thinking about buying an OBD to USB connector and reading the data from there, but it still doesn't change the fact that I would need parse the data, but the only library I found for OBD on C++ is https://github.com/lkrasner/obd-cxx but it does not look promising.

So this is where I turn to the Stack Overflow community to help me out because I have run out of options.

Can the OBD data be read as serial? If it was serial, wouldn't that be too slow for a real-time speedometer? Should I use another port instead of OBD?


Solution

  • I have quickly searched and found this topic: http://blog.lemberg.co.uk/how-guide-obdii-reader-app-development

    It is not usb, but it tels about AT commands to communicate with the adaptor. Thus, I would assume the USB one will be visible as a serial interface with the same communication principle. Then you might not need a library, as you can directly read-write your serial device. Make sure only, that the adaptor you're gonna buy supports the communication protocol of your car (CAN or another). Perhaps also one option to think about is whether the adaptor provides high-level commands for you (then you need to check that the required diagnostics services are supported by the adaptor), or you need to build/parse the raw diagnostic messages yourself (I think this would be more flexible solution).