Help with a CanBus programming .

Hi Everyone,
i want to start my post off by saying im a mechanic in orlando and after a day on this forum i can honestly say im over my head and really need help. My uncle’s car has electronic power steering an i am trying to bypass the engine computer. i have found some sites that give me the information i am looking for . my problem is i dont know how to put this into the program to make it happen. i have started with a CANBUS template that i download and is in the library but i am truly lost. Any help at all would be greatly appreciated .

201 38 A8 FF FF 3A 2B C8 81 // 0,1 bytes RPM; 4 - Speed (26=0;3F=65; 4F=106; 5F=147; 6F=189)
420 6B 23 C7 00 00 00 61 81 // 0 byte Temp (non linear) (5B-0%; 60-10%; 68-25%; 98=50%;
215 02 2D 02 2D 02 2A 06 81 // Some ECU status
231 0F 00 FF FF 02 2D 06 81 // Some ECU status
240 04 00 28 00 02 37 06 81 // Some ECU status
250 00 00 CF 87 7F 83 00 00 // Some ECU status
200 00 00 FF FF 00 32 06 81 // EPS doesn’t work without this
202 89 89 89 19 34 1F C8 FF // EPS doesn’t work without this

This is what i have so far but i am not sure how to send the message to the module.

// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
#include <SPI.h>

MCP_CAN CAN0(10); // Set CS to pin 10

void setup()
{
Serial.begin(115200);
// init can bus, baudrate: 500k
if(CAN0.begin(CAN_500KBPS) == CAN_OK) Serial.print(“can init ok!!\r\n”);
else Serial.print(“Can init fail!!\r\n”);
}

unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void loop()
{
// send data: id = 0x00, standrad flame, data len = 8, stmp: data buf
CAN0.sendMsgBuf(0x201, 0, 8, stmp);
CAN0.sendMsgBuf(0x420, 0, 8, stmp);
CAN0.sendMsgBuf(0x215, 0, 8, stmp);
CAN0.sendMsgBuf(0x231, 0, 8, stmp);
CAN0.sendMsgBuf(0x240, 0, 8, stmp);
CAN0.sendMsgBuf(0x250, 00, 8, stmp);
CAN0.sendMsgBuf(0x200, 00, 8, stmp);
CAN0.sendMsgBuf(0x202, 89, 8, stmp);
delay(100); // send data per 100ms
}

/*********************************************************************************************************
END FILE
*********************************************************************************************************/

This is what i have so far but i am not sure how to send the message to the module.

What message do you want to send? What is the device supposed to do with the message?

I'm using a arduino uno and canbus shield a message over an automotive CAN network. from what i have been reading online the first number is the the module im trying to communicate with and the rest of information i believe is the data. for example 201 38 A8 FF FF 3A 2B C8 81 would be (0x201) as the address , but i can't seem to figure out how to add the rest into the program.

CAN0.sendMsgBuf(0x201, 0, 8, 38 A8 FF FF 3A 2B C8 81); from my understanding this is what i want i just dont know how to make it right.

im mostly going off what i find from http://www.instructables.com/id/Hack-your-vehicle-CAN-BUS-with-Arduino-and-Seeed-C/?ALLSTEPS

https://www.cantanko.com/rx-8/reverse-engineering-the-rx-8s-instrument-cluster-part-one/comment-page-1/#comment-52162

http://www.diyelectriccar.com/forums/showthread.php/czech-mazda-rx-8-dc-conversion-88587p27.html

but i can seem to figure out how to add the rest into the program.

Look at the function you are using.

CAN0.sendMsgBuf(0x201, 0, 8, stmp);

The first argument seems to be the device to send the data to. The second appears to be an offset in the array, while the third appears to be the length of the array. The fourth argument is the data to send.

Put your data in the array!

Thank you for the help, i worked on it today and i think i figured some of it out.

so i have redone the file
// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
#include <SPI.h>

MCP_CAN CAN0(10); // Set CS to pin 10

void setup()
{
Serial.begin(115200);
// init can bus, baudrate: 500k
if(CAN0.begin(CAN_500KBPS) == CAN_OK) Serial.print(“can init ok!!\r\n”);
else Serial.print(“Can init fail!!\r\n”);
}

unsigned char statusRPM[8] = {0x38, 0xA8, 0xFF, 0xFF, 0x3A, 0x2B, 0xC8, 0x81};
unsigned char statusTEMP[8] = {0x6B, 0x23, 0xC7, 0x00, 0x00, 0x00, 0x61, 0x81};
unsigned char statusRAN[8] = {0x02, 0x2D, 0x02, 0x2D, 0x02, 0x2A, 0x06, 0x81};
unsigned char statusECU[8] = {0x0F, 0x00, 0xFF, 0xFF, 0x02, 0x2D, 0x06, 0x81 };
unsigned char statusPCM[8] = {0x04, 0x00, 0x28, 0x00, 0x02, 0x37, 0x06, 0x81};
unsigned char statusTCP[8] = {0x00, 0x00, 0xCF, 0x87, 0x7F, 0x83, 0x00, 0x00 };
unsigned char statusEPS[8] = {0x00, 0x00, 0xFF, 0xFF, 0x00, 0x32, 0x06, 0x81};
unsigned char statusCY[8] = {0x89, 0x89, 0x89, 0x19, 0x34, 0x1F, 0xC8, 0xFF};
void loop()
{
// send data: id = 0x00, standrad flame, data len = 8, stmp: data buf
CAN0.sendMsgBuf(0x201, 0, 8, statusRPM);
CAN0.sendMsgBuf(0x420, 0, 8, statusTEMP);
CAN0.sendMsgBuf(0x215, 0, 8, statusRAN);
CAN0.sendMsgBuf(0x231, 0, 8, statusECU);
CAN0.sendMsgBuf(0x240, 0, 8, statusPCM);
CAN0.sendMsgBuf(0x250, 0, 8, statusTCP);
CAN0.sendMsgBuf(0x200, 0, 8, statusEPS);
CAN0.sendMsgBuf(0x202, 0, 8, statusCY);
delay(100); // send data per 100ms
}

/*********************************************************************************************************
END FILE
*********************************************************************************************************/

i was hoping to get it looked at, i hooked the shield and arduino up to the vehicles can wires but i can seem to get the data to transmit.

but i can seem to get the data to transmit.

How do you know? It doesn't make sense, to me, to send a request for RPM and then not read the response. It's a bit like posting here for help and then never returning to read the replies.