Git Product home page Git Product logo

ofxautomobile's Introduction

ofxAutomobile

ofxAutomobile is an openFrameworks add-on for communicating with vehicles using the OBD2 (On-Board Diagnostics) protocol. It provides a simple interface for connecting to OBD2 adapters (such as ELM327) over a serial connection and sending OBD2 commands to query various vehicle parameters, such as engine speed, coolant temperature, and throttle position.

Usage

Method Description
bool setup(const std::string& port_name, int baud_rate = 115200) Initializes the OBD2 connection with the specified serial port and optional baud rate. Returns true on success, false otherwise.
bool query(const std::string& command, std::string& response) Sends an OBD2 command and reads the response. Returns true on success, false otherwise.

Simulate your application

tools/obd2_simulator.py simulates an OBD2 adapter using the ELM327 command set. It listens for OBD2 commands on a specified serial port and sends random responses for a few common OBD2 PIDs.

Requirements

  • Python 3.6 or higher
  • pyserial

Installation

  1. Install the required pyserial library:
$ pip install pyserial

Usage

Run the OBD2 simulator by specifying the port and baud rate as command-line arguments:

$ python tools/obd2_simulator.py --port /dev/ttyVUSB2 --baudrate 115200

Replace /dev/ttyVUSB2 with the desired virtual serial port and 115200 with the desired baud rate.

Command-line Arguments

  • -p, --port: Required. Serial port for the OBD2 simulator.
  • -b, --baudrate: Optional. Baud rate for the OBD2 simulator (default: 115200).

Supported OBD2 Commands

The simulator currently supports the following OBD2 commands:

  • ATZ: Reset command
  • 0105: Engine Coolant Temperature
  • 010C: Engine RPM
  • 010D: Vehicle Speed
  • 0111: Throttle Position

You can expand the handle_command method in the obd2_simulator.py script to support more OBD2 commands as needed.

ofxautomobile's People

Contributors

haradama avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.