Giter VIP home page Giter VIP logo

can-we-talk's Introduction

CAN we talk Python?

Build Status LICENSE

Talking to your vehicle over the CAN bus with Python

Overview

When properly configured and connected to your vehicle's OBD-II port, this Python3 program retrieves the following information from the vehicle:

  • The specific OBD standard this vehicle conforms to
  • The vehicle's current fuel tank level
  • The time, in seconds, since the engine was powered on

Prerequisites for success:

  • A vehicle powered on (motor on)
  • A CAN connection to the OBD-II CAN bus from your computer

Getting Started

Linux Dependencies

  • python3 (sudo apt install python3)

Windows Dependencies

Python 3 Dependencies

  • pip3 install -r requirements.txt --user

CAN Hardware requirements

OBD-II to DB9 Cable CAN USB Adapter

Usage

See the doc string in can_we_talk.py or run ./can_we_talk.py -h for usage specifics.

Usage Notes

Linux

On a Linux system socketcan is a default so can_we_talk.py can rely on the default settings for bustype and channel. After initializing the socketcan interface with:

 sudo ip link set can0 type can bitrate 500000
 sudo ip link set up can0

you can run:

# Default Linux usage
./can_we_talk.py

Windows

On a Windows system socketcan is not available so the bustype and channel must be specified.

If you've installed the Kvaser SDK you need to run:

# Default Kvaser CANlib usage
./can_we_talk.py -c 0 -b kvaser

Using PCAN drivers you can run:

# Default PEAK PCAN-USB usage
./can_we_talk.py -c PCAN_USBBUS1 -b pcan

Running the tests

You can run the tests with pytest, i.e. python3 -m pytest --verbose

Further Reading

OBD-II PIDs

Further Watching

This project supplemented a talk titled CAN we talk Python? Talking to your vehicle over the CAN bus with Python, first given at the PDX Python User Group in July of 2018. You can watch the video here.

can-we-talk's People

Contributors

codenamebip avatar deepsource-autofix[bot] avatar deepsourcebot avatar shnewto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

can-we-talk's Issues

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.