Feb 23, 2023
1 mins read
ANOTHER New Layout
What is displayed (text) will be changed to represent actual sensors. IE: Load % will be something of value.
Speeduino CANBus / OBD2
I'm done with OBD2 in general. I know for the Arduino/ESP32 and so on, there are libraries that you can use to decode OBD2. Well I didnt want to use someone elses code, so I wrote my own.
The first part is decoding which PIDs are supported by your ECU. If you look at OBD2's wiki page, Service 01, PID 00 (20,40,60,80) tells you what PIDs are supported. The problem is you need to decode it. Here's what I mean, look at this from the page as their instructions. You ask the ECU I need Service 01, PID 00 or 20, or 40 and so on. In their example below the ECU returned BE1FA813. So you'll need to decode that. I decided to roll my own in C++ to git 'r dun.
After seeing the above I wrote code to decode a simulated response from the ECU: 6 41 0 98 59 0 13 AA. That is supposed to return the below which by looking them up in the OBD2 wiki, it tells you what the ECU says it reports. My screenshot shows that.
Running against hardcoded values is one thing, pulling it from the ECU and reading it/decoding it on the fly is another. Here's a dump of the supported PIDs on my '22 Duramax. It skips from 0x1 to 0x20 because the Serial Monitor had a huge influx of data I'm looping thru and it cut some off. Also the image was resized manually..it looked super huge on this site. Anyway, I verified by dumping it to an array and searching for PIDs I know are supported and they're in there :-)
So what's left is I'm having a tester run this code against his Speeduino to see what it supports and then just verify my code pulls the correct PID, calculates it based on that data. My tester doesnt have oil psi, and some other gauges so those values will need to be verified by another user. I'll put in code what is supported but as usual, its in BETA until fully tested and feedback received.