OBD2 Connector

micahpearlman

New Member
I built an OBD2 connector based off the excellent info from this forum: https://gearheads.in/showthread.php?24542-Indian-KTM-Dukes-Building-an-OBD2-Cable-for-Datalogging-the-DUKE-200-390-amp-RC-200-390-CODE-6-Tuning

The connector is a Sumitomo HM 090 6 Pin Male: Motorcycle .090 - Connector and Terminals

Cable is hacked up cheap OBD2 extensions cable from Amazon. As well as the Bluetooth OBD2 dongle.

Currently using "Torque" App on Android. Likely will implement my own App to do logging.

One big issue is that it is not displaying RPM. Will delve into that further. Photo shows displaying O2.


KTM-OBD_CABLE_DIY_www.code6.in.jpgIMG_2561.jpgIMG_2560.jpg
 
Last edited:

Formula390

Supporting Vendor
Vendor
Dude that's AWESOME!!! Just picked up the mentioned parts... you just made my life a lot easier! :) Do please keep us updated as to your progress! If I figure out RPM I'll ping back too.
 

micahpearlman

New Member
So I can connect directly to the OBD2 via a serial console. I run the PID "010C" in the console (OBD-II PIDs - Wikipedia, the free encyclopedia) and get "NO DATA" returned. So must be an extended undocumented PID. This kinda surprised me because I would think that RPM in the standard PID location would be a legal requirement for diagnostics. Anyone know how to scan the extended PIDs or have any ideas?
 

micahpearlman

New Member
Just have to ask, sending in ASCII or Hex?
Not sure what you are asking. Using a terminal and sending the OBD PID. For example RPM: "010C". That is a hex command being sent as ASCII... But I think I'm misunderstanding the question.

One thing I've been looking at is I think the RPM is being sent as part of the low-level CAN messages. There is a way to dump the CAN messages in Elm327 using the "ATMA" command. From there I think we can find the RPM data.
 

Fasteddy

Member
No, you answered the question I shouldn't have needed to ask, my mistake, elm is doing the framing, the AT command to the elm is something I have not got to yet, but all along I have had the thought of a big serial display with the RPM on it,

search for this doc, "VW CAN BUS info.pdf" found on Bosch web site, along with ABS info.

I have not had time to get back to playing with my projects but your giving me incentive...
 

micahpearlman

New Member
ELM327 data sheet shows AT commands space seperated, ">01 0C" maybe thats it?
I'm not doing spaces. Other commands work. Likely white space is ignored.

If you get a chance run the "ATMA" command. One run at idle (record the display RPM) and one run revved to say 4K steady. And another run blipping and another with the motor off. With that much data we should be able to tease it out of the CAN bus data. My assumption is that the display data is getting RPM through the CAN and for whatever reason it's not available through standard OBD protocol.


Sent from my iPhone using Tapatalk
 

micahpearlman

New Member
Yeah, I'm just using the torque app on an ancient android phone. Still haven't worked out RPM -- I think it's hidden in another PID. I have a suspicion on which one but haven't had time to confirm (if anyone wants to investigate more I will be happy to be more specific)


Sent from my iPhone using Tapatalk
 

Formula390

Supporting Vendor
Vendor
Yeah, I'm just using the torque app on an ancient android phone. Still haven't worked out RPM -- I think it's hidden in another PID. I have a suspicion on which one but haven't had time to confirm (if anyone wants to investigate more I will be happy to be more specific)
I'm happy to contribute to the cause once I've gotten my cable assembled and working. I've got some programming experience and LOTS of software testing (20+ years) under my belt, so I'm happy to help however I can. I haven't ever been successful at learning Java tho, so haven't ever gotten to the point of writing Android apps from scratch. It's not far enough removed from C / C++ / C# tho that I couldn't muddle my way through if necessary.
 

Fasteddy

Member
I will be collecting more data tonight, If I have time this weekend I will start working with the Sparkfun OBD Arduino shield, have you played with Arduino's? very python / C.... oriented.
 

micahpearlman

