Introduction: Car to Arduino Communication: CAN Bus Sniffing and Broadcasting With Arduino

From Wikipedia, the Controller Area Network (CAN) bus is a "vehicle bus standard designed to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer." These devices can also be referred to as electronic control units (ECUs). Essentially the CAN bus is a bunch of linked ECUs within the vehicle that communicate with each based on a broadcast. Every ECU intercepts every broadcast, but individually decide whether or not to react to it.

Here's an example:

Let's imagine there's one ECU that controls the brake lights, one ECU that controls the car horn, and one ECU that controls the braking system. Whenever you blow the horn, the horn ECU sends a broadcast message out on the CAN bus network to every ECU it is connected to, including the brake light ECU and the braking system ECU. The brake light ECU intercepts that broadcast message, but chooses to ignore it because it has no relevance. The brake light ECU is really only waiting on the message from the brake system ECU. Also, the horn ECU doesn't react to the braking system ECU.

This broadcast system is broken down into different components; the two most important are message ID and message data.

For now, think of the message ID as an ECU address. The message data is the content. It is typically larger than the ID at around 8 bytes long.

Here's an example:

message ID: 620
data: 10 80 FF FF 80 20 00 80

The ECUs communicate with each other over a twisted wire pair holding CAN-high (CAN+) and CAN-low (CAN-). CAN-high and CAN-low are accessible through the OBD-II port under the steering wheel. This is how we'll get in!

Pro-tip: Use a wire tracer/tone generator to backtrace to other CAN Bus access points within your car.

Volkswagon has a good guide to how the CAN Bus network works: http://www.volkspage.net/technik/ssp/ssp/SSP_238.pdf

Step 1: Components and Assembly

Components:

1- Arduino UNO R3

2- Sparkfun (or other) CAN Bus Shield: https://www.sparkfun.com/products/10039

Note: Also available at SK Pang: http://skpang.co.uk/catalog/arduino-canbus-shield-with-usd-card-holder-p-706.html (SK Pang also supplies the needed CAN Bus library).

Note2: At the time of this writing, there were only 6 in stock at Sparkfun.

Note3: Sparkfun's CAN Bus shield also has a joystick (up, down, left, right, center), a micro SD slot, and support for GPS and LCD modules.

Note4: If you're feeling up to it, you can order the parts from Digikey and make your own using Sparkfun's provided EAGLE CAD drawing.

3- Wire pair or Sparkfun's OBD-II to DB9 cable:https://www.sparkfun.com/products/10087

Note: I found some old speaker wire that worked great.

4- breakable header pins - the CAN Bus shield doesn't include them: https://www.sparkfun.com/products/116


Assembly:

1- Break headers into 2x8 pin, 2x6 pin, and (optional - 1x4 pin sections)

2- Solder the headers to the CAN Bus shield.

