Announcement

Collapse
No announcement yet.

Hacking the Can Bus

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hacking the Can Bus

    I've been reading a few posts here and there about Canbus in various vehicles. I've been playing with canbus in my VW Touareg and I even have an Arduino with a canbus board which I use to start/stop the carpc, interface with steering wheel buttons and a few other functions. Since canbus id's vary so much but the underlying infrastructure is the same it was suggested that a thread be started and maybe we can have a collective of information in one thread.

    I've been doing a fair amount of canbus sniffing with my car and have identified a few key ID"s. There's tons of information that can be read and in some cases written to the canbus. I have many plans for my installation but I have a little more development and sniffing work to be done. Because of this I thought it best to buy another instrument cluster for car and use that in the house during testing. The canbus gateway for my car is located in the cluster itself so everything is in one spot.

    One of the things I want to do is have the music title scroll across the cluster lcd screen as it did with the original navigation unit. I'm also working on getting navigation information sent in the same manner. So right now I have the radio and cluster connected on the workbench. The ABS system uses canbus as well and the cluster looks for ABS "ok" msg on the canbus and if it doesn't receive it then a giant warning comes up on the display halting all other messages from displaying. So now I have to sniff the motor canbus and get those messages so I can replay them into the test bench cluster and hopefully I'll be on my way.

    The guys over at the golfmkv forums have a great thread on canbus hacking and one of the users even has an spreadsheet of canbus id's and the functions. I went through the list and found that just about all the id's they had didn't match the ID's for my car but that's ok as it's a good starting point.

  • #2
    Here's a picture of the cluster and radio. Click image for larger version

