MCP2515 Can't get Data from OBD-II

Hello,

UPDATE: I found this forum and it looks like no one can get this module working. I’ll get a shield instead with a serial input and hope that works.

I am attempting to use an MCP2515 module and an Arduino Uno to read data from the OBD-II port on my car. I have tried multiple different CAN libraries for Arduino but can’t seem to get it working. I have the MCP2515 module connected to the Arduino following the same setup as on this website.

CS to pin 10 (or 9 for some libraries’ examples)

SO to pin 12

SI to pin 11

SCK to pin 13

Here’s an image of the one I’m using from google images (I know some people don’t like to click links):

Here is a link to the exact module I bought (Came with an OBD-II cable): MALE OBDII OBD2 Adapter Cable + SN65HVD230 CJMCU-230 CAN Bus Transceiver Module | eBay

One thing that was really odd was that the pins on the cable I got from that ebay listing were flipped. Where pin 1 usually is on an obd-II cable, was pin 8, and where pin 8 usually is was pin 1. Same with the bottom side. I found the right wires to use using a continuity tester and connected them to the H and L pins on the MCP module so the connections should be correct now. But I still have the same problem, which is that every “receive” example from the libraries I have doesn’t work.

Some of the examples have tests to make sure that the Arduino can communicate successfully with the MCP module, and those tests always come back successful, so I think I have it hooked up correctly to the Arduino. But after those tests pass, it doesn’t receive any data from the car.

I’ll give one example of code I tried to run. It uploads successfully to the Arduino, but I only get one line of output:

“CAN Receiver.” If I have the module connected wrong, I get, “Starting CAN failed!”

#include <CAN.h>

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("CAN Receiver");

  // start the CAN bus at 500 kbps
  if (!CAN.begin(500E3)) {
    Serial.println("Starting CAN failed!");
    while (1);
  }
}

void loop() {
  // try to parse packet
  int packetSize = CAN.parsePacket();

  if (packetSize) {
    // received a packet
    Serial.print("Received ");

    if (CAN.packetExtended()) {
      Serial.print("extended ");
    }

    if (CAN.packetRtr()) {
      // Remote transmission request, packet contains no data
      Serial.print("RTR ");
    }

    Serial.print("packet with id 0x");
    Serial.print(CAN.packetId(), HEX);

    if (CAN.packetRtr()) {
      Serial.print(" and requested length ");
      Serial.println(CAN.packetDlc());
    } else {
      Serial.print(" and length ");
      Serial.println(packetSize);

      // only print packet data for non-RTR packets
      while (CAN.available()) {
        Serial.print((char)CAN.read());
      }
      Serial.println();
    }

    Serial.println();
  }
}

I am also not very well versed in all this, so maybe I got some information wrong. Also, I know this isn’t too descriptive, so please let me know if you need any more information!

Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.