XK8 / XKR ( X100 ) 1996 - 2006

Reading can bus data to create special applications

Thread Tools
 
Search this Thread
 
Old Jul 1, 2019 | 05:27 AM
  #1  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default Reading can bus data to create special applications

Hi,

anyone in the community that has been working with tools to read can bus data and using it for input to creating own solutions? I have been searching the net and found tools like canusb, wireshark but I would of course get a better start if someone with a x100 already tried it and knows best practice.

What I am after is the possibility to build own solutions at my Xkr 4.0 like a variable air intake system, based on throttle position, variable exhaust based on throttle position, water spray on the intercooler radiator (like Porsche is using on 911 Turbo S) based on different parameters like boost, ambient air temp)

I have quite a bit of experience as a programmer, but from banking and insurance, so I know how to program but I dont know the tools within the automotive field.
 
Reply
Old Jul 1, 2019 | 09:59 AM
  #2  
darbysan's Avatar
Senior Member
Joined: Jun 2018
Posts: 284
Likes: 176
From: Las Vegas, NV
Default

My first thought was that you might contact Jaguar Specialties. I thought of them because they built a CANBUS interface module to interface an LS1 engine swap with the Jaguar CAN BUS, so they will be knowledgeable, and might be able to steer you in the right direction. Jaguar Specialties
 
Reply
Old Jul 1, 2019 | 11:23 AM
  #3  
fmertz's Avatar
Veteran Member
10 Year Member
Liked
Loved
Top Answer: 1
Joined: Nov 2014
Posts: 2,674
Likes: 1,574
From: Eastern USA
Default

I have found that the datasheet for the ELM327 devices is an excellent read to help solidify the basics of automotive diagnostics. In short, if the input data points you are looking for are available over OBDII (check OBD-II_PIDs), you can set the ELM327 device to the ISO-9141 bus and get them. Outside of that, there is a wide array of possibilities, but poor/nonexistent free documentation.

ELM Datasheets

Once you get the data in digital format, you will have to process it somehow, and then energize actuators/valves circuits. You will likely need to get more than a passing familiarity with micro controller devices like the Arduino, its software libraries and common circuits.

Best of luck, keep us posted.
 
Reply
Old Jul 1, 2019 | 02:46 PM
  #4  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Fmertz,

thanks for your input. But the ELM327 is only to be used via OBD2 port, right? I do have an ELM327 dongle that I use with my BMW 130i, to pair it with an Android app to check codes, erase codes and change parameters. But this time what I want to achieve is to create real time applications based on live feed data in a permanent installation, so using the obd2 port is something I would like to avoid. But I will look into the tools you mention
 
Reply
Old Jul 1, 2019 | 03:07 PM
  #5  
michaelh's Avatar
Veteran Member
10 Year Member
Liked
Loved
Community Favorite
Joined: Apr 2014
Posts: 4,767
Likes: 2,988
From: Jersey, Channel Islands
Default

Member Nerobergstr was looking at CANbus decoding a couple of years back - not sure how far he's taken things.
Maybe drop him a PM?

https://www.jaguarforums.com/forum/x...1/#post1491267
 
Reply
Old Jul 1, 2019 | 10:44 PM
  #6  
Chirpy's Avatar
Senior Member
5 Year Member
Liked
Joined: May 2016
Posts: 169
Likes: 119
From: Castle Rock, CO
Default

For what it's worth, I've been playing with a system to spray the intercooler radiator, although the project is stalled at the moment due to other priorities. Note that the 4.0 does not have a good boost sensor (as far as I understand), only something to assist on vacuum. So you if you want boost data, you will have to install a sensor and then run wiring into the cabin if you want gauges. Similar wiring needed if you have water meth injection controller using boost switch/sensor or IDC, since most recommend to have the controller/display in the cabin. If you do that, you might as well run more wires for the other stuff. This is what I have done, connecting them to an Arduino so I can get boost, injector duty cycle (IDC), ambient temp, IAT, IAT2, Intercooler radiator temperature, control the spray pump relay, etc. Too many wires to run, and you could mux onto a serial link with an Arduino or similar at each end. Of course, power supply/environment is noisy in the engine compartment, so need plenty of decoupling and failsafes/watchdogs on any controller in there that touches mission critical stuff. I found this out building an Arduino module to modify the MAF input-output curve - the engine controller really does not like losing the MAF signal whilst the car is in motion....
 
Reply
Old Jul 2, 2019 | 04:56 AM
  #7  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Chirpy,

