Hello Arduino Community,
I've already done some Arduino Projects: selfmade GPS-Racing Box, and some other GPS & i2c Projects, now i am trying to build a can bus sniffer which shows me some data from my vehilce(Husqvarna 701).
I have already used 2 Arduino CAN-Bus Shields, first i used the CAN-BUS Shield V1.2 from seeed at the moment i am using the CAN-BUS Shield from Sparkfun with the Same Problem, thats the Shield which i want to discuss in this Thread.
Now to the Setup:
I have connected the Sparkfun Shield to the arduino and the Shield ist hooked up to my Vehicle.
the shield is simply connected with all the headers soldered onto it.
The Shield is connected to the motorcycle TROUGH the ODB2-PLUG(solered the cables to the shield and stuffed them into the vehicle connector) which you can find on this page:
CAN Bus Hookupguide Sparkfun
(Point 7. on that page)
I connected those to the vehicle on basis of this thread:
KTM/Husqvarna Connector pins
I use Can-H Can-L and Ground and Connected Can-H to Can-H etc...
I also measured the Voltage on those said pins, if i turn on the ignition but don't run the motor i
get 2,5 V on each cable, to the ground.
So i guess i don't have to start up the engine to test my shield right?
I am using this example code:
/****************************************************************************
CAN Read Demo for the SparkFun CAN Bus Shield.
Written by Stephen McCoy.
Original tutorial available here: http://www.instructables.com/id/CAN-Bus-Sniffing-and-Broadcasting-with-Arduino
Used with permission 2016. License CC By SA.
Distributed as-is; no warranty is given.
*************************************************************************/
#include <Canbus.h>
#include <defaults.h>
#include <global.h>
#include <mcp2515.h>
#include <mcp2515_defs.h>
//********************************Setup Loop*********************************//
void setup() {
Serial.begin(9600); // For debug use
Serial.println("CAN Read - Testing receival of CAN Bus message");
delay(1000);
if(Canbus.init(CANSPEED_500)) //Initialise MCP2515 CAN controller at the specified speed
Serial.println("CAN Init ok");
else
Serial.println("Can't init CAN");
delay(1000);
}
//********************************Main Loop*********************************//
void loop(){
tCAN message;
if (mcp2515_check_message())
{
if (mcp2515_get_message(&message))
{
//if(message.id == 0x620 and message.data[2] == 0xFF) //uncomment when you want to filter
//{
Serial.print("ID: ");
Serial.print(message.id,HEX);
Serial.print(", ");
Serial.print("Data: ");
Serial.print(message.header.length,DEC);
for(int i=0;i<message.header.length;i++)
{
Serial.print(message.data[i],HEX);
Serial.print(" ");
}
Serial.println("");
//}
}}
}
If i Upload the Sketch i get the "CAN Init ok" but nothing more on the Serial Monitor.
With the SEED Shield i already tried different can speeds. with sparkfun i have tried 250 and 500.
now to the Questions.
- Do i have to starte the engine,(i've already tried that) but i guess not if i get voltage as soon as i turn the ignition on?
- Did i miss something on the Shield, i am NOT USING the db9 connector so maybe i have to solder something around 6c on the shield hookup guide?(if i understand it right, it only changes the pins of the db9 connector.
- Most guides i read are using the connector cable and not the three connections right on the shield. This should make no difference right?
- Has anyone done some simmilar project, maybe also with the sparkfun oder seeed shield?
Information i already read(with comments, maybe i missed something):
i am in no way a Professional in those fields, but usually i am Pretty resilient at those Projects,
i've already spent multiple days searching for something which "can"( ) help me out of my misery.
Even if you know some detailed projects which i didn't already find would help a lot.
(also it its pretty annoying to always walk to the garage to check if it works..)
Thank you for your time!