MICILE EZ_OBD2 Documentation
version: 0.9
A few notes about our documentation:
  • The intentions of this documentation are to keep things simple.
  • Please see the examples at the end of each section for concrete examples of how to use each function.
  • If in doubt how to use a function, experiment!
  • We don't believe in writing more words just to make the documentation look more substantial
  • Quick Reference
    Function List

    Constants Table
    Compatible Devices
    Generic OBD2 ELM327 Bluetooth Dongle
    ebay / amazon
    Generic OBD2 ELM327 USB Adapter
    eBay / Amazon

    * Please contact us for information on adding support for a device.


    OBD2 Functions
    obd2_connect_bluetooth(device_addr, pincode)
    Connects to a bluetooth based OBD2 dongle. The device_addr should contain the bluetooth address
    of the OBD2 dongle in a string, i.e. "00:0D:B5:02:E1:18". The pincode should contain the pincode
    in string format to authenticate with the GPS receiver, i.e. "1234"
    obd2_connect_serialport(serial_port)
    Connects to serial port based OBD2 dongle, either through a USB to serial converter or
    a USB based OBD2 dongle which exposes a serial port. A typical serial_port value would
    be "/dev/ttyUSB0".
    obd2_get_pid_description(pid)
    Returns a human readable description for the pid specified in the pid parameter.
    The pid parameter should be specified as an integer or an OBD2 constant.
    If the pid is unknown, than the description returned will simply be "PID" followed by the pid number.

    See the OBD2 PID Constants Table for a list of available OBD2 PIDs.
    obd2_read_pid_parameter(pid)
    Returns the current value that the ECU has for the pid specified in the pid parameter.
    The pid parameter should be specified as an integer or an OBD2 constant.

    See the OBD2 PID Constants Table for a list of available OBD2 PIDs.
    obd2_send_command(command)
    Sends an arbitrary command to the OBD2 dongle and returns the response as a string.
    This allows access to advanced features of the OBD2 dongle and is for advanced users only.
    # --------------------------------------------------
    # obd2_demo.py
    # --------------------------------------------------
     
    # import the ez_obd2_09 and ez_graphics_09 libraries
    from ez_obd2_09 import *
    from ez_graphics_09 import *
     
    # clear the screen
    clear_screen('black')
    set_text_size(20)
    draw_text('OBD2 Demo'1010'white')
     
    # handle any errors
    try:
        # connect to the obd2 bluetooth reader
        BT_DEVICE_ADDRESS='00:0D:18:3A:67:89'   # change to match your reader
        BT_DEVICE_PINCODE='1234'                # change to match your pincode
        draw_text('Connecting to OBD2'1030'white')
        obd2_connect_bluetooth(BT_DEVICE_ADDRESSBT_DEVICE_PINCODE)
     
        # find all supported parameter IDs
        draw_text('Reading Supported Parameter IDs'1050'white')
        supported_pids = obd2_read_pid_parameter(OBD2_SUPPORTED_PIDS)
     
        # loop through and print out values
        draw_text('Querying Sensors'1070'white')
        set_text_size(12)
        y = 110
        for pid in supported_pids:
            desc = obd2_get_pid_description(pid)
            value = obd2_read_pid_parameter(pid)
            draw_text(str(desc),   30y'yellow')
            draw_text(str(value)200y'cyan')
            y = y + 12
    except Exceptione:
        # show the error
        draw_text('Error! %s' % str(e)1090'red')

    obd2 demo