Interesting stuff! Do you have a 4.0 or 4.2? How do you trigger the water spray, is it done with Arduino or the spray device itself?
 
Reply
Old Jul 2, 2019 | 08:39 AM
  #8  
Chirpy's Avatar
Senior Member
5 Year Member
Liked
Joined: May 2016
Posts: 169
Likes: 119
From: Castle Rock, CO
Default

2002 XKR with 4.0 AJ27. I use the Arduino to turn on a pump from a cheap water meth injection system I got off ebay, mounted near the washer fluid bottle which I tap into, similar to many who have installed water meth systems in engine compartment (My water meth pump and tank are in the trunk) 12V relay and external driving transistor for the coil + protection diode on the coil - Arduino can't supply enough current natively. I also got some misting jets off ebay but not plumbed in yet. Similar step down circuit and diode protection to read one of the injector coils to input to Arduino, and then using Arduino timers to measure IDC and revs. Of course, it may not make any big difference and so be a waste of time...., and I will need to tune the spray algorithm - I'm initially planning to use IDC duration above a certain threshold as a rough proxy for heat input to the intercooler cooling system, and use that to compute the amount of time to spray, modified by ambient temp. I also push all the data out via a serial link to a PC so I can log what is going on and view the data in real time.

I have a coolant leak under the supercharger that needs fixing, plus some concerns on the health of the differential which needs looking into, so this project is not going to get done for a while....
 
Reply
Old Jul 2, 2019 | 02:52 PM
  #9  
ccfulton's Avatar
Veteran Member
Joined: Jan 2012
Posts: 2,953
Likes: 1,120
From: Phoenix, AZ USA
Default

It certainly can be done. WhiteXKR on this forum has a number of solutions that work like this to control the convertible top, make the instrument gauges read real temperatures and pressures and so on.

I once made a paddle shift setup for the X100 with the 6 speed. Never worked quite well enough I was a happy with it, but one version was built from an Arduino and a CANbus shield. Basically you just sniff the bus while doing certain things and reason out which commands perform what functions.

I have not found a reference of CANbus commands but I am sure one exists somewhere.
 
Reply
Old Jul 2, 2019 | 03:59 PM
  #10  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Thats what I thought, it has been done before 😀

What version of can bus is x100 using? I reckon there has been new versions over time
 
Reply
Old Jul 2, 2019 | 07:10 PM
  #11  
fmertz's Avatar
Veteran Member
10 Year Member
Liked
Loved
Top Answer: 1
Joined: Nov 2014
Posts: 2,674
Likes: 1,574
From: Eastern USA
Default

To my knowledge, ISO 11898-2, also called high speed CAN
 
Reply
Old Jul 3, 2019 | 01:20 PM
  #12  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Thanks fmertz.

I found a product called CANUSB that gives direct connection between can bus and a computer via USB 2.0. Since being a Windows programmer this seems interesting to me, and the ideal scenario for me is to being able to write and apply the logic to start for instance a pump using a program in a computer. Has anyone done something similar?

Otherwise, how do you set up logic in Arduino? Based on parameters you read, how do you evaluate them and take action

See info about CANUSB here

CANUSB | CAN Tools
 
Reply
Old Jul 3, 2019 | 02:24 PM
  #13  
ccfulton's Avatar
Veteran Member
Joined: Jan 2012
Posts: 2,953
Likes: 1,120
From: Phoenix, AZ USA
Default

Arduino is basically just an AVR micro controller and you can program it in C. They provide an IDE to make things easy for beginners but if you already know how to program it would be cake.

Taking my little paddle shifter project as an example:
Once I had identified the shift commands, I plugged my device in between the J shift control and the CAN bus. In normal operation it would listen for the commands coming from the J shifter and repeat them onto the bus. If you use the paddle it would then command the next sport mode gear up or down and ignore the J shift. If you move the J shift to a different position it would go back to repeating whatever the J shifter had selected. The gear indicators are a separate CAN device that is just listening to the bus, so it displays the correct gear selection whichever device is in charge.

I only used Arduino because it is small and can run on a low DC voltage. My original intent was to leave it in the car permanently. I used a PC to do the sniffing and logging to figure out the commands.
 
Reply
Old Jul 3, 2019 | 02:40 PM
  #14  
fmertz's Avatar
Veteran Member
10 Year Member
Liked
Loved
Top Answer: 1
Joined: Nov 2014
Posts: 2,674
Likes: 1,574
From: Eastern USA
Default

Going down the CAN path will likely be a challenge because standard OBDII is not available over CAN on our cars, only over ISO-9141. Clearly, most messages will be there over CAN somehow if they relate to the engine or transmission, but will have to be reverse engineered. There is no (free) documentation on this that I know of.

You might want to look into the Arduino in more detail. They are chips that run code, and come with a number of programmable pins. The code can set these pins as input or output. There are many code libraries to perform basic functions. There is an IDE for C code, libraries, and compiler. The compiled code needs to be downloaded into the chip for execution and runs in a loop. You can supplement the Arduino board with additional hardware components called shields.

So, one way to start is to use your BlueTooth ELM327 for ISO-9141 OBDII, get setup with an Arduino kit, get a BlueTooth shield for communicating with the ELM327 for input data (rpm, duty cycle, air temp, etc.), and get a power shield to control the pump.

Best of luck, keep us posted.
 
Reply
Old Jul 4, 2019 | 02:12 PM
  #15  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Thanks all of you for sharing your knowledge. Lets see which route I try first but Arduino seems to be the known best practice tool to use
 
Reply
Old Jul 4, 2019 | 04:44 PM
  #16  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

An Arduino specific question; to accomplish a task like the ones discussed here, what type of Arduino is needed? Will a simple Arduino Uno do?
 
Reply
Old Jul 7, 2019 | 02:49 AM
  #17  
dibbit's Avatar
Veteran Member
15 Year Member
Liked
Loved
Community Favorite
Joined: Oct 2010
Posts: 2,036
Likes: 985
From: Spain
Default

Originally Posted by Higgins
An Arduino specific question; to accomplish a task like the ones discussed here, what type of Arduino is needed? Will a simple Arduino Uno do?
The only complex thing the Arduino would be doing is reading the serial data from the OBDII bus. The rest would be very simple code. This guy built an ISO9141 reader with an Arduino UNO, so it looks like the answer to your question is yes.

ISO9141 | Ryan Miller's Blog

He has included the source code for the project, so well worth investigating.
 
Reply
Old Jul 7, 2019 | 10:25 PM
  #18  
Chirpy's Avatar
Senior Member
5 Year Member
Liked
Joined: May 2016
Posts: 169
Likes: 119
From: Castle Rock, CO
Default

I use the Arduino Pro Mini since they are only about $5+ each - you need the extra USB FTDI programming dongle but its cheap. As discussed, there is a huge universe of microcontrollers and add ons, Raspberry Pis, etc., but unless you need lots of memory or massive input-output, or more fancy stuff like WiFi, precision digital to analog converters/etc. on board, then the basic 8/16 MHz Arduino/ATmega328P is likely more than enough. eBay is great for add ons like RS485 drivers, I2C digital to analog converters, 5V regulators, etc., as well as the more fancy shields for CAN bus, WiFi, etc. There are huge resources on the web. You will likely need some basic soldering skills if you don't have them already, and then you can fix your seat modules and ABS modules as well when they go out :-) . In my experience, the software is the easy bit - tapping the sensors neatly, running the wires, creating connectors for serviceability, building and hiding the hardware enclosures, documenting the setup, etc. is what chews up the time and creates back pain......I agree with fmertz, if there was a good reference on the Jag specific/X100 CAN bus data types it would massively simplify things, so if anyone has reverse engineered it or has the data (or can reverse engineer the diagnostic tools/IDS), I would not hesitate to try that first as then you would be back to mostly software tasks- and please share.....
 
Reply
Old Jul 10, 2019 | 02:23 PM
  #19  
Higgins's Avatar
Thread Starter
|
Senior Member
5 Year Member
Liked
Loved
Community Favorite
Joined: Dec 2017
Posts: 410
Likes: 111
From: Gothenburg
Default

Thanks for sharing your experience Chirpy. Lets dig into Amazon and Ebay and see what I can find
 
Reply
Old Jul 10, 2019 | 06:52 PM
  #20  
bcprice36's Avatar
Veteran Member
Joined: Feb 2017
Posts: 2,089
Likes: 922
From: Houston,TX
Default

This is my 4th XK, 3 of them were/are XKR's...1st: Changed the Pulley's, Belt and Tensioner...2nd: Changed the Intercooler...3rd: Added Snow Performance (Water/Methional) System with the Controller.....This works as good if not better than spraying water on the Intercooler and is pretty much the same as BMW system works...….For a lot less Money!...

Billy Clyde
 
Reply



All times are GMT -5. The time now is 06:38 PM.