2017 © Pedro Peláez
 

library obd

ELM327 OBD-II class for vehicle self-diagnostics, written in PHP

image

mdlayher/obd

ELM327 OBD-II class for vehicle self-diagnostics, written in PHP

  • Tuesday, March 19, 2013
  • by mdlayher
  • Repository
  • 7 Watchers
  • 15 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

obd

ELM327 OBD-II class for vehicle self-diagnostics, written in PHP, (*1)

Installation

To install using Composer, add "mdlayher/obd": "dev-master" to the require section of your composer.json., (*2)

Usage

Connect an ELM327 OBD-II device using serial interface, and point the class at its device file location. Optionally, a baud rate, preferred unit system, and verbosity may be specified., (*3)

<?php
    // obd demo
    require_once __DIR__ . "/vendor/autoload.php";
    use \obd\obd as obd;

    // Open serial connection
    $obd = new obd("/dev/pts/1", obd::BAUD_FAST);
    $obd->connect();

    // Run a few basic commands
    $commands = array("AT I", "AT RV", "AT DP");
    printf("Basic commands:\n");
    foreach ($commands as $c)
    {
        printf("\t%s -> %s\n", $c, $obd->command($c));
    }

    // Call all parameter ID (PID) functions using English units
    printf("English:\n");
    foreach ($obd->pid as $key => $p)
    {
        printf("\t%s: %s\n", $key, $p());
    }

    // Switch to Metric and call a few functions
    $obd->set_units(obd::UNIT_METRIC);
    printf("Metric:\n");
    printf("\tfuel_pressure: %s\n", $obd->pid['fuel_pressure']());
    printf("\tspeed: %s\n", $obd->pid['speed']());

The Versions

19/03 2013

dev-master

9999999-dev https://github.com/mdlayher/obd

ELM327 OBD-II class for vehicle self-diagnostics, written in PHP

  Sources   Download

MIT

The Requires

 

obd obd-ii elm327