#interface #vehicle #data #command #reading #devices #obd-ii

obd2

Utility for reading data from a vehicle over OBD-II

4 releases

0.2.0-pre3 May 21, 2023
0.2.0-pre2 May 16, 2023
0.2.0-pre1 May 15, 2023
0.1.0 May 15, 2023

#1578 in Hardware support

27 downloads per month

MIT/Apache

340KB
699 lines

obd2

This library provides a user-friendly interface to automatically configure an ELM327 OBD-II to UART interface through an FTDI UART to USB interface (the entire setup is easily available online as an OBD-II to USB interface), and then send commands and receive data from a vehicle.

Usage

use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};

fn main() -> Result<(), obd2::Error> {
    let mut device = Obd2::<Elm327>::default();
    println!("VIN: {}", device.get_vin()?);
    Ok(())
}

See the docs for more: https://docs.rs/obd2/


lib.rs:

Crate for communicating with OBD-II (on-board diagnostics) interfaces on cars

Currently only the ELM327 is supported (many cheap USB to OBD-II devices you can buy online are compatible with the ELM327). The high-level data retrieval functions can be found in commands::Obd2DataRetrieval.

Usage

use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};

fn main() -> Result<(), obd2::Error> {
    let mut device = Obd2::<Elm327>::default();
    println!("VIN: {}", device.get_vin()?);
    Ok(())
}

Dependencies

~3.5–5.5MB
~93K SLoC