Name:	uploadfromtaptalk1357313394271.jpg
Views:	1
Size:	45.6 KB
ID:	2285113

    and this is the canbus shield I have for one of my Arduinos. I built the other canbus shields myself. There are a couple different companies who make canbus shields. The Sparkfun sheild has a few extra options like a gps header, sd card slot and a joystick.
    Last edited by that_kid; 01-04-2013, 10:35 AM.

    Comment


    • #3
      Great, I've been looking for some kind of canbus to usb device and the Arduino device seems to be fit for the job. I can see the board has to input/outputs, USB for the PC obviously and a RS323. Where do I hook up the RS323 port? Do I need to have some kind of OBD2 to RS323 cable? I thought CANBUS just needed 3 wires (Canbus high, canbus low and a ground), so using the OBD2 port next to my feet seems to be overkill? I don't want to have a cable plugged in next to my feet all the time. Is there a possibility to plug in the OBD2 or Canbus port elsewhere in the car?

      So basically, what accessoires/hardware do I all need to make my steering wheel control buttons work in my carpc and how do I hook it up? Sorry to be a noob at canbus and arduino level
      Last edited by Goddy; 01-13-2013, 07:02 AM.

      Comment


      • #4
        Originally posted by Goddy View Post
        Where do I hook up the RS323 port? Do I need to have some kind of OBD2 to RS323 cable?
        If you are using an arduino and canbus shield you only need a Can High and Can low connection to the car and a USB connection to the computer. I have seen some canbus setups interface with RS232 but that's not needed with the arduino and shield.

        Originally posted by Goddy View Post
        I thought CANBUS just needed 3 wires (Canbus high, canbus low and a ground), so using the OBD2 port next to my feet seems to be overkill? ...Is there a possibility to plug in the OBD2 or Canbus port elsewhere in the car?
        Canbus is a differential system so it only requires two wires. Also the Canbus signal located in the OBD connector sometimes doesn't provide access to all the Canbus data in the car. There can be numerous Canbus networks in the car. You have to figure out which bus the steering wheel data is available on. Depending on your vehicle you may be able to find this information on the internet. Normally a good place to tap into the Canbus is from the radio or nav unit.

        Originally posted by Goddy View Post
        So basically, what accessoires/hardware do I all need to make my steering wheel control buttons work in my carpc and how do I hook it up?
        You will need an Arduino, Canbus shield and a programming sketch that will allow the arduino to understand the Canbus data and for it to interact with the computer. This is where it gets tricky because you have to figure out the Canbus id's for the steering wheel buttons. There are several ways of getting the Arduino to control the computer, some Arduinos can emulate a keyboard so you could program the Arduino to send keyboard shortcuts corresponding to the steering wheel buttons.

        Comment


        • #5
          Have you guys seen that Ford came out with their OpenXC initiative last week? Basically an attempt to open source a standard method of reading the Can bus...

          Comment


          • #6
            Yeah I saw that, it looks interesting but I don't know if that will be compatible with anything other than new cars.

            Comment


            • #7
              I think I should get myself an Arduino + CAN bus shield and will play around with it.

              I gathered some helpful links

              http://www2.dasilvas.info/home/steering-wheel-buttons
              http://secuduino.blogspot.nl/2011/10...a-english.html

              As from the first link you can see it uses 2 wires only. Do you think it needs the CAN BUS low and high without the ground, it will it use only can low and ground?

              Is it also possible with the Arduino to write a code to receive AND send commands? It would be great if I'm able to read steering wheel control buttons and possible update the DIS with useful info.

              Comment


              • #8
                Yeah those two sites have some great information. I emailed the guy at dasilvas about his arduino setup. He was a great help to get me started. My CAN BUS uses only the high and low signals. I do have the arduino grounded through the electrical ground but the ground isn't needed for CAN BUS communication. As far as receiving and transmitting on the CAN BUS it's definitely possible. You will have have to figure out the timing of the signals for sending information and also the format of the messages. I had to do the same thing for my car and in fact I'm still figuring things out. For my setup I actually have to setup the arduino emulate the nav radio. If I don't do this the information display won't accept the messages to put on the screen. It sounds like you want to do the same thing, it's certainly possible you just need the correct CAN BUS messages and structures to do so.

                Comment


                • #9
                  I also heared there are different can bus 'networks', engine, comfort and infotainment. For steering control I obviously need to use the infotainment bus. Is it also possible to read ODB2 like information from the bus like RPM, Speed etc?
                  Then I also need to find out which wires (can hi/lo) I need to tap. I have no OEM radio in place, so I could just use those connections.

                  Anyhow, I'll get myself an Arduino, a CAN shield and some other accessoires to play around with. When I am able to tap the correct wires and have it all in place I can start sniffing and figure out the correct codes.

                  Comment


                  • #10
                    I have a 2007 Dodge Charger... I've decoded many of the CAN messages on the interior (comfort) bus. I got a lot of information at www.canhack.org.
                    Here is my worklog

                    I'm using an mbed microcontroller . I designed a breakout board that gives me access to most of the peripherals.

                    Comment


                    • #11
                      Originally posted by rtgree01 View Post
                      I have a 2007 Dodge Charger... I've decoded many of the CAN messages on the interior (comfort) bus. I got a lot of information at www.canhack.org.
                      Here is my worklog

                      I'm using an mbed microcontroller . I designed a breakout board that gives me access to most of the peripherals.
                      Can you say us more about this project with by example a new thread ?

                      Comment


                      • #12
                        Originally posted by Goddy View Post
                        I think I should get myself an Arduino + CAN bus shield and will play around with it.

                        I gathered some helpful links

                        http://www2.dasilvas.info/home/steering-wheel-buttons
                        http://secuduino.blogspot.nl/2011/10...a-english.html

                        As from the first link you can see it uses 2 wires only. Do you think it needs the CAN BUS low and high without the ground, it will it use only can low and ground?

                        Is it also possible with the Arduino to write a code to receive AND send commands? It would be great if I'm able to read steering wheel control buttons and possible update the DIS with useful info.
                        Very cool links !!!

                        Comment


                        • #13
                          Nice job rtgree01 with your install. I was looking at the mbed stuff as well. There are many ways to work with CAN BUS, I even seen some CAN BUS stuff built with the Raspberry Pi. You're more than welcome to use this thread for details of your CAN BUS integration as it fits with the title and this thread wasn't meant to be just about my implementation.

                          Goddy

                          Yes there are different networks in the car. My car has the Drive train, Comfort and infortainment busses. Some other VW's just have Drive Train and Comfort busses. Also some information is shared between the busses. You will have to poke around to see what's available.

                          Comment


                          • #14
                            Great, just ordered an Arduino One, a can bus shield and some kind of extended starters kit with tons of components. Can't wait to play around with it and start sniffing the bus. There are lots of possibilities with it.

                            Comment


                            • #15
                              I've been doing the same with a BMW,
                              I had also been doing all of my reverse engineering using an Arduino with a Canbus shield. I have now made my own version of this with the ATMEGA and CANBUS drivers.
                              For more information on my BMW work please see these links:-

                              http://www.mp3car.com/engine-managem...e84-k-can.html
                              http://www.mp3car.com/road-runner/15...k-can-bus.html

                              The little board I have made is shown below. I have been testing this for the past week in my car and it seems very stable. Essentially this is exactly the same as the Arduino with canbus shield, it's just a bit smaller



                              If you are using an Arduino with the Sparkfun Canbus Stack then writing back to the can bus is quite simple, you only need to send the ID, length and the relevant data packets. I can strobe the interior light with the routine / loop below.

                              Write 1E3 02 F1 FF
                              Delay 100mS
                              Write 1E3 02 F0 FF
                              Delay 500mS

                              If you are using the Sparkfun Can bus Stack with a BMW then you will need to add the line below to the Canbus.h file
                              #define CANSPEED_100 9 // CAN speed at 100 kbps

                              In case it is of use to anyone, I have uploaded the Arduino code and the library I use for streaming Canbus commands at the link below:-
                              http://www.loopybunny.co.uk/temp/Kcan.zip
                              The Canbus directory will need to be copied into the libraries directory of Arduino.

                              This is working with Arduino 0022. (You will need to change the name of some of the includes if you want to work with Rev 1.01 or later)
                              Note that I haven't included the code for writing back to the bus in this sketch. I haven't tidied that bit up yet!
                              My Projects:-

                              2010 BMW X1 install

                              1955 Austin A30 install

                              Comment

                              Working...
                              X