Author Topic: Could this CAN BUS logger work?  (Read 1528 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Could this CAN BUS logger work?
« on: November 12, 2020, 10:09:42 pm »
Hi!
I'm trying to play with CAN BUS in real.
At the moment I have access to an Arduino Uno and a simple CAN BUS module like on this link:
https://www.electronicshub.org/arduino-mcp2515-can-bus-tutorial/

If I would build up this project from the tutorial and connected to my car which is sitting in the backyard and waiting
to be hacked  :-DD, the Passat B5, could I read and maybe send some data to the CAN BUS of that car?

Or I need something more sophisticated?
It looks like easy to me to build a CAN sniffer or logger with this setup, but who knows...

This project should be just for learning, nothing else.

Thanks.
« Last Edit: November 12, 2020, 10:12:50 pm by Chriss »
 

Offline paul@yahrprobert.com

  • Regular Contributor
  • *
  • Posts: 79
  • Country: us
Re: Could this CAN BUS logger work?
« Reply #1 on: November 13, 2020, 03:52:59 am »
I don't know anything about CAN busses in cars or in your Passat, but I've done a lot of CAN bus work in instrumentation.  If you try to connect to the CAN bus in some unknown system it won't work unless you know the bit rate and adjust your board to match.  Also, you have to be using the same identifier length as the system, short or extended.  What I would do is put an oscilloscope on the bus and see what length the shortest pulses are and try this for the bit time, then try configuring your board for short or extended identifiers.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: Could this CAN BUS logger work?
« Reply #2 on: November 13, 2020, 07:37:20 am »
Thanks for the replay.
I'm interested now more on the hardware what I found on the net, does it meet the requirement for the communication on the vehicle CAN BUS?
I mean it should based on the controller and transceiver but I think that CAN BUS shield is a Chinese one and maybe it wont work.

The software part I know it will be a little tricky until I setup the right msg length baud rate etc.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Could this CAN BUS logger work?
« Reply #3 on: November 13, 2020, 09:07:42 am »
Paul is right in that the Arduino must be reading/writing CAN at thr right baud rate.

The message identifier (sometimes called COB) is either 11 or 29 bit. CAN bus is capable of supporting both at the same time.

Not sure how you are going to 'hack' your car.
Domestic car CAN port that you can plug into supports the OBD 2 (On Board Diagnostic) protocol.
There is a limited number of things you can do, this is fixed by the functions supported by the OBD2 protocol.
In addition, the ODB2 fault codes are split into groups : standard and manufacturer specific.
Most of the useful  codes are in the manufacturer specific group. There is plenty of info about this on the web, look up OBD scanners.

If you expecting to be able to talk to everything like ECM or braking system, you may be dissapointed.
Modern car systems are so complex that they split them into seperate subsystems where the CAN bus is not all joined together. There is no standard connecter like there is for OBD2.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: Could this CAN BUS logger work?
« Reply #4 on: November 13, 2020, 09:22:48 am »
Thank you for the replay.
So. Let as focus on my major question.
Is that hardware compatible to communicate with the CAN BUS on an old passat b5 2000 year model ?
Or is that hardware any good to playing with can bus DIY projects?
Or is that version of Arduino CAN BUS shield from Sparkfun better?
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Could this CAN BUS logger work?
« Reply #5 on: November 13, 2020, 09:58:13 am »
Quote
Is that hardware compatible to communicate with the CAN BUS on an old passat b5 2000 year model ?

Theoretically, yes that modual is capable of communicating with your vehicel.
However, and this is a BIG but, it is entirely dependant on your ability to write the Arduino code to interface correctly to the module AND the vehicle.
The modual uses an off the shelf CAN interface chip, so it is capable of talking CAN on any CAN bus.
The rest is uo to the implementation in hardware and software.

Quote
   Or is that version of Arduino CAN BUS shield from Sparkfun better?   
No idea. My day job is software developer for automotive company, so I know about  CAN.
It does not involve playing with hobbiest CAN modules.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: Could this CAN BUS logger work?
« Reply #6 on: November 13, 2020, 05:48:53 pm »
Ok guys, thanks for your time.
Today I stumbled into a video on YT where I got almost everything about this
can bus shield + arduino.
So I  share it here with all of you and others, maybe interested readers.
Maybe somebody will find the video interesting too, and will help to solve some issue or
just add some answers to some questions.

https://youtu.be/fj8ZLTubeko
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1282
  • Country: gb
    • bitdynamics
Re: Could this CAN BUS logger work?
« Reply #7 on: November 13, 2020, 08:20:42 pm »
Be a little bit careful if you are going to inject messages onto your cars data busses!  For example, the air bag system includes End Of Life functionality to fire the airbags (so they can be safely disposed of), and this is triggered by CAN messages!  Yes, it would be very unlikely for you to accidentally send the precise message(s) required but it's not theoretically impossible!  And besides such obviously dangerous events, there are a host of less dangerous but potentially costly ones like putting modules into bootloader mode and erasing their memory, that will cost you either a trip to the dealers for a re-flash, or haing to buy some specific recoding s/w for your car!

My suggestion, put your CAN sniffer in to "listen only" mode to start with. This mode means your device is entirely passive (does not even send ack bits) and simply listens to the messages on the bus sent by other modules.  Log those messages and you can pretty quickly figure out a lot of obvious stuff (like engine speed, or vehicle speed, or the "turn the heater rear window on" command.  More difficult to decipher will be complex rapidl changing data messages for things like engine torque or ABS interventions etc, but it is a fundamentally open protocol so nothing is specifically encrpyted.

Note that on some cars, the OBD port, which is mandated by the regulations to allow diagnostic access is NOT actually on the main powertrain bus, but is behind a gateway module that controls access to the rest of the system.  To get all the powertrain data you may need to find and connect into the actual powertrain bus.  Fortunately, this is very easy to find, just look for the twisted pairs that make up the bus! (often yellow (CANH) and green (CANL) and you'll definitely find these running from the engine controller to the ABS, the driver display and to the transmission Ecu (if auto)
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1282
  • Country: gb
    • bitdynamics
Re: Could this CAN BUS logger work?
« Reply #8 on: November 13, 2020, 08:21:52 pm »
Sorry just noticed the old age of your car (2000) which probably means only one bus, between engine controller and ABS and dash i suspect.
 

Offline mjkuwp

  • Supporter
  • ****
  • Posts: 259
  • Country: us
  • mechanical engineering defector
    • The Mz Lab
Re: Could this CAN BUS logger work?
« Reply #9 on: November 13, 2020, 08:42:07 pm »
https://www.passatworld.com/threads/can-bus.202237/

that person believes there are two busses in the B5 passat (2000 is a B5)

I used to have a 2001 Passat.  It was the best car I've owned in terms of comfort and drive quality.  We still miss that car : (

 

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: Could this CAN BUS logger work?
« Reply #10 on: November 13, 2020, 09:44:57 pm »
My passat is in the backyard and is waiting to bring it to the scrap yard. So if something goes wrong it wont be a bad thing at all.
But for first I will take precaution and disconnect the airbags, just in case... :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf