Reading can bus data to create special applications
#1
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.
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.
#2
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
#3
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.
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.
#4
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
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
#5
Join Date: Apr 2014
Location: Jersey, Channel Islands
Posts: 4,200
Received 2,434 Likes
on
1,572 Posts
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
Maybe drop him a PM?
https://www.jaguarforums.com/forum/x...1/#post1491267
#6
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....
#7
Trending Topics
#8
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....
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....
#9
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.
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.
#10
#11
#12
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
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
#13
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.
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.
#14
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.
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.
#15
#16
#17
ISO9141 | Ryan Miller's Blog
He has included the source code for the project, so well worth investigating.
#18
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.....
#19
#20
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
Billy Clyde