New Member
I'm happy to contribute to the cause once I've gotten my cable assembled and working. I've got some programming experience and LOTS of software testing (20+ years) under my belt, so I'm happy to help however I can. I haven't ever been successful at learning Java tho, so haven't ever gotten to the point of writing Android apps from scratch. It's not far enough removed from C / C++ / C# tho that I couldn't muddle my way through if necessary.
You shouldn't need to code for most hacking. The Torque App (Pro Version) does a lot and there is an extra plugin you can get called "example app" that will scan all the OBD2 PID's.

For general hacking you can connect to your OBD2 Bluetooth device via your PC and use a serial terminal. You communicate through via a command line interface using the Elm327 "AT" command set (ELM327 AT Commands - SparkFun Electronics). The standard OBDII PIDs are defined: OBD-II PIDs - Wikipedia, the free encyclopedia

So for example to use a PC terminal connected to your Bluetooth OBDII to get the throttle position you would type in (NOTE: ">" is the command prompt don't type that in):

> 01 11 <--- type this in "01 11"
41 11 17 <--- this is what is returned

The numbers "41 11" are just basically an OK response. What we are interested in is "17". Realize "17" is hexadecimal so converted to decimal it is "23".

So if you look at that Wiki article on OBDII PIDs you will find the equation to get throttle position is:

A*100/255

We substitute A for 23:

23*100/255 = 9.02

So that means the throttle position is open 9.02%! And if we move the throttle and query again we get a new value! :)

So our problem is that we cannot get RPM. The PID to get RPM is "01 0C". What happens when we type in "01 0C" is "NO DATA" gets returned. Big ass bummer. RPM is a major data point and things like O2 and ignition timing are kinda useless without getting the RPM data. Gah!

So with the Torque App Pro + install the "Example App" plugin it shows me an interesting PID "ff1202" (you would type in "01 ff1202" assuming this is a mode 1 command). Torque App is calling this the "Turbo Boost & Vacuum Gauge". Pretty sure that the RC doesn't have a Turbo boost or a vacuum gauge (could be wrong on the vacuum gauge). And the value seems to change relative to RPM, but then again vacuum will change relative to RPM. So, with only minimal time spent investigating this, I have a small hunch that this could be our hidden RPM PID and if it isn't it does move linearly with RPM as to be a fairly good estimation?

IMG_2565.jpgIMG_2564.jpg
 
Last edited:

Ryanthegreat1

New Member
I thought the RC has a MAP sensor? Are you sure the PID for boost/vacuum gauge is not just the MAP output?

Yeah just checked the service manual it has a combined MAP/IAT sensor.
 
Last edited:

micahpearlman

New Member
I thought the RC has a MAP sensor? Are you sure the PID for boost/vacuum gauge is not just the MAP output?

Yeah just checked the service manual it has a combined MAP/IAT sensor.
Standard OBDII MAP is a different PID. "0B" is intake manifold pressure PID and "0F" is intake air temperature PID (which are both available on RC standard OBDII output). "FF1202" is a non-standard "extended" PID -- maybe it has something todo with the MAP and maybe it doesn't. But at the very least it changes linearly to RPM, at least revving the bike on the stand in the garage. The next step would be to see if it goes out of synch with RPM under load -- if it does then it is definitely a vacuum sensor just duplicated at the "extended" PID range and we are back to square one...

 

Fasteddy

Member
Standard OBDII MAP is a different PID. "0B" is intake manifold pressure PID and "0F" is intake air temperature PID (which are both available on RC standard OBDII output). "FF1202" is a non-standard "extended" PID -- maybe it has something todo with the MAP and maybe it doesn't. But at the very least it changes linearly to RPM, at least revving the bike on the stand in the garage. The next step would be to see if it goes out of synch with RPM under load -- if it does then it is definitely a vacuum sensor just duplicated at the "extended" PID range and we are back to square one...

I am sure there is no vac sensor, and would not think a vac sensor would be linear with RPM's so I believe you have found the hidden prize....

So can the torque app query and log a non standard PID?
 

micahpearlman

New Member
I am sure there is no vac sensor, and would not think a vac sensor would be linear with RPM's so I believe you have found the hidden prize....

So can the torque app query and log a non standard PID?
Yes it can query a non standard PID. I have not set that up or fully explored it yet. Unfortunately I won't be able to get to this until maybe late next week. My secret hope is that someone (*cough* Fasteddy *cough*) can do the final work before my next race June 20-21. :)
 
Top