Elektroda.com
Elektroda.com
X

OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi

kmmepl 19068 14
This content has been translated flag-pl » flag-en View the original version here.
  • OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi This article will describe how to display and record car diagnostic information with a Raspberry Pi.





    Step 1: Required materials

    To complete this project you will need:
    o Raspberry Pi Model B or B +
    o Car stereo (must have an AUX socket)
    o Bluetooth adapter
    o Car charger
    o USB or Bluetooth adapter based on ELM327.
    o RCA cable
    o Keyboard (optional)

    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    Step 2: OBD II

    OBD (On-Board Diagnostics) is a standard system in cars sold after January 1, 2002 (in Poland). It provides access to data on the condition of individual vehicle systems (engine, gearbox, ABS, etc.). Vehicles compliant with the OBD-II standard should have a socket approximately 0.6 meters from the steering wheel. The connector itself has 16 pins and looks like the picture below.

    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    Step 3: PyOBD

    PyOBD (also known as pyOBD-II or pyOBD 2) is open source software designed to work with the ELM327 chip. For example, it allows information from the injection controller (ECU) to be displayed or to reveal fault codes. Various tests and readings of multiple statuses are also possible. The amount of information available depends on the car itself.

    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    Step 4: Installing the software

    Programming takes place here via the Raspian system with network access enabled. Communication with the computer is carried out using the USB TTL converter, however, it is allowed to use other methods of data exchange.

    Before installing, you should enter the following commands:

    This command pulls the latest package list:
    sudo apt-get update

    They are updated here:
    sudo apt-get upgrade

    Now we remove packages unused by any applications:
    sudo apt-get autoremove

    Finally, we restart the system:
    sudo reboot


    We continue by installing the programs necessary for the correct operation of the device.

     sudo apt-get install python-serial
     sudo apt-get install bluetooth bluez-utils blueman
     sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev
     sudo apt-get install git-core#  sudo reboot


    Then we download OBD-PI from this link or using the commands:
      cd ~
      git clone https://github.com/Pbartek/pyobd-pi.git


    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    Step 5: Connecting the Equipment

    1. First, insert the Bluetooth to USB adapter for the Raspberry Pi together with the SD card.
    2. Connect the OBD-II adapter to the corresponding socket in the car.
    3. We connect the Raspberry Pi with the car radio via the RCA cable.
    4. We power the raspberry using a car charger.
    5. Log in to Rpi and enter the command:
    6. Run BlueZ (Bluetooth service), and then pair the ELM327.
    7. We communicate with SPP - we should see this notification: "Serial port connected to dev / rfcomm0"
    8. Open the terminal and enter the following commands:
      cd pyobd-pi
      sudo su
      python obd_gui.py


    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    Step 6: Data Logging

    The actual reading of data in real time can sometimes be troublesome. So it is possible to collect and save various information and to read it later. To start downloading data, enter:
      cd pyobd-pi
      python obd_recorder.py


    The saved data will be available at the path:
    / home / username / pyobd-pi / log /

    OBD-Pi, i.e. vehicle self-diagnosis based on the Raspberry Pi


    source: http://www.instructables.com/id/OBD-Pi/?ALLSTEPS

    Cool? Ranking DIY
    Do you have a problem with Raspberry? Ask question. Visit our forum Raspberry.
    About Author
    kmmepl
    Level 13  
    Offline 
    kmmepl wrote 73 posts with rating 317, helped 7 times. Been with us since 2013 year.
  • #2
    gbd.reg
    Level 21  
    As a curiosity, I will add: in many newer cars, some or all signals from the OBD connector are also available in the cube from the factory radio, so you can hide the adapter entirely behind the radio and not occupy the diagnostic connector.
  • #3
    jaca_76
    Level 12  
    What is the RCA cable connected for?
  • #4
    Freddy
    Level 43  
    jaca_76 wrote:
    What is the RCA cable connected for?
    RPi transmission to the monitor.
  • #5
    nici
    Moderator Chiptuning
    gbd.reg wrote:
    As a curiosity, I will add: in many newer cars, some or all signals from the OBD connector are also available in the cube from the factory radio, so you can hide the adapter entirely behind the radio and not occupy the diagnostic connector.


    Right, we have CAN not only on Radio.
    Good point. Many of the buried modules have sufficient communication lines for diagnosis.
  • #6
    deus.ex.machina
    Level 32  
    It is a pity that there is no project that would not require an intermediary like ELM327 or STN11xx. Especially ELM327 is known for its low speed, but also STN11xx can be too slow.
    The best solution would be to implement the functionality natively on RPi (you would need a CAN translator for e.g. SPI, e.g. the popular MCP2515).
  • #7
    hubiwit
    Level 25  
    Quote:
    Right, we have CAN not only on Radio.
    In a fair point. Many of the buried modules have sufficient communication lines for diagnosis.


    Only CAN diagnostics comes from the gateway module, and there are several CAN buses in the car, the one from the radio does not include the engine, etc. Only the necessary data is sent between the buses - via the gateway module.
  • #8
    tatanka
    Level 20  
    hubiwit wrote:
    Quote:
    Right, we have CAN not only on Radio.
    In a fair point. Many of the buried modules have sufficient communication lines for diagnosis.


    Only CAN diagnostics comes from the gateway module, and there are several CAN buses in the car, the one from the radio does not include the engine, etc. Only the necessary data is sent between the buses - via the gateway module.


    This is not entirely true.
    Not all cars have a gateway.
    Not all cars have several different CAN buses.
    Not every radio has a CAN connected or other diagnostic option.
  • #9
    tzok
    Moderator of Cars
    By adding to the list:
    Some radios have (had) K-line.
  • #10
    Rinho
    Level 19  
    deus.ex.machina wrote:
    It is a pity that there is no project that would not require an intermediary like ELM327 or STN11xx. Especially ELM327 is known for its low speed, but also STN11xx can be too slow.
    The best solution would be to implement the functionality natively on RPi (you would need a CAN translator for e.g. SPI, e.g. the popular MCP2515).


    What speed you want to achieve, STN is enough to refresh data at ~ 10fps. Of course, if you want to display xx values, this speed will eventually start to drop, the fault is not the interface but the PCM, it also has limitations. The same thing happens when you use the manufacturer interface (at least I had the same feeling with VCM for Ford and Diagbox). The case is different when the driver already supports UDS :)
  • #11
    nici
    Moderator Chiptuning
    Regarding even the fast CAN and the VCDS interface with the EDC16 ECU, the reading of the parameters in the TURBO tripping also crashes ... for a slow transfer from the computer ..
    I was reading 4 values on the EGR channel. after 10 minutes it crashed.
  • #12
    deus.ex.machina
    Level 32  
    That's why he writes that it would be best to do it natively on RPi, and even better on some ARM that has CAN support as standard (add only SAE J1850 support and others if needed).
  • #13
    nici
    Moderator Chiptuning
    A more practical device would be plugged into the OB socket or permanently installed with one function. - CLEAR ALL DTC.

    For the average user, having the same self-diagnosis is unnecessary.
  • #14
    e_ster
    Level 12  
    It looks nice on such a large and legible display
  • #15
    bsw
    Level 20  
    Cool but ... basically what is it for? Because the author didn't write it.

    Who needs these opaque numbers on the screen? Besides, they are distracting and can cause an accident ...