Looking for some help.. I am using a canbus mcp2515 module to read some data from my vehicle, That works fine and have retrieved the data that is need for my project. Once i send the data to test it however its as if vehicle shuts the message down. Is their any way around this as its frustrating.

Show your code.
“Once I send the data to test it” - send it where and how? Back on the same CAN?

so basically what i am doing is when the vehicle is unlocked i am sending a packet that turns on the vehicles exterior lights, I tried this and it did not work so decided to send one message to turn the lights on and it did work although it turns on and off as if it has a 1 second delay built in the loop which it does not. I am sending my packet via mcp2515 and on the single line bus running at 33kbps. I am guessing that the vehicle itself is causing the issue and not allowing my sent packets. This is the code any help would be appreciated thanks very much. I have also tried small delays myself with no joy

#include <mcp_can.h>
#include <SPI.h>

/*SAMD core*/
    #define SERIAL SerialUSB
    #define SERIAL Serial

// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 10;
unsigned char len = 0;
unsigned char UNLOCK[2] = {0x02, 0x80};
unsigned char LIGHTS[7] = {0x00, 0x00, 0xC0, 0x00, 0x10, 0x00, 0x00}; //lights on code  305
unsigned char LOCK[3] = {0x8F, 0x96, 0x7F};
MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin

void setup() {

    while (CAN_OK != CAN.begin(CAN_33KBPS)) {            // init can bus : baudrate = 500k
        SERIAL.println("CAN BUS Shield init fail");
        SERIAL.println(" Init CAN BUS Shield again");
    SERIAL.println("CAN BUS Shield init ok!");

void loop() {

         CAN.sendMsgBuf(0x305, 0, 7, LIGHTS);

.... so decided to send one message to turn the lights on and it did work although it turns on and off as if it has a 1 second delay built in the loop which it does not.

I'm assuming that CAN ID 0x305 is meant to be 'normally' transmitted by and electronic control unit(ECU) ON THE CAR.

if my assumption is correct, then this behaviour is TOTALLY to be expected as if that ECU is active on the vehicle then the message you are sending with the Arduino will conflict with that transmitted by the ECU.

ECU says light OFF
but you say light ON

thus the ON/OFF behaviour...

yes the id is controlled via the ecu, Thanks for the reply it makes sense, You wouldnt happen to know any way around this by any chance that i could work with?

The only guaranteed way around this is to sit as a “bridge” on the bus between whatever device is sending the message you want to change, and the rest of the bus:

Device sending “lights on/off” message <-> can interface 1 <-> Arduino <-> can interface 2 <-> rest of bus

This obviously requires 2 can interfaces and that the Arduino forwards all messages that are not “lights on” messages between both sides of the bus.

Sometimes you can “get away with” listening for a “lights” CAN message from the car, then immediately sending your own “lights” message to overwrite it. That might work if the message is not acted upon immediately, and the sending device doesn’t throw a hissy fit if it sees some other device on the bus sending it’s messages.

Edit: Which lights are we talking about here? Interior or exterior? Easier options might be to hack whatever switch is controlling those lights normally and make the Arduino fake a “lights on” switch position and let the car handle the rest.

Dear all,

I am a beginner at using Arduino/ CAN Bus shield. I need to use these equipment to send and receive data. Can anyone help me in this regard.

Thx for the help

Start by reading the forum guidelines and then start your own topic rather than hijacking someone else’s. You post insufficient information on your project. If you are just shooting in the dark you would be better doing some research first and then try something and come back with the specific issues you have. Generally you should have things such as components, schematics and code to provide for others to assist you.

Poster of #6 already has been told all this.