Pages: [1] 2 3
Author Topic: CAN Vehicle Information Display - Should I sniff the CAN bus or request values?  (Read 51003 times)
jrelder
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 36



I am currently in the process of creating a display for my vehicle information. I am wondering what is the best way to extract this information from the CAN bus. I see two options:

1. Receive all CAN data on the line and then filter for the required values
or
2. Every x ms request the required values from the sensors on the CAN bus

Which would be the best method and why?

Thanks in advance!
« Last Edit: March 05, 2017, 08:32:03 AM by jrelder » Logged
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131



When I did my display for my old mk6 Jetta TDI, I just requested it the same way VCDS does it. You get exactly what you want, when you want it.
Besides that, you can't find soot load just floating around on the power train bus (not that I know of anyway), so I had to get that from the correct measuring block.
Logged
jrelder
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 36



Thanks, that's really helpful and that was the option I preferred.

I was trying to figure out exactly how others did it for a while now but I could only find explanations for people who had hacked OBD USB/Bluetooth devices. No explanation of how the data is retrieved at the CAN level.

One last question, I assumed you can only request one value at a time, hence if I need 4 sensor values I have to send 4 request messages?

The only issue with this if so, is that the values will update sequentially and not simultaneously, although I expect the time difference between each value update will be miniscule and the update period for each will be equal anyway.
Logged
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131



That's how I ended up doing it in the end, one request for each item... It does slow down refresh a bit, but still real time enough for me.

In the VW TP2.0 protocol, there is a facility for assembling multiple request to batch it in one transaction, but I never had a chance to get it to work.
Logged
nubcake
Sr. Member
****

Karma: +53/-4
Offline Offline

Posts: 400



That's how I ended up doing it in the end, one request for each item... It does slow down refresh a bit, but still real time enough for me.

In the VW TP2.0 protocol, there is a facility for assembling multiple request to batch it in one transaction, but I never had a chance to get it to work.

You can define your own DDLI with all the values you need (there are some limits, though).
Tried it with MED9 - and without auth and any ECU patches - the F0 DDLI can contain up to 20 single-byte values. Or, to be precise, the last item can contain 20 sequential bytes as well.
So, up to 39 bytes without any additional tricks.
Logged
jameswalker
Jr. Member
**

Karma: +3/-0
Offline Offline

Posts: 39



So, did you manage to successfully request anything? If so, do you know what messages do what? (even better, is there a document here on this site detailing it at all?)

I am currently doing similar, but by sniffing the bus directly.
Logged
nubcake
Sr. Member
****

Karma: +53/-4
Offline Offline

Posts: 400



So, did you manage to successfully request anything? If so, do you know what messages do what? (even better, is there a document here on this site detailing it at all?)

I am currently doing similar, but by sniffing the bus directly.

http://www.orlaus.dk/mercantec/UdvidetHardwareSoftware/Can/OBD2/VW%20Transport%20Protocol%202.0%20(TP%202.0)%20for%20CAN%20bus%20_%20jazdw.pdf
http://nefariousmotorsports.com/forum/index.php?topic=9182
Check Basano's and seishuku's posts.
There's enough info on here to build a working memory logger (or whatever you're trying to achieve) for the MED9, although it's a bit scattered.

EDIT: if you're talking about CAN packet contents - check FR.
« Last Edit: March 16, 2017, 09:45:23 AM by nubcake » Logged
jameswalker
Jr. Member
**

Karma: +3/-0
Offline Offline

Posts: 39



Perfect thanks.

I located all the parameters I was after, there is still 1 which I cannot find. That is real time AFR (or, raw actual lambda value). Not user requested target lambda.

I am guessing, that it is not actually sent out over the CAN bus?? And that the only way to grab it is to request is? Could anyone clarify this?
Logged
jrelder
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 36



So, did you manage to successfully request anything? If so, do you know what messages do what? (even better, is there a document here on this site detailing it at all?)

I am currently doing similar, but by sniffing the bus directly.

