Git Product home page Git Product logo

pybus's Introduction

I'm archiving this fork in favor of my more streamlined Go port gokbus

I-BUS interface for my E46 BMW written in Python 2.7. BMW's I-BUS (DE: K-BUS) is a proprietary serial communication line similar to CAN, but used primarily for exchanges between "non-essential" modules like A/C or radio. Here's a great writeup.

Overview

  • USB serial interface can be acquired from Reslers.de. Other USB interfaces should work just as well, although are untested.
  • Communicates on the I-BUS to send and receive diagnostics, running status, button presses, vehicle info, etc.
  • Can map steering wheel controls to various functions.
  • Can listen for and subsequently run external directives/utilities. (Unlocking the car from your phone, for example)

Warning

K/I-BUS issues can be difficult to diagnose and fix, so please don't use this to mess up your car. Each E46 sends different bus packets depending on the car's year and configuration. This likely won't be plug & play.

Pre-Requisites

  • python & python-setuptools
    • sudo apt-get install python python-setuptools
  • pyserial & requests
    • pip install pyserial requests

Optional Features

  • MDroid-Core (defined by --with-api) is a REST interface allowing time-series logging, Bluetooth control, and receiving commands from an external interface. It also makes logging other data such as OBD or GPS pretty seamless.

Note: this branch has been slashed of features. I wanted to avoid a one-size-fits-all program since growing requirements will make this unwieldy. This is now first and foremost an I-BUS interface.

  • More Native Features including Bluetooth, MySQL logging, and remote files can be found on an earlier branch.

Quick Start

  • Install the prerequisites above
  • Plug in iBus USB device
  • Run: ./pyBus.py --device <PATH to USB Device>
    • E.g. ./pyBus.py --device /dev/ttyUSB0

Advanced Usage

./pyBus.py --device <PATH to USB Device> --with-api http://localhost:5353 --with-session <PATH to session file>

A Longer Drive

The meat and potatoes lie in pyBus_eventDriver.py - in there you'll find a large list of both Directives and Utilities. Generally speaking Directives are reactive, defining what happens when the interface reads specific activity. Utilities meanwhile are active, and are designed to emulate specific functions.

For example: when running this hypothetical directive (which calls a utility), we'd run in an endless loop:

# openTrunk would emulate the car, and the interface would subsequently read d_trunkOpen
d_trunkOpen(packet):
	openTrunk()

Utilities can be used for doing things in addition to the car's normal function. Mind you, we can never completely remap.

# Will skip media backwards AND put the convertible top down
d_steeringPrev(packet):
	convertibleTopDown()

With Utilities and Directives we have a competent system for both logging and executing the car's various functions.

Useful links

http://web.archive.org/web/20041204074622/www.openbmw.org/bus/
http://web.comhem.se/bengt-olof.swing/ibusdevicesandoperations.htm
http://www.online-rubin.de/BMW/I-Bus/I-BUS%20Codes%20e46.htm

pybus's People

Contributors

qcasey avatar ezeakeal avatar dvagg-fh avatar adark47 avatar

Watchers

 avatar Bryan Smith avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.