Can-Bus Shield

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tobes49
 
Posts: 29
Joined: Wed Oct 19, 2011 10:06 am

Can-Bus Shield

Post by tobes49 »

Hi,

In know Adafruit doesn't do the Can-bus shield but everyone here has been very helpful in all my other projects :D

I have got the Skpang CAN-BUS shield it connected to a serial LCD display

I have downloaded the version 4 off there demo sketch and placed it inside the arduino working folder, but I cant get the sketch to Verify.

I've spent hours trying to work it out but still cant get it working. Can anyone help??

When Verifying it comes up with these errors:

Code: Select all

ecu_reader_logger.cpp: In function 'void setup()':
ecu_reader_logger:159: error: 'Canbus' was not declared in this scope
ecu_reader_logger:159: error: 'CANSPEED' was not declared in this scope
ecu_reader_logger.cpp: In function 'void loop()':
ecu_reader_logger:174: error: 'Canbus' was not declared in this scope
ecu_reader_logger:174: error: 'ENGINE_RPM' was not declared in this scope
ecu_reader_logger:184: error: 'Canbus' was not declared in this scope
ecu_reader_logger:184: error: 'VEHICLE_SPEED' was not declared in this scope
ecu_reader_logger:192: error: 'Canbus' was not declared in this scope
ecu_reader_logger:192: error: 'ENGINE_COOLANT_TEMP' was not declared in this scope
ecu_reader_logger:201: error: 'Canbus' was not declared in this scope
ecu_reader_logger:201: error: 'THROTTLE' was not declared in this scope
ecu_reader_logger.cpp: In function 'void logging()':
ecu_reader_logger:223: error: 'Canbus' was not declared in this scope
ecu_reader_logger:223: error: 'CANSPEED_500' was not declared in this scope
ecu_reader_logger:262: error: 'class SdFile' has no member named 'writeError'
ecu_reader_logger:277: error: 'Canbus' was not declared in this scope
ecu_reader_logger:277: error: 'ENGINE_RPM' was not declared in this scope
ecu_reader_logger:288: error: 'Canbus' was not declared in this scope
ecu_reader_logger:288: error: 'VEHICLE_SPEED' was not declared in this scope
ecu_reader_logger:297: error: 'Canbus' was not declared in this scope
ecu_reader_logger:297: error: 'ENGINE_COOLANT_TEMP' was not declared in this scope
ecu_reader_logger:306: error: 'Canbus' was not declared in this scope
ecu_reader_logger:306: error: 'THROTTLE' was not declared in this scope
It seems to be related to the Canbus.h file but just cant work it out?


Cheers

User avatar
rustybikes
 
Posts: 15
Joined: Sun Jul 15, 2012 2:25 pm

Re: Can-Bus Shield

Post by rustybikes »

It is related to canbus.h either not being included in your sketch, or not in the proper library location. See http://www.ladyada.net/library/arduino/libraries.html for the proper way to install these (it differs between Win, Mac, and Linux). FWIW, I have the CanBus shield, and it works perfectly, but the library does have to be in the right place. Good luck!

User avatar
tobes49
 
Posts: 29
Joined: Wed Oct 19, 2011 10:06 am

Re: Can-Bus Shield

Post by tobes49 »

rustybikes wrote:It is related to canbus.h either not being included in your sketch, or not in the proper library location. See http://www.ladyada.net/library/arduino/libraries.html for the proper way to install these (it differs between Win, Mac, and Linux). FWIW, I have the CanBus shield, and it works perfectly, but the library does have to be in the right place. Good luck!
Nice hint :D

I checked through the guide and realised there was no Library folder in my working folder. (there was a library in the install folder but not in my working one)

So I created the folder and placed the library files in there and it all worked a treat.

applehero
 
Posts: 3
Joined: Wed Nov 28, 2012 4:52 pm

Re: Can-Bus Shield

Post by applehero »

I also have the sparkfun canbus shield and am struggling to get it working.

I am using the same code. Instead of the lcd I am using the serial monitor. So I have the shield connected to the OBD port and a laptop connected to the arduino. (obviously the shield is mounted to the arduino)

After getting it to compile I started up the serial monitor. I get to the point where I can choose to move the joystick up, after which the i get the error "CAN Failed" and the program ends.

Any help would be greatly appreciated.

User avatar
tobes49
 
Posts: 29
Joined: Wed Oct 19, 2011 10:06 am

Re: Can-Bus Shield

Post by tobes49 »

applehero wrote:I also have the sparkfun canbus shield and am struggling to get it working.

I am using the same code. Instead of the lcd I am using the serial monitor. So I have the shield connected to the OBD port and a laptop connected to the arduino. (obviously the shield is mounted to the arduino)

After getting it to compile I started up the serial monitor. I get to the point where I can choose to move the joystick up, after which the i get the error "CAN Failed" and the program ends.

Any help would be greatly appreciated.
What car is it being connected to?

I found VW/Audi didn't use CAN for diagnostics until about 2005. Earlier cars used a K line and the shield doesn't work throught the OBD port on these cars

applehero
 
Posts: 3
Joined: Wed Nov 28, 2012 4:52 pm

Re: Can-Bus Shield

Post by applehero »

I did eventually get some of it working. If you move the folder named Canbus into the libraries folder of the Arduino, it will work. Run Arduino.exe and open the ecu_code_reader in the canbus sub-menu.

I am connecting to a Renault Twingo 1.

I manage to initalise then the files are created, but are not populated with any data. Have looked at the code, can only think the module is incompatible with my car.

Not sure where to go next...

applehero
 
Posts: 3
Joined: Wed Nov 28, 2012 4:52 pm

Re: Can-Bus Shield

Post by applehero »

So...

Having done some more investigative work, I found that the connections from the OBD connector to the D-Sub are not what I expected. The connections to the Canbus (High and Low) were for a protocol different to my own.

I soldered the wires to the correct pins. However no improvement...

Anyone have an idea on the next thing to look at?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”