Announcement

Collapse
No announcement yet.

Is anyone interested in a plugin to control RR from a newer BMW using the K-CAN bus?

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

  • Is anyone interested in a plugin to control RR from a newer BMW using the K-CAN bus?

    I have been developing a plug-in and external hardware to interface between RR and the K-CAN of a BMW. This is still in development but it is working very well.

    I am using an Arduino and Canbus interface to passively listen to the BMW K-Can bus. (In layman's terms, the K-Can is a 100Khz interface that carries a plethora of car info and controls). For more info see :-_http://www.loopybunny.co.uk/CarPC/k_can.html
    Functions of the Arduino:-
    1) Read the Can-bus information and stream it out over a USB Com-port.
    2) Turn the PC and amplifiers on and off when the Lock and Unlock commands are seen.
    3) Replaces the Gong that sounds for the PDC, temperature and seat-belt's (Needed as I have removed the head-unit).
    I am also in the situation where I have added a Bluetooth module and I can stream the data to my Symbian Nokia N8. I guess it is only a small amount of work to create an Android plug-in or Windows phone app.

    The RR plug-in reads the data from the Com-port and parses the data into RR. The control and function is very similar to iBusRR and
    IBusCommunicatoRR.
    The plug-in had been tested and developed on an E84 BMW, but from what I have seen the E90 also works. If I was to have access to more logs I could probably extend it to other models (given time)

    A list of the Sliders, labels and Indicators that I have working are :-
    Code:
    KCanBusRR. Version 0.1 (Alpha)
    
    
    [Indicators Available]
    
    E84_LEFTIND  	; Left Indicator
    E84_RIGHTIND  	; Right Indicator
    E84_FOOT_BRAKE	; Foot brake pressed
    E84_CLUTCH	; Clutch depressed
    E84_REVERSE_SEL	; Reverse Gear Selected
    E84_WINDOW_FD	; Front Driver Window Open 
    E84_WINDOW_RD	; Rear Driver Window Open 
    E84_WINDOW_FP	; Front Passenger Window Open 
    E84_WINDOW_RP	; Rear Passenger Window Open 
    E84_DOOR_FD	; Front Driver door Open 
    E84_DOOR_RD	; Rear Driver door Open 
    E84_DOOR_FP	; Front Passenger door Open 
    E84_DOOR_RP	; Rear Passenger door Open 
    E84_LIGHTS	; Generic Indicator set if lights are on. (Side, Dip or Main)
    E84_HANDBRAKE	; Handbrake (Parking brake)
    E84_LIGHTS_SIDE	; Side Light Status
    E84_LIGHTS_DIP	; Dip Beam Status
    E84_LIGHTS_MAIN	; Main Beam Status
    E84_LIGHTS_FFOG	; Front Fog Light Status
    E84_LIGHTS_RFOG	; Rear Fog Light Status
    E84_CRUISE	; Cruise control on / off (See label E84_CRUSE_SPD for cruise control speed setting)
    E84_WIPERS	; Windscreen Wipers on / off (Set regardless of Wiper speed Int. / const or fast)
    
    
    
    
    [Labels available]
    
    E84_RPM		; Engine RPM (0 - 9999)
    E84_SPEED	; Engine Speed (MPH,As per Speedometer, 0-160)
    E84_ENGTEMP	; Engine Temperature (Engine, Water Temp, typ 92 DegC)
    E84_EXTTEMP	; External Temperature (As shown on instrument cluster)
    E84_THROTTLE	; Throttle position (0 - 100%)
    E84_VIN		; Displays the last 7 digits of the Vehicle VIN number. (Not sent very often)
    E84_PDC1	; Rear outer Left Sensor (0 - 255). 	Hint: Use Reverse gear indicator to signal the need to display these.
    E84_PDC2	; Rear inner Left Sensor (0 - 255) 	255 = nothing close, 0 = obstruction
    E84_PDC3	; Rear inner right Sensor (0 - 255)
    E84_PDC4	; Rear outer right Sensor (0 - 255)
    E84_RANGE_MI	; Range (Miles)
    E84_RANGE_KM	; Range (KM)
    E84_ODO_MI	; ODOMETER (Miles)
    E84_ODO_KM	; ODOMETER (KM)
    E84_Date	; Car Date (European format, d,m,yyyy)
    E84_Time	; Car Time
    E84_BATTERY	; Battery Voltage
    E84_FUEL_L	; Left Fuel tank sensor level  
    E84_FUEL_R	; Right Fuel tank sensor level
    E84_PROD_DATE	; Production date of the car
    E84_SECONDS_PROD; Seconds elapsed since production.
    E84_AMB_LIGHT	; Ambient Light Sensor reading (0 - xxx), The dimple on the top of the dashboard! 
    E84_SOLAR	; Solar Sensor reading (0 - xxx).changes air-con depending on heat of the sun.
    E84_WHEEL_POS	; Steering wheel angle in Degrees (- is right hand down, + is left hand down)
    E84_CUSTOM1	; Display the CANBUS data from the ID of custom1 as defined in the ini file.
    E84_CUSTOM2	; Display the CANBUS data from the ID of custom2 as defined in the ini file.
    E84_INT_TEMP	; Internal cabin temperature
    E84_CRUISE_SPEED; Cruise control speed setting. (Indicator E84_CRUISE shows status)
    E84_CL_FAN	; Climate control fans speed
    E84_CL_TEMP	; Master (Driver) Climate control temperature setting.
    E84_WHEEL_SPDFD ; Front Driver individual Wheel speed (Used by DSC / ABS / Run flat detection)
    E84_WHEEL_SPDFP ; Front Passenger individual Wheel speed 
    E84_WHEEL_SPDRD ; Rear Driver individual Wheel speed
    E84_WHEEL_SPDRP ; Rear Passenger individual Wheel speed 
    
    #Key number?
    
    
    
    [Sliders available]
    E84_SLD_SPEED	; Speed Slider, 0 - 140MPH
    E84_SLD_RPM	; REV Slider 0 - 5500RPM (Low values as its Diesel!) Should I add a Higher Petrol version?
    E84_SLD_THROTTLE; Throttle Slider 0 - 100% 
    E84_SLD_PDC1	; Rear outer Left Sensor (0 - 255). 	255 = nothing close, 0 = obstruction. Raw value indicators also available.
    E84_SLD_PDC2	; Rear inner Left Sensor (0 - 255) 	
    E84_SLD_PDC3	; Rear inner right Sensor (0 - 255)
    E84_SLD_PDC4	; Rear outer right Sensor (0 - 255)
    #add a slider for steering wheel?
    
    
    
    [Steering Wheel Control]
    Vol+ Button	; Master Volume +
    Vol- Button	; Master Volume -
    Up Button	; Next playlist item
    Down Button	; Previous playlist item
    Rotate Button	; Play / Pause
    Phone Button	; Next screen (as defined in the KCanBusRR.ini file)
    Voice Button	; Previous screen (as defined in the KCanBusRR.ini file)
    
    Press and hold functions not yet implemented
    
    
    Automatic Reverse Skin Select:
    To automatically select the REVERSE.SKIN when reverse gear is selected, set Auto_Reverse to 1 in the ini file.
    
    Automatic Night Gamma:
    To automatically switch on night gamma when the lights are turned on set Auto_Gamma to 1 in the ini file.
    
    Logging:
    To log all incoming CANBUS data to file set logging to 1 in the ini file.
    Note that logs for long journeys will be big. This should only be used for debugging .


    My main question is:- Is this of use or interest to anyone?
    I am thinking of developing my own little Arduino board (Processor, USB, Canbus and Bluetooth?). This would be more specific to the car environment and be a much more compact board.

    At the moment I am using the Arduino Uno with a Can-Bus shield, 12V switched supply etc. This costs about 45 or $70. I could make an application specific version for about 35 / $55 + shipping.



    *Note that I have not released the plug-in in any form (Alpha or release) as I still have a small amount of tidying up to do with the code. Also I still have to work out how to create an installer....

    Edit: Jan/2013. An alpha version of the code is available in post #15
    Last edited by TrevorC2; 01-21-2013, 09:24 AM.
    My Projects:-

    2010 BMW X1 install

    1955 Austin A30 install

  • #3
    If you can read boost pressure, air and oil temps, etc... I'll be very interested in this for my 335i.
    Cars:
    2001 Lexus es300 carpc Complete!Lexus es300 thread Retired
    Current: 2008 BMW 335i - carpc in development.

    Comment


    • #4
      Originally posted by spiike View Post
      If you can read boost pressure, air and oil temps, etc... I'll be very interested in this for my 335i.
      I think that it *should* be possible to read boost pressure, These are several ID's that have a quick and varied pattern to them, however I am less familiar with the readings obtained from things like, boost pressure, lambda sensors etc. I've now got hold of an OBD-II tool so I will try to sync up the readings from that with values from the K-can ID's.
      It is a time consuming task filtering and looking through ID's so this may take some time. The format of the values from the OBD-II ID's are different from that of the K-Can.
      My Projects:-

      2010 BMW X1 install

      1955 Austin A30 install

      Comment


      • #5
        That would be a very cool project . I should like to see also a project for the MOST bus (AUDI,VW,PORSCHE ect...) :-(

        Comment


        • #6
          I am interested in the ability to use the iDrive control with RR.

          I saw something from CarX/B7. Do you think that is something you can do?

          I'm just starting my research into carpc, mainly I started with soldering an aux in to the FM module, now I really want something that I can plug in my 500GB drive with all of the music.

          Comment


          • #7
            Sorry for Offtopic, but do you have the sourcecode of last IBUSCommunicatoRR version?
            RR-Skin: BMW OpenBM Skin for E39 [never ending progress :-(]
            RR-Plugin: IBusCommunicatoRR new Updates

            Comment


            • #8
              Sounds interesting, and the good thing is I already have an arduino and canbus shield. Will the plugin be hard coded to specific BMW canbus ID's or will we be able to map ID's to functions?

              Comment


              • #9
                Originally posted by lodac View Post
                I saw something from CarX/B7. Do you think that is something you can do?
                Yes you should able to do something like the CarX/B7 project. The control from the iDrive* and wheel buttons should be simple. It would just take time to create the skin for RR (there may even be one available anyway?, I'm sure that I have seen one previously)

                *I don't have the idrive wheel in my car to test, however I have seen logs from an E65 posted elsewhere in the web I *think* the ID's are the same.
                If anyone is passing Swindon and is willing for me to take a log of their iDrive buttons, please let me know. Alternatively I will have to wait unti I get my car serviced and I'll see if I can get an iDrive car as a courtesy car!!



                Originally posted by harryberlin View Post
                Sorry for Offtopic, but do you have the sourcecode of last IBUSCommunicatoRR version?
                I don't think that the source-code for IBUSCommunicatoRR or IbusRR have ever been released. If it had been released it would certainly have made my job easier.
                I'm not a software person and I have sent a great deal of the past month working out how to make my code robust. On the whole my RR plug-in works well but it still crashes more than I would like. I'm having to learn how to error trap my code...

                Originally posted by that_kid View Post
                Will the plugin be hard coded to specific BMW canbus ID's or will we be able to map ID's to functions?
                Ultimately I could add flexibility within the .ini file to allow different functions for different presses of the steering wheel buttons. I think that IBusRR has this function.
                All of the labels, sliders and Indicators will be hard-coded.
                Is there a reason to allow mapping of these ID's? Something specific you had in mind?


                Incidentally I have now upgraded the OS on my carPC to Windows 8. My install was a from my old E46, it hadn't been re-installed for 4-years and was getting long in the tooth. At the moment I am battling with UAC and getting RR to auto start at boot-up. With UAC disabled in the registry I can get RR to auto-run at boot-up. However this nails the Metro apps.... more investigation required.
                My Projects:-

                2010 BMW X1 install

                1955 Austin A30 install

                Comment


                • #10
                  excuse my ignorance being unfamiliar with arduino, but why not setting the plugin on an elm327 chip based obdII adapter but an arduino with canbus shield?

                  and yes, I would be interested in such hardware (without bluetooth) +software for RR if elm327 is not capable of doing the same thing.
                  Last edited by canstb; 01-01-2013, 03:14 PM.
                  Zotac Zbox id80
                  64Gb Sansdisk SSD
                  4Gb Ram, BU-353-S4 Gps
                  7" resistive touch screen
                  Win7 x86, BS 10.0.470, RR, Reborn,
                  KKCanBus, BT Mobilephone, igo8.3, Garmin

                  Comment


                  • #11
                    Originally posted by canstb View Post
                    excuse my ignorance being unfamiliar with arduino, but why not setting the plugin on an elm327 chip based obdII adapter but an arduino with canbus shield?

                    and yes, I would be interested in such hardware (without bluetooth) +software for RR if elm327 is not capable of doing the same thing.
                    My main reason for using the Arduino is that I am also using it for other functions :-
                    a) Turning the PC on when 'Unlock' signal is seen from the remote control keyfob. (And shutting down when the 'Lock' signal is sent)
                    b) Replicating the buzzer for things like PDC sensor, Cold temperature, etc.. (As I have removed the stereo and it used to do these functions)
                    c) Dimming the LCD display when the lights are turned on.

                    Admittedly, you could probably use the ELM327 to act as the interface but I was looking for a flexible development system.
                    My Projects:-

                    2010 BMW X1 install

                    1955 Austin A30 install

                    Comment


                    • #12
                      can you share the plugin and the sample skins for this please? I would like to see if I can get it working with elm327.
                      Zotac Zbox id80
                      64Gb Sansdisk SSD
                      4Gb Ram, BU-353-S4 Gps
                      7" resistive touch screen
                      Win7 x86, BS 10.0.470, RR, Reborn,
                      KKCanBus, BT Mobilephone, igo8.3, Garmin

                      Comment


                      • #13
                        I'm in the process of trying to get the Plugin to meet the release rules.
                        I need to create unique GUID's and remove one dependency on it being specifically installed in a certain directory.

                        I'll post it as soon as I have done that.
                        My Projects:-

                        2010 BMW X1 install

                        1955 Austin A30 install

                        Comment


                        • #14
                          cant wait for it. good luck...
                          Zotac Zbox id80
                          64Gb Sansdisk SSD
                          4Gb Ram, BU-353-S4 Gps
                          7" resistive touch screen
                          Win7 x86, BS 10.0.470, RR, Reborn,
                          KKCanBus, BT Mobilephone, igo8.3, Garmin

                          Comment


                          • #15
                            KCanBusRR install

                            Requirements:
                            Arduino UNO with CanBus Shield
                            .Net framework V4
                            Arduino Programming suite v0022 or v1.0.x

                            Step 1. Arduino
                            Download the file supplied below:-
                            http://www.loopybunny.co.uk/temp/Kcan.zip
                            This contains two directories:-
                            Copy the Canbus directory into the Libraries directory of the Arduino programmer
                            The other file is my Arduino sketch.
                            Compile and upload the Arduino Sketch* See note below if using Compiler 1.0.1 or 1.0.3


                            Step 2. Install the Plug-in
                            Unzip the folder below into the Plugins directory of RR
                            http://www.loopybunny.co.uk/temp/KCanBusRR.zip (Plugin name is KCanBusRR)
                            Register the DLL using Regasm, either by command line or via the RumMe1st.cmd in the KCanBuRR directory.
                            Change the com port in the .ini file
                            Change the skin names in the .ini file (Associated with the next and previous screen buttons)
                            Please read the Readme.txt file in this directory for more information on commands available.

                            Step 3.
                            Copy the skin example into a skin of your choice
                            http://www.loopybunny.co.uk/temp/Skin Example.zip
                            Edit your current skin to call the KCAN.skin screen

                            You should be then good to go.


                            Extra Info

                            Arduino Compiler Versions 1.0.1 or 1.0.3
                            Note that my programming has been done with v0022, but v1.03 should work. The Canbus library is currently written for v0022, If you are using 1.0.1 or 1.0.3 you will need to rename the #includes:-
                            Change #include "WConstants.h" to #include "Arduino.h", in files mcp2515.c and Canbus.cpp

                            I should be able to supply pre-programmed little boards in the next few weeks like the one here:-
                            http://www.loopybunny.co.uk/temp/Kcan_interface.jpg

                            What does the Arduino code do?
                            The Arduino passively reads all Canbus data and streams it out over USB. The format is shown below:-
                            CAN ID, Data length, data (Decimal)
                            0x1A6 8 0 0 0 0 2 0 240 240
                            0x1E1 6 212 241 0 255 255 255
                            0x0A8 8 33 36 26 32 26 240 15 0
                            0x0A9 8 109 68 205 223 39 205 223 252
                            0x1D0 8 112 255 72 194 0 0 205 166
                            0x1D6 2 192 12

                            Other functions of the Arduino:-
                            Pin 7: Can turn the Car-PC on and off (1 when on, 0 when off). Even at 5V output this can drive the Ignition wire of an M2-ATX-90W style Car-PC power supply. This pin gets set on power-up or key-fob unlock and turns off on Keyfob lock.
                            Pin 8: This pin can directly drive a little DC piezo buzzer. This will get set if the PDC Reverse sensors detect and object close.

                            Windows 8 users:
                            Note that, if your Plugins directory is within 'Program Files' you will have to move the KCanBusRR.ini file to your desktop, edit it and copy it back to the Plugins folder. (Damn UAC, this can be disabled with a registry key but all metro screens will fail to work!)

                            Fault finding.
                            If all Labels are blank, the dll has not been correctly registered. You may need to run Regasm as Administrator.
                            If all labels are showing '---' then the dll has been loaded but it is not seeing the COM port.
                            a) Has the COM port been set in the .ini file?
                            b) Has the Arduino been programmed and is it streaming data? (Test with a terminal emulator at 115200 baud). It should stream data out. If it is not streaming data, do you have the canbus wires the correct way round?
                            c) Are you sure the Canbus hasn’t gone to sleep? The BMW E84 goes to sleep after 50 seconds of inactivity, it will wake up again if a button is pressed, door opened or if the car started.

                            ##Currently known issues.##
                            When you press the central locking button from within the car, RR crashes! I am passing an illegal value back to a variable that I have not yet isolated.

                            This is my first attempt at sharing a plugin, it is still in Alpha stage. Please let me know I have made any errors with the instructions etc...
                            Last edited by TrevorC2; 01-23-2013, 10:26 AM.
                            My Projects:-

                            2010 BMW X1 install

                            1955 Austin A30 install

                            Comment

                            Working...
                            X