Step 2: Familiarizing Yourself With the CAN Bus Library

    Once assembled, be sure to download the CAN Bus Library for use with your Arduino IDE.

    Library and Example files are located here:

    https://github.com/sparkfun/SparkFun_CAN-Bus_Ardui...

    Download link for Library and Examples:

    https://github.com/sparkfun/SparkFun_CAN-Bus_Ardu...

    • Library in the src/ folder
    • Sparkfun (and my) examples are in the examples/ folder

    CAN Bus Shield Initialization:

    #include <Canbus.h>  // don't forget to include these
    #include <defaults.h>
    #include <global.h>
    #include <mcp2515.h>
    #include <mcp2515_defs.h>
    
    void setup()
    {
    Serial.begin(9600);
    //Initialise MCP2515 CAN controller at the specified speed
    if(Canbus.init(CANSPEED_500))
    	Serial.println("CAN Init ok");
    else
    	Serial.println("Can't Init CAN");
    
    delay(1000);
    }

    Shield initialization will be required for all tasks. Here, we define our CAN bitrate and import our library. Every vehicle might use different bitrate speeds. For our example, we use 500 kbps.

    Available options are:

    CANSPEED_125 //CAN speed at 125 kbps
    CANSPEED_250 //CAN speed at 250 kbps
    CANSPEED_500 //CAN speed at 500 kbps

    If you're unsure of your vehicle's CAN bitrate, do some Googling...


    Read CAN Bus Messages:

    We are reading every message here. It can be a bit overwhelming as you see the traffic flow through.

    • ALL Messages
    void loop()
    { 
    tCAN message;
    
    if (mcp2515_check_message()) 
    	{
        if (mcp2515_get_message(&message)) 
    	{
                   Serial.print("ID: ");
                   Serial.print(message.id,HEX);
                   Serial.print(", ");
                   Serial.print("Data: ");
                   for(int i=0;i<message.header.length;i++)
                    {
                      Serial.print(message.data[i],HEX);
                      Serial.print(" ");
                    }
                   Serial.println("");
                 }}
    }

    Filtering will cut out a huge chunk of noise. (You'll see what I mean when you begin to sniff unfiltered.)

    • Filter Messages
    void loop()
    {
    tCAN message;
    
    if (mcp2515_check_message()) 
    	{
        if (mcp2515_get_message(&message)) 
    	{
            if(message.id == 0x631)	  //filtering based on CAN bus message ID.
                 {
                   Serial.print("ID: ");
                   Serial.print(message.id,HEX);
                   Serial.print(", ");
                   Serial.print("Data: ");
                   for(int i=0;i<message.header.length;i++)  
                    {
                      Serial.print(message.data[i],HEX);
                      Serial.print(" ");
                    }
                   Serial.println("");
                 }}}
    
    }

    message.header.length is the size of the CAN message.

    The above was filtered by message ID. We can also filter based on message data.

    if(message.id==0x631 and message.data[3]==0x04 and message.data[4]==0x0F)

    Notes:

    1- Messages can be longer than 3 digits.

    2- We are formatting incoming message IDs and message data as HEX.


    Write CAN Bus Messages:

    In order to write a CAN Bus message, we need to first assemble the message components: message ID, message size, and message data. The message is broken down by message.id, message.header.rtr, message.header.length, and message.data[].

    void loop() 
    {
    tCAN message;
    
            message.id = 0x631; //formatted in HEX
            message.header.rtr = 0;
            message.header.length = 8; //formatted in DEC
            message.data[0] = 0x40;
    	message.data[1] = 0x05;
    	message.data[2] = 0x30;
    	message.data[3] = 0xFF; //formatted in HEX
    	message.data[4] = 0x00;
    	message.data[5] = 0x40;
    	message.data[6] = 0x00;
    	message.data[7] = 0x00;
    
    mcp2515_bit_modify(CANCTRL, (1<<REQOP2)|(1<<REQOP1)|(1<<REQOP0), 0);
    mcp2515_send_message(&message);
    
    delay(1000);
    }

    The message ID and data are written in HEX (0xFF, for example), which is the same format we read with.

    mcp2515_send_message(&message); sends the message.

    Step 3: Connect and Read / Write

    The attached file, CAN_read_sample, is for simply reading all messages. I commented out filtering, so you should be able to modify it easily to include filtering of message ID and data.

    I also attached a file, CAN_write_sample, for writing a message.

    You have two options for connecting the Arduino to vehicle's CAN-high and CAN-low lines:

    1- Hack up some speaker wire (or any wire pair) and connect the CAN-H and CAN-L through-holes on the shield to the OBD-II port.

    CAN-H (shield) <-----> CAN-high (OBD-II)
    CAN-L (shield) <-----> CAN-low (OBD-II)

    2- Buy Sparkfun's OBD-II to DB9 Cable:https://www.sparkfun.com/products/10087. This also powers the Arduino through the car's 12v line. I haven't used it, but let me know how it works out... YMMV

    Connect the Arduino to your car and computer, load the code, open the serial monitor, and watch the magic.

    Step 4: What Next?

    As you begin to read CAN bus messages, start manipulating your car.

    • Unlock and lock the vehicle
    • Pop the trunk
    • Roll up and down windows
    • Sounding the alarm
    • Blow your horn
    • Turn on and off your flashers
    • Turn on and off your signal lights
    • Turn of and off your lights and high beams
    • Etc.

    Remember that filtering is your friend!

    See if you can find messages related to the above. Once you do, write the same messages back out through your Arduino using Step 2. See if you can unlock or lock your vehicle, pop the trunk, or blow your horn!

    I hope to share my findings in the future!

    Thanks for reading!

    Comments

    author
    klauson (author)2017-08-03

    Hi,

    does anyone had a succesful connection with a VW? I connected it over Line 6 and 14 for CAN high and low. I tried both Sparkfun example CAN_Demo and ECU_Demo but nothing works. The Serial Monitor shows me only CAN init ok. I also tried different CAN Bus Speed 125, 250 and 500. I tried also the PID Request but that doesn't work too.

    author
    David129 (author)2017-08-01

    Hi,

    I tried the SparkFun_CAN_Demo example but the buffer didn't work properly, I received about 700 rpm in idle, but when accelerating the car I also received the same amount, it was not until I maintained the rpm high and waited some seconds that when i asked for the rpm it replied me with about 2000.

    I don’t know what am I doing wrong, if someone had the same issue and managed to solve it please respond to this comment.

    author
    SaraP47 (author)2017-04-24

    Hey,

    I'm facing issues in reading the data from the ECU using that CAN_READ_DEMO example given in the library. I get data when no filter is applied, as i apply the filter mentioned in step 2 I get no data at all! i tried applying other filters as mentioned in other comments, but none of them worked. Please if you can help me with it, im stuck :( .I'm testing the code on Honda Civic .Here is what i get when applying no filter.

    CAN Read - Testing receival of CAN Bus message

    CAN Init ok

    ID: 305, Data: 780 10 0 0 0 0 7

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 93 1 4E 0 0 4 32

    ID: 158, Data: 80 0 2 BF 0 0 0 3B

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 295, Data: 40 0 0 17

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 18E, Data: 38 0 9

    ID: 1B0, Data: 70 0 0 0 0 0 1B

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 92 1 4D 0 0 4 25

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 158, Data: 80 0 2 BF 0 0 0 E

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 92 1 49 0 0 4 1A

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 428, Data: 70 0 0 0 0 0 28

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 1D0, Data: 80 0 0 0 0 0 0 A

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 13C, Data: 80 93 1 48 0 0 4 1A

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 1ED, Data: 31 FF 3A

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 18E, Data: 38 0 27

    ID: 17C, Data: 80 0 2 C7 0 0 0 F

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 1ED, Data: 31 FF 1C

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 158, Data: 80 0 2 B2 0 0 0 29

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 13C, Data: 80 93 1 4A 0 0 4 18

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 188, Data: 60 0 0 1 0 24

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 1A6, Data: 84 0 40 17 A9 0 0 4

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 295, Data: 40 0 0 17

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 13C, Data: 80 94 1 4B 0 0 4 25

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 18E, Data: 38 0 36

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 328, Data: 80 0 0 0 0 C0 0 1E

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 1A6, Data: 84 0 40 17 AA 0 0 21

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 94 1 4D 0 0 4 14

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 18

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 9

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 18

    ID: 255, Data: 80 0 0 0 55 55 9C BA

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 39, Data: 30 0 C

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 17C, Data: 80 0 2 C8 0 0 0 E

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 39, Data: 30 0 2A

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 13C, Data: 80 92 1 4B 0 0 4 36

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 158, Data: 80 0 2 BC 0 0 0 1

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 372, Data: 220 28

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 13C, Data: 80 92 1 49 0 0 4 38

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 17C, Data: 80 0 2 C4 0 0 0 2

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 39, Data: 30 0 C

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 13C, Data: 80 92 1 4A 0 0 4 A

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 1A6, Data: 84 0 40 17 AA 0 0 3

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 9

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 18

    ID: 1D0, Data: 80 0 0 0 0 0 0 A

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 158, Data: 80 0 2 BC 0 0 0 1

    ID: 18E, Data: 38 0 9

    ID: 328, Data: 80 0 0 0 0 C0 0 2D

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 1A6, Data: 84 0 40 17 A9 0 0 22

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 13C, Data: 80 93 1 4A 0 0 4 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 39, Data: 30 0 2A

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 17C, Data: 80 0 2 C9 0 0 0 3A

    ID: 18E, Data: 38 0 36

    ID: 295, Data: 40 0 0 8

    ID: 13C, Data: 80 93 1 47 0 0 4 C

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 18

    ID: 17C, Data: 80 0 2 C7 0 0 0 2D

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 27

    ID: 13C, Data: 80 93 1 49 0 0 4 37

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 17C, Data: 80 0 2 C7 0 0 0 F

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 1A6, Data: 84 0 40 17 A9 0 0 22

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 188, Data: 60 0 0 1 0 24

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 18

    ID: 1DC, Data: 42 2 C3 38

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 18

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 27

    ID: 1A6, Data: 84 0 40 17 A9 0 0 4

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 36

    ID: 18E, Data: 38 0 27

    ID: 18E, Data: 38 0 9

    ID: 18E, Data: 38 0 36

    ID: 188, Data: 60 0 0 1 0 33

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 92 1 4A 0 0 4 28

    ID: 13C, Data: 80 92 1 4A 0 0 4 19

    ID: 13C, Data: 80 92 1 4B 0 0 4 18

    ID: 1DC, Data: 42 2 C8 24

    ID: 13C, Data: 80 92 1 4D 0 0 4 7

    ID: 13C, Data: 80 92 1 4D 0 0 4 34

    ID: 13C, Data: 80 92 1 4D 0 0 4 34

    ID: 13C, Data: 80 92 1 4C 0 0 4 35

    ID: 13C, Data: 80 92 1 4B 0 0 4 36

    ID: 255, Data: 80 0 0 0 55 55 F6 60

    ID: 17C, Data: 80 0 2 CB 0 0 0 29

    ID: 13C, Data: 80 92 1 49 0 0 4 29

    ID: 13C, Data: 80 92 1 49 0 0 4 29

    ID: 13C, Data: 80 92 1 49 0 0 4 29

    ID: 13C, Data: 80 93 1 49 0 0 4 28

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 188, Data: 60 0 0 1 0 6

    ID: 158, Data: 80 0 2 BC 0 0 0 10

    ID: 320, Data: 50 0 0 0 21

    ID: 13C, Data: 80 93 1 4C 0 0 4 7

    ID: 13C, Data: 80 93 1 4A 0 0 4 36

    ID: 13C, Data: 80 93 1 49 0 0 4 37

    ID: 13C, Data: 80 93 1 4A 0 0 4 36

    ID: 13C, Data: 80 93 1 4B 0 0 4 35

    ID: 13C, Data: 80 93 1 4C 0 0 4 34

    ID: 18E, Data: 38 0 36

    ID: 13C, Data: 80 93 1 4D 0 0 4 24

    ID: 13C, Data: 80 93 1 4D 0 0 4 15

    ID: 13C, Data: 80 93 1 4B 0 0 4 17

    ID: 328, Data: 80 0 0 0 0 C0 0 1E

    ID: 18E, Data: 38 0 18

    ID: 13C, Data: 80 93 1 49 0 0 4 A

    ID: 13C, Data: 80 93 1 49 0 0 4 37

    ID: 1D0, Data: 80 0 0 0 0 0 0 A

    ID: 17C, Data: 80 0 2 CA 0 0 0 2A

    ID: 13C, Data: 80 93 1 49 0 0 4 28

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1A6, Data: 84 0 40 17 AA 0 0 12

    ID: 1ED, Data: 31 FF 1C

    ID: 17C, Data: 80 0 2 C4 0 0 0 11

    ID: 13C, Data: 80 93 1 49 0 0 4 A

    ID: 13C, Data: 80 93 1 49 0 0 4 A

    ID: 39, Data: 30 0 1B

    ID: 13C, Data: 80 93 1 49 0 0 4 37

    ID: 13C, Data: 80 93 1 4B 0 0 4 26

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 AA 0 0 12

    ID: 188, Data: 60 0 0 1 0 6

    ID: 158, Data: 80 0 2 BB 0 0 0 11

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 13C, Data: 80 92 1 4C 0 0 4 8

    ID: 13C, Data: 80 92 1 4C 0 0 4 8

    ID: 39, Data: 30 0 C

    ID: 13C, Data: 80 92 1 49 0 0 4 38

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1ED, Data: 31 FF 1C

    ID: 17C, Data: 80 0 2 C7 0 0 0 1E

    ID: 13C, Data: 80 92 1 4A 0 0 4 A

    ID: 13C, Data: 80 92 1 49 0 0 4 B

    ID: 39, Data: 30 0 C

    ID: 13C, Data: 80 92 1 49 0 0 4 38

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 188, Data: 60 0 0 1 0 6

    ID: 158, Data: 80 0 2 B7 0 0 0 15

    ID: 324, Data: 883 66 C 44 0 0 0 22

    ID: 13C, Data: 80 93 1 49 0 0 4 A

    ID: 13C, Data: 80 93 1 48 0 0 4 B

    ID: 13C, Data: 80 93 1 48 0 0 4 B

    ID: 39, Data: 30 0 C

    ID: 1ED, Data: 31 FF 3A

    ID: 221, Data: 322 0 87

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 18E, Data: 38 0 9

    ID: 13C, Data: 80 93 1 4C 0 0 4 34

    ID: 17C, Data: 80 0 2 C4 0 0 0 11

    ID: 13C, Data: 80 93 1 4B 0 0 4 17

    ID: 13C, Data: 80 93 1 4A 0 0 4 18

    ID: 13C, Data: 80 93 1 4A 0 0 4 18

    ID: 13C, Data: 80 93 1 49 0 0 4 19

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 188, Data: 60 0 0 1 0 33

    ID: 386, Data: 8FF E0 0 0 0 0 0 29

    ID: 13C, Data: 80 93 1 47 0 0 4 39

    ID: 13C, Data: 80 93 1 48 0 0 4 38

    ID: 13C, Data: 80 93 1 48 0 0 4 38

    ID: 13C, Data: 80 93 1 49 0 0 4 37

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 1DC, Data: 42 2 C7 34

    ID: 13C, Data: 80 93 1 4D 0 0 4 24

    ID: 13C, Data: 80 93 1 4D 0 0 4 15

    ID: 13C, Data: 80 93 1 4D 0 0 4 15

    ID: 13C, Data: 80 93 1 4D 0 0 4 15

    ID: 1A4, Data: 80 0 0 0 0 0 0 9

    ID: 188, Data: 60 0 0 1 0 33

    ID: 13C, Data: 80 93 1 4C 0 0 4 7

    ID: 13C, Data: 80 93 1 4D 0 0 4 33

    ID: 13C, Data: 80 93 1 4C 0 0 4 34

    ID: 13C, Data: 80 93 1 4C 0 0 4 34

    ID: 1B0, Data: 70 0 0 0 0 0 39

    ID: 1A4, Data: 80 0 0 0 0 0 0 18

    ID: 309, Data: 80 0 0 0 0 0 0 1B

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 13C, Data: 80 93 1 4B 0 0 4 17

    ID: 18E, Data: 38 0 27

    ID: 13C, Data: 80 93 1 4D 0 0 4 15

    ID: 39, Data: 30 0 1B

    ID: 39, Data: 30 0 2A

    ID: 13C, Data: 80 93 1 4A 0 0 4 27

    ID: 1ED, Data: 31 FF D

    ID: 13C, Data: 80 93 1 4A 0 0 4 9

    ID: 13C, Data: 80 93 1 4A 0 0 4 36

    ID: 1D0, Data: 80 0 0 0 0 0 0 A

    ID: 328, Data: 80 0 0 0 0 C0 0 2D

    ID: 13C, Data: 80 94 1 48 0 0 4 28

    ID: 1A6, Data: 84 0 40 17 AA 0 0 12

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1A6, Data: 84 0 40 17 AA 0 0 12

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 AA 0 0 30

    ID: 1ED, Data: 31 FF 1C

    ID: 17C, Data: 80 0 2 C8 0 0 0 1D

    ID: 13C, Data: 80 93 1 48 0 0 4 B

    ID: 1A6, Data: 84 0 40 17 A9 0 0 22

    ID: 39, Data: 30 0 2A

    ID: 39, Data: 30 0 39

    ID: 13C, Data: 80 93 1 4C 0 0 4 25

    ID: 1A4, Data: 80 0 0 0 0 0 0 27

    ID: 188, Data: 60 0 0 1 0 33

    ID: 18E, Data: 38 0 18

    ID: 13C, Data: 80 92 1 49 0 0 4 38

    ID: 21E, Data: 70 0 3D 4F 20 66 24

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 1ED, Data: 31 FF 1C

    ID: 188, Data: 60 0 0 1 0 6

    ID: 13C, Data: 80 92 1 49 0 0 4 B

    ID: 13C, Data: 80 92 1 4A 0 0 4 37

    ID: 13C, Data: 80 92 1 4A 0 0 4 37

    ID: 13C, Data: 80 92 1 4A 0 0 4 37

    ID: 1B0, Data: 70 0 0 0 0 0 1B

    ID: 1A4, Data: 80 0 0 0 0 0 0 36

    ID: 294, Data: 80 16 1 0 F2 9 0 25

    ID: 1A6, Data: 84 0 40 17 A9 0 0 13

    ID: 1A6, Data: 84 0 40 17 A9 0 0 31

    ID: 18E, Data: 38 0 27

    ID: 17C, Data: 80 0 2 C4 0 0 0 11

    ID: 13C, Data: 80 93 1 4B 0 0 4 8

    ID: 39, Data: 30 0 1B

    ID: 39, Data: 30 0 2A

    ID: 295, Data: 40 0 0 17

    author
    gpalat (author)2017-04-02

    Great guide stvmac11 !

    I'm facing a little problem though.. when I use your "all messages" code, I'm getting the "can init OK" but nothing after that... if I will put the code below inside the loop (including the "buffer" declaration at the begining) , I'm getting the engine's rpm correctly...

    Canbus.ecu_req(ENGINE_RPM, buffer);
    Serial.print("Engine RPM: ");
    Serial.println(buffer);

    Can you tell what it is going wrong?..

    author
    stvmac11 (author)gpalat2017-04-03

    That's very interesting. If I had to guess, the location where you connected into the CAN BUS (assuming OBDII port), may only be set up to broadcast if it sees a PID_REQUEST for data.

    Canbus.ecu_req(ENGINE_RPM, buffer);
    Serial.print("Engine RPM: ");
    Serial.println(buffer);

    From the Library, a Canbus.ecu_req is a hard coded PID_REQUEST which sends a message with a particular Message ID and data packet. It then listens (reads) for a response from a particular Message ID and data packet which has the RPM data in it.

    I could go into more detail, but perhaps the OBDII port in your vehicle has some sort of filter that doesn't allow messages to broadcast unless it's a specific PID_REQUEST.

    That being said, the fix may be to try and hook into the CAN BUS at a different location. It may be tricky, but in my case (Toyota Camry) I was able to find unused CAN BUS High/Low pins directly behind my radio.

    author
    JaroslavZ3 (author)2017-03-21

    I can confirm what @MoniCris has said: Use the GROUND/GND Luke! Also consider cutting P1 (right above the CAN-H screw)

    I had to do both to finally get my first message from the damned shield in my Ford Mondeo.

    author
    MoniCris (author)2015-10-28

    Hi. It is a great instructable. I try the same, but I have a problem.

    1. In my Skoda Octavia II (2013), the OBD plug have pins 1,4,5,6,14,16. Rest of the pins have no connection inside. I connect my Can Shield to 6(can H), 14(can L) and GND. I check the voltage and I have +2,5V on H and +2,5V on L to GND. I use your library and can not connect to CAN. I change the can speed to get the can error, but nothing. With and without engine started

    2. Between the drivers door and the car, I reach the Convenience can bus lines. I connect my can shield and works at 100 kbps. I search for another library because the library you used is not reaching this low speed. I get thousands of frames just locking doors. I found the frame witch blocking the doors, and sending it back, is doing the job. Making an error on can speed from 100 to 125 or 500, I get the Christmas tree lights on my car's dash panel ... normal.

    But I wish to use the OBD's can lines. Have you any idea what can be wrong? Next days I will try on an Skoda Fabia (2003).

    Thanks

    P.S.: To all others, when you connect can bus, you need to connect 3 wires: CAN HIGH, CAN LOW, and GROUND!!

    Cheers

    author
    CatalinP11 (author)MoniCris2017-03-13

    What is the library that worked for you? What kind of can bus shield did you use?

    author
    TechnicsL (author)MoniCris2016-01-31

    Hi MoniCris, I'm looking for a library that also supports 100kbs. I will be connecting to (Infotainment CAN Bus) on Audi A5. Can you please share the library you're using? Is it from SeedStudio CAN-BUS Shield?...

    http://www.seeedstudio.com/wiki/CAN-BUS_Shield#1._...

    author
    MoniCris (author)TechnicsL2016-02-02

    Hello. My shield is not from Seed studio, but is using the same chip. I found the CAN lines in the rubber cover between the driver's door and the car, but you can find it also in the back of the radio. Search the drawings of your car and see witch is CAN-L or -H. Don't forget the ground. The library I use, is the one on GitHub: https://github.com/Seeed-Studio/CAN_BUS_Shield
    If you look at the file mcp_can.cpp at line 255, you will find 100kbs.
    Attention: read down in this coments what PACG writes.
    Ciao

    author
    PACG (author)MoniCris2015-12-01

    Hi.

    If you look at http://www.volkspage.net/technik/ssp/ssp/SSP_238.pdf page 7 you will see that the OBD can lines are hooked up to the vehicle gateway.

    To talk to a device via the gateway you have to set up a "channel" to tunnel your messages through,

    There is an example of that here: https://jazdw.net/tp20

    author
    MoniCris (author)PACG2015-12-14

    Thank you for the example.

    author
    vijayb27 (author)2017-03-12

    Hi stvmac11,

    I'm working on gear shift indicator, on audi so i thought to use this instructable project but i want to have two inputs one is engine rpm and vehicle speed from the can bus and i even know their message ids but my doubt is there any thing like we can get the message data in decimal so that i can directly use them for coding so if possible how and is there we need to change anything in the code or not?

    AND I'M REALLY WAITING FOR THE FASTEST REPLY

    thanks in advance and my mail id "vijaybhargava1996@gmail.com"

    author
    CatalinP8 (author)2017-03-03

    Hello.

    I need necessary hardware to control the Light Module on an 2006 BMW, especially to activate the brake lights.
    Can this be done by this project?

    author
    bammer222 (author)2017-02-19

    Hello, my name is Brad and i am currently working on a project to use inputs from my car to power motors. I would like to use speed as an input, and 2 positions of a motor. For example i would like to set te motors to one postition, lets say down then the car is under 40 mph, but once it goes over 40 mph the motor will change positions to an up position. I am very new to arduino and i hope that you can help me with how to do it and maybe how to code it, i plan on using an arduino can bus sheild and an OBD-II to can bus cord. I look forward to hearing from you, and any help is appreciated.

    The car i will be prototyping on is a 2015 ford mustang ecoboost

    My email is bammer222@gmail.com, any help is greatly appreciated

    author
    stvmac11 (author)bammer2222017-02-27

    Hello Bammer222,

    If you dig deep into the source code of the Sparkfun library (linked in the Instructable) you'll see a way to ping vehicle speed, engine RPM, MAF air flow rate, engine coolant temp, O2 sensor voltage, and throttle position. You have to send a PID_REQUEST Message ID with vehicle speed PID, and wait for a PID_REPLY with your data package (i.e. actual vehicle speed).

    Look at the (untested) code here. http://pastebin.com/4LJjK8xN

    It SHOULD print the vehicle speed in the Serial Monitor every second or so.

    author
    Meghadootc (author)2017-02-27

    hello,


    Basically, I wanted to establish can communication between two arduino boards.
    For that, I have two sparkfun can-shields.
    I wanted to know,
    1.Can I connect them directly by using CAN_H and CAN_L pins provided on shield?(I tried direct connection, but I'm not able to receive can frame at the receiving arduino board)

    2. whether do i need to connect terminating resistors of 10 ohm at both ends?
    3.is there any API, where can we configure baudrate and can fram id etc?

    Thanks in advance.
    My mail id is: rkomeghadoot@gmail.com

    author
    imginit (author)2016-08-13

    I need to use a CANSPEED of 100kb/s. Any advice for making this work?

    author
    imginit (author)imginit2016-08-20

    Oh, forgot to mention, I'm using the sparkfun shield.

    author
    JacquesJNel (author)imginit2017-01-30

    Hi only going through this instructable now.

    If you want to use a speed of 100kbps simply use the same code that the sparkfun library uses

    author
    trifalak (author)2016-01-26

    Can anybody tell how to decode ID. I am getting random IDs

    CAN Read - Testing receival of CAN Bus message

    CAN Init ok

    ID: 20, Data: 30 0 7

    ID: 394, Data: 10

    ID: 20, Data: 30 0 7

    ID: B0, Data: 60 0 0 0 11 6

    ID: B0, Data: 60 0 0 0 11 8

    ID: 20, Data: 30 0 7

    ID: B0, Data: 60 0 0 0 11 D

    ID: B0, Data: 60 0 0 0 11 F

    ID: 25, Data: 8F FE 0 7 78 78 78 A9

    ID: 2C4, Data: 83 CD 0 22 0 80 61 A1

    ID: 20, Data: 30 0 7

    ID: B0, Data: 60 0 0 0 11 B

    ID: 260, Data: 88 0 A 0 0 0 0 7C

    ID: 20, Data: 30 0 7

    ID: 20, Data: 30 0 7

    ID: 2D0, Data: 87 86 1 0 70 0 0 D8

    ID: 20, Data: 30 0 7

    ID: 25, Data: 8F FE 0 7 78 78 78 A9

    ID: B4, Data: 80 0 0 0 0 0 0 BC

    ID: 2C4, Data: 83 DA 0 22 0 80 61 AE

    ID: 2C1, Data: 88 1 87 0 A0 CC 0 C7

    ID: 2C4, Data: 83 D8 0 22 0 80 61 AC

    ID: 20, Data: 30 0 7

    ID: B0, Data: 60 0 0 0 11 C

    ID: 260, Data: 88 0 9 0 0 0 0 7B

    ID: 638, Data: 813 0 10 0 0 0 0 0

    ID: 2C4, Data: 83 D8 0 22 0 80 61 AC

    Using Toyota corolla 1.8 Lt. 2010 model.

    Also Can anybody tell how to filter data?

    author
    nasredinne made it! (author)trifalak2016-12-18

    I have the same problem like you im in the same step like this

    so if you have solved it please i need your helps

    Capture.PNG
    author
    stvmac11 (author)trifalak2016-01-27

    This is raw data from the CAN Bus. You'll see that all the time, which is why filtering is important. It's going to be hard for someone to decode the messages for you especially if they don't have the same make and model.

    Follow the example above in Step 2, and make sure it's in HEX, so ID: 2C4 would be 0x2C4

    if(message.id==0x638 and message.data[3]==0x22 and message.data[7]==0xAC)

    author
    maddownunder (author)2016-08-21

    Can you help me with why I cannot get the messages filtered.

    If I uncomment only the " if(message.id == 0x620 and message.data[2] == 0xFF)

    then the messages do not appear to be filtered at all.

    If I uncomment the serial print section then I get no serial print out at all. Where am I going wrong?

    author
    kahramankurt79 (author)2016-06-26

    Hello folks,

    I have installed a new radio and there are somethings (not)working a like to change.

    *When i drive backwards the music stops - I like to music goes on.

    *When i'm calling the screen locks and i can't navigate untill the call is ended.

    *The radio doesn't power off. even the carkey is out. It stays on untill i press off button.

    Are these canbus related and can it be solved with arduino programming?

    Thanks for reply

    (sorry for english i am from the Netherlands)

    20160625_124751.jpg20160625_124757.jpg20160625_130344.jpg
    author
    AleksandarB11 (author)2016-05-12

    Hi,

    I'd like your help because I'm new in the story with Arduino ...

    It is the Alfa GT in which I installed the 2.4 JTD engine that does not have CAN BUS communication with the dashboard.
    So you need to send a signal of temperature and RPM via the CAN line to dashboard.
    What should I do?
    I ordered: MCP2515 CAN-BUS Shield Controller with SPI Interface & MCP2551 CAN Transceiver and Arduino UNO 3 kit
    Is that enough or do I need more?

    author
    ionni73 (author)2016-04-08

    Hi Stvmac11,

    thank you verys much for sharing this very instructive tutorial!

    As other people, I also have the problem that while the CAN is correctly initialized ("CAN init ok") when hooking the OBD connector into the car and running the sketch (read_sample no filter), no CAN messages appeared on my console.

    Looking at the code, I was actually expecting a large amount of messages apparing on my screen.

    I took the sketch "as is" adding nothing, just compiling it and uploading it. Is there anything that we have to add (in the code) in order to start seeing the messages?

    Thanks in advance for your reply

    Jonathan

    author
    CarmineD5 (author)2016-04-06

    hello and congratulations for the tutorial, I have a question:

    if you wanted to convey this:

    ID = 0618A001 (hex)

    DLC = 8

    Message = 00 16 03 68 16 0F 52 00

    how could I do?

    if I run the program made available to you, it reads only the last three digits (in this case 001).

    Thanks for the attention

    author
    rbunn1971 (author)2016-04-04

    I only had to change the bit-rate and I started getting the can bus packets... I'm off to filter and write a python script to help. Great tutorial thank you.

    author
    jos93 (author)2016-04-02

    Hi stvmac11,

    thanx for the great tutorial!
    Hopefully you can help me with the following issue: I'm using an Arduino UNO in combination with Sparkfun's CANBUS-shield and the skpang-libraries you've mentioned. I want to sniff all data running over the CANBUS of my car (Skoda Superb 2013), but when I use the code above, I only get "CAN init ok", no CAN-messages are printed to the screen. However, when I first send a message, I receive an answer that exactly corresponds with the message I've sent (for example: when I ask for ENGINE_RPM, I receive the RPM). So it seems I only receive specific messages for specific requests, but somehow I'm not able to sniff all data running over the CANBUS. Can you help me out on this? Thanks in advance!

    author
    YatishK (author)2016-03-03

    hello stvmac11
    very nicely written and helped to understand a lot of concepts regarding CAN bus. I am totally new to this field and don't have any experience with Arduino. I am working on a project where we have to pick (receive) some 10-15 particular messages from vehicle can bus.
    So i just want to know is this possible to do with THIS setup? and also i read somewhere that specific message IDs are required to filter the messages and these IDs are not easily available.
    thanks in advance

    author
    julianpe (author)2016-03-03

    Does anyone have an overview about all IDs on a Volkswagen CAN-Bus from 2009.

    Which Bus-Speed do I need?

    author
    CarmineD5 (author)2016-02-24

    Hello, and congratulations for the guidance , it is really very useful .
    I would saere if you can send multiple messages simultaneously on the line can
    It is whether this is possible , how?

    author
    SoomyL (author)2016-02-13

    How can we get the code for getting the fuel level and ABS status and the airbag status.

    how do I decide which ID to choose?

    author
    SandeepS67 (author)2016-01-21

    Thanks really appreciate, after like 15 days of research on sniffing the CAN data, i found this tutorial and really excited to implement it.

    I've ordered CAN BUS Module as given in the link:

    http://www.ebay.in/itm/252257264918?ssPageName=STR...

    Can you please suggest how can i connect it with my Arduino UNO.

    What will be the wiring diagram ?

    Thanks

    author
    stvmac11 (author)SandeepS672016-01-26

    Hey Sandeep,

    Looking at the device you purchased, it is using a different CAN transceiver (TJA1050) from what I'm implementing (MCP2551). It may work. I have no way to test if it will. Feel free to run code to test.

    Regarding connecting it to the Arduino, please look look at the wiring diagram on Sparkfun's site: http://cdn.sparkfun.com/datasheets/Dev/Arduino/Shi...

    You should be connecting:

    CAN Bus module INT -> Arduino's D2

    CAN Bus module SCK -> Arduino's D13

    CAN Bus module SI -> Arduino's D11

    CAN Bus module SO -> Arduino's D12

    CAN Bus module CS -> Arduino's D10

    CAN Bus module GND -> Arduino's GND

    But if you have an off-brand Arduino, I don't know if wiring is the same.

    BE CAREFUL connecting voltage. I don't know what voltage that module uses - either 3V or 5V. There's a risk of frying the chip.

    author
    SandeepS67 (author)stvmac112016-02-03

    Hi,

    Thanks for the help, i tried connecting the wiring the way that you had suggested but it didn't work.

    I am little confused, when i try digging in to the CAN.h at line number 46, 47

    #define CAN_CS 6

    #define CAN_INT 4

    This means that the Chip Select of my CAN SPI should be connected to pin number 6. so i did that too but again seems like something is going on with the registers.

    I am trying to call the getEngineRPM method, which further call CiARequest and that further call sendMessage.

    With in sendMessage the below code is written:

    if (bit_is_clear(status, 2)) {

    address = 0x00;

    } else if (bit_is_clear(status, 4)) {

    address = 0x02;

    } else if (bit_is_clear(status, 6)) {

    address = 0x04;

    } else {

    //All buffers are used can not send messages (returns 0)

    return 0;

    }

    For me, it always return 0. I dont know why ?

    Can you help ?

    Thanks

    Sandeep

    author
    atzz (author)2016-01-26

    What if i need a can bus speed of 615 kbps?

    author
    stvmac11 (author)atzz2016-01-26

    This probably won't work, but....

    try

    if(Canbus.init(0.626))

    Let me know if it works out

    author
    Lele125 (author)2016-01-07

    Hi, thank you for this beautiful tutorial, I have assembled the Sparkfun shield and connected it with obd2 port (My car use ISO 15765-4 CAN 11 bit ID, 500 kbaud).
    then have uploaded your code "simple_read" and seems to works fine, but I don't know if is correct that the messages have different lengths,
    this is an example of what I see in serial monitor:

    CAN Read - Testing receival of CAN Bus message
    CAN Init ok
    ID: 12E, Data: 8C5 7F FE 7F E0 FF FF 0
    ID: 12E, Data: 8C4 7F FE 7F E0 FF FF 0
    ID: C6, Data: 872 B6 7F F6 7F F9 AC 3E
    ID: 581, Data: 42 20 0 3
    ID: 211, Data: 782 0 FF 0 8 0 0
    ID: 4AC, Data: 180
    ID: 211, Data: 782 0 FF 0 8 0 0
    ID: 211, Data: 782 0 FF 0 8 0 0
    ID: 657, Data: 20 0
    ID: 581, Data: 42 20 0 3
    ID: 350, Data: 8C3 A 7E CC 14 14 94 85
    ID: 673, Data: 70 0 FF FF FF FF 0
    some message have 8 Byte and other have casual lengh....

    is this correct or there is some problem?

    author
    PauloP23 (author)2015-11-17

    Hello. Great writing. I am waiting for my new car and start some tests. I wonder if this setup would be able to memorize the electric seat positions so I can implement sort of a memory. Are you able to elaborate about this? Thanks a million.

    author
    JulioS19 (author)2015-10-19

    Hi, nice job, thanks for sharing. How can I read speed, temperature and diagnostics features? The suggested approach for hacking should be good for some things, but for speed, temp, and other engine parameters will not work, is there any way to find out the message id for those? Are these codes manufacturers top secrets? Thanks!

    author
    stvmac11 (author)JulioS192015-10-19

    In the examples folder of the CANbus library above on SKPang site, there's a project called ecu_reader_logger.ino Take a look at that - it has reference to engine RPM, vehicle speed, engine coolant temp, and throttle.

    Also the Canbus.h file in the library has defined message ID's for a few things, but it may be more complicated than just looking for those IDs. Hope that helps.

    author
    renatoaloi made it! (author)2015-10-15

    Hi! Thanks for the tutorial! I made it! Works fine! But how can I have message IDs table for choosing my filters? when sniffing I got IDs like 320, 480, 4A8, 280, 288, 50 etc... How can I "know" what to filter? Thanks Renato Aloi

    canbus_board2.pngfoto1.jpg
    author
    stvmac11 (author)renatoaloi2015-10-15

    AFAIK there is no list of message IDs to look for, except for maybe the ones used for diagnostics information.

    I'd first start out by filtering out the message IDs you see when the car sits there idle. Doing this should drastically cut down on the amount of messages that you're not interested in. Now figure out what you want to see the message for.

    Example: Door lock or unlock

    Start by pressing your Unlock/Lock button on the Key FOB. Watch for message ID's that you haven't seen before.

    Next, try putting that Message in your arduino code to SEND. Does something happen? If not, perhaps you should try another message.

    author
    sf666 (author)2015-09-28

    Arduino Uno + Sparkfun Canbus-Shield

    Hi,

    First..thank you for this "how to", i was looking exactly for something like this :-)

    But in my case, i dont get any message :-(

    OBD2 Port (Driver side) Pin 6/14 -> Sparkfun CAN-H/CAN-L (is this correct? just this 2 wires?)

    Sparkfun is on the Arduino Uno R3 of course.

    USB-Cable from Arudino -> Usb-port Notebook.

    If i upload your "CAN_read_sample.ino" code, i can see the "CAN Init ok" on the Seriel-monitor in my Arduino 1.6 Tool.

    But thats all, nothing else visible. Tried all Canspeed.

    Any idea what i did wrong? Arduino + ELM327 works great and i can read RPM, SPeed and much more.

    Best regards...

    author
    sf666 (author)sf6662015-09-28

    Oh and.. no message filters are active.

    author
    MoniCris (author)2015-09-20

    Thanks for sharing this. Soon, I'll try this.

    author
    arunduino (author)2015-09-04

    Hi,

    I have bought a OBD2-DB9 cable and coupled it with a serial to USB connector to connect to my laptop. I have installed the touchscan software from scantools.net and currently using the trial version which has all the features enabled for two weeks.

    I have also installed the driver for serial to com port.. When I connect it to my VW Vento 2011 model, there is nothing detected by the software. I have tried it with various protocols and nothing seems to work.

    Here is the connection flow:

    VW Vento OBD2 port >> OBD2-to-DB9 >> DB9-to-USB adapter >> connected to laptop through USB

    Am I missing something here, is there a separate driver required for OBD2 to DB9 as well. Please help me.

    Thanks!!!

    author
    divd (author)2015-07-28

    Hi,

    i did everything like you said, and i used db9-obd2 cable. but i get nothing!!

    i made a test in a Suzuki liana,

    someone know what is the problem?

    did i need to make changes in the code?