I want to read/write CAN messages. I have MATLAB in my laptop which has a Vehicle Network Toolbox which supports reading/writing CAN messages. I have my hardware OBD-II to UART board, FTDI and OBD-ii cable. Please tell me how to get data from OBD-ii to MATLAB(Vehicle Network Toolbox). Is it supported?
-
what OBD-II to UART board are you using?– NickJan 26, 2014 at 19:24
-
Sparkfun manufactured. Im able to send general PIDs which can be viewed on hyperterminal on computer. But now i want to read CAN messages which will be regularly displayed through MATLAB's vehicle Network Toolbox. I want to how to set it up– user3098378Jan 27, 2014 at 10:46
1 Answer
CAN bus is actually a fairly complex protocol, similar to USB in many ways. However, your OBD-II to FTDI adapter is probably just implementing the OBD-II part of this protocol, which is pretty simple (after all, they are converting it to a serial interface).
Use the serial communication tools built into MATLAB to do this (e.g., to communicate ASCII to a serial port like COM1).
They could convert the OBD-II messages to serial in any number of ways, but the ELM327 chip family's method is by far the most common. For this the spec is here (http://elmelectronics.com/DSheets/ELM327DS.pdf), check out the section called "OBD commands". It is a very simple interface, you request a PID and it replies with the value.
-
I've obtained all the basic data like Speed, RPM etc through general PIDs/OBD Commands. I used hyperterminal on my laptop to view the returned data. But now i want to see the CAN messages. I got to know Vehicle Network Toolbox in MATLAB can read/write CAN data. So i want to know how to interface MATLAB with UART Board to view live CAN data. Jan 27, 2014 at 10:50
-
@user3098378 You need more advanced hardware to do this. The protocol is called Unified Diagnostic Services. mathworks.com/products/vehicle-network/supported/…– NickJan 27, 2014 at 12:48