Hi,

Sorry for the late reply from myself. I actually didn't in the end as it turns out my car uses K-Line KW1281 instead of CAN to communicate, despite having a CAN bus. So I am now creating software for the K-Line. As for the values, I found everything I needed when I was looking at the CAN bus on the Wikipedia page for the OBD2 protocol. It tells you how to request values and which values are at which PID. It also tells you how to convert them into their meaningful decimal values.

Hope this might help you
Logged
golfdubcrazy
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4



Hi

I know this is one of my first few posts but i have been doing this on and off for many years. my personal view is to connect direct to the engine CANbus (instead of going thru gateway) and just listen to the values on the bus, as most of the values you are looking will probably be transmitted.

in my view this reduces bus load on the canbus,gateway and ecu as it does not have to process what values you want before it can transmit. you should find reading directly off the bus will also give you a faster refresh rate.

Hope that helps
Logged
TRespect
Full Member
***

Karma: +1/-0
Offline Offline

Posts: 72



I'm in the process to make something similar. I want to go a bit further and create an inerface to mimic the hvac controls and some other buttons.
I have a 2004 Touareg which uses k-line. Engine ecu is a me7.1.1.
On what platform are you guys working?
I want to build a c# application and replace all the console with a touch screen.
Any help on k-line sniffing or bus sniffing is welcome.
Logged
prj
Hero Member
*****

Karma: +1072/-482
Offline Offline

Posts: 6038



First tip is ignore almost all the posts in this thread. Besides nubcake and seishuku it doesn't seem like anyone knows what they are on about.

You have two options.
You either connect to the CAN bus and passively sniff the data messages.
Look at ME7 FR in the "CAN" module, it contains all the messages the ECU sends including scaling and structure.

Or if you want some sort of data that is not in those messages, then you will have to set up a diagnostic session to the ECU like a scan tool does.
The Touareg has KWP2000 over K-Line. Nothing special there, simply fast init and then get the spec and just ask for things the same way you would do with VCDS.

You are going to have to compile a list of measuring groups and then a measuring block to data item mapping.
In KWP2000 you don't need to worry about scaling because each measuring block consists of 3 bytes - ID, A and B.
You can find most of the important formulas here to calculate the end result:
https://www.blafusel.de/obd/obd2_kw1281.html

I would advise against using DDLI or ReadMemoryByAddress because this is ECU specific. KWP2000 with fast baud and low comm timings is very fast anyway, you should not have refresh rate issues if you don't request more than 4-5 measuring groups, which is plenty.
You can improve the response by only requesting data that is currently on-screen for example.
Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
TRespect
Full Member
***

Karma: +1/-0
Offline Offline

Posts: 72



Thanks for the info and the link. Interesting.
So if I understand you right it is doiable to sniff the messages sent by a button and mimic them in an app?
I don't have the car at hand all the time as it is stored far from home for the moment.
I thought about an odb emulator and a quick search returned this one:

https://freematics.com/pages/products/freematics-obd-emulator-mk2/

I need something to play to get started. Do you know or have used anything similar. or this is just a waste of money.
I have a 2009 Audi but the Audi uses CAN2 I think and the Touareg uses k-line so I cannot use the Audi for testing.

What is the ME7 FR in the "CAN" module ?

I Also found this blog which looks promising:

https://theksmith.com/software/hack-vehicle-bus-cheap-easy-part-1/
https://theksmith.com/software/hack-vehicle-bus-cheap-easy-part-2/



Logged
jimmcgee5
Full Member
***

Karma: +7/-7
Offline Offline

Posts: 201



their is already a free app that works with a bluetooth dongle , https://github.com/theksmith/CarBusInterface/wiki
Logged
TRespect
Full Member
***

Karma: +1/-0
Offline Offline

Posts: 72



Nice find there, thanks.
I will take a look and see how I can use the project to make my windows app.
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.024 seconds with 17 queries. (Pretty URLs adds 0s, 0q)