Canbus Subaru Getting Started

This post is to walk through hooking a can-bus triple into your <b>canbus</b> subaru.
(I have a 2015 WRX STI)

You should have a OBD2 port next to your left leg when you are sitting in the driver
seat. Spotting this is your first trick.

After spotting the OBD2 port you'll want to get comfortable plugging the OBD2 connector
in. Do this with the car off completely. See below for why.

In my subaru , plugging in the OBD2 connector and canbus-triple into the laptop and
attempting anything will cause the my `15 STI to go into some "OMG" mode where the console
disables the center diff, the hill start and flashes errors and warnings like crazy. It seems
like some kind of diagnostic mode.

Once you are comfortable plugging in the cable - unplug it and start the car. When the car
is on and idling you can now plug in the cable to the car and the USB to the laptop.

Open up CoolTerm and then use the connect menu to connect. You will need to select your
device properly - it shows up as a usbmodem for me.

When connected using the connect menu in CoolTerm you can now send hex cods (you will have to
select this option)

I start always by negotiating baud.

send the hex string:
<blockquote>
010801</blockquote>

You will see diagnostic output in CooTerm.
To turn on logging
<blockquote>
030101</blockquote>

You will now see lots of hexidecimal data - I like using the hex view.

To Turn off logging

<blockquote>030100
</blockquote>

You can change the SerialCommand to output JSON with the ardrino build tools
and by editing SerialCommand.h.

I had a little test procedure that i duplicated 3 times and used to get logging
output in json.

This is my test procedure :
<blockquote>
Disconnect USB from laptop
Plug in OBD2 cable to CANBUS Tripple
Start Car - let car settle
Plug in OBD2 cable to car
Plug in USB to laptop
Connect vi CoolTerm

negotiate Baud in CoolTerm by sending Hex Codes

010801

turn on logging in coolterm by sending hex codes

030101

note - passenger seatbelt warning was on for most of these steps
Hill start assist out of driveway
turn right down street
go to stop sign, stop
accellerate in 1st not higher that 3000rpm
accelerate in 2nd quick and shift between 3200rpm-4000rpm into 3rd ( boost ok)
foot off throttle, coast in 3rd
shift to 4th
before daves rev match to 3rd and then to 2nd, at moderate engine speed
turn right carefully at light
up hill, in 2nd gear between 2000-3000rpm - no boost
cruise down street no more that 2000prm
at street intersection rev match to 1st and
coast down hill
come to a stop just after driveway on right side road below 4 IVY driveways.

turn off data logger with coolterm.

030100</blockquote>

<a href="https://gist.github.com/robotarmy/876b4ba3093a47cf64dd">This is some example JSON output grouped by CAN-ID</a>

What I don't know are what the subaru Can-ID's map to or how to deconstruct the payload into actual data.

If anyone has data about these Subaru CaN-ID's and payload It would be nice to know.

<blockquote>
140
141
144
152
156
2
280
281
282
284
360
361
372
374
375
376
378
37A
380
3D1
660
6C8
6D1
D0
D1
D2
D3
D4
</blockquote>

2015 Subaru Outback 3.6R here...

I'm almost 100% certain that 0x0144 contains RPM readings. With the car in park, I slowly revved the engine from its baseline up to about 3,000 five times, resting at idle between each. The last time I was careful to push a bit higher than the others to make sure the pattern was clear.

This pattern is shown by the lower order bytes in the first word of 0x0144.

<img src="http://i.imgur.com/seBbH8H.png" />

Obviously the numbers shown aren't integers representing RPM directly. It's also far too high to be showing 10x the RPM.

Typically there is a formula used to convert the hex/dec data for things like RPM vaue. 0x in dec value / 256*10 is popular, and I've also seen values like /16 used.
IE: hex 0x001d4c00, dec 1920000 / 256 = 7500.
A quick calculation based off your tests makes me think something along that line is the possible key..

Thanks for the tip - unfortunately it doesn't look like those will work for the 2015 Subaru. And it turns out I made a mistake when I went to graph the data: it looks like it's actually just one byte governing the tachometer. (My original numbers were all scaled by a factor of 0x9A or something like that)

Decimal:
<pre><code>117 ~= 650 RPM
141 ~= 1450 RPM
174 ~= 2000 RPM
181 ~= 2500 RPM
196 ~= 3050 RPM</code></pre>

I can't seem to find a regression line that both a) reasonably fits this anecdotal evidence and b) extrapolates well to handle higher RPM's.

I may have to revisit the tachometer at a later date/time.

Looks like your connection to CANBus Triple was lost, please wait while we try to reconnect.