Hack an ELM327 Cable to Make an Arduino OBD2 Scann

8
http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/ technology workshop living food play outside Hack an ELM327 Cable to make an Arduino OBD2 Scanner by mviljoen2 on October 10, 2014 Table of Contents Hack an ELM327 Cable to make an Arduino OBD2 Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: Hack an ELM327 Cable to make an Arduino OBD2 Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Prepare the ELM327 board to bypass the USB bridge chip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 2: Attach the Arduino LCD Shield to the arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 3: Hooking it up to your vehicle, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

description

Hack an ELM327 Cable to Make an Arduino OBD2 Scann

Transcript of Hack an ELM327 Cable to Make an Arduino OBD2 Scann

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    technology workshop living food play outside

    Hack an ELM327 Cable to make an Arduino OBD2 Scannerby mviljoen2 on October 10, 2014

    Table of Contents

    Hack an ELM327 Cable to make an Arduino OBD2 Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Intro: Hack an ELM327 Cable to make an Arduino OBD2 Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Step 1: Prepare the ELM327 board to bypass the USB bridge chip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Step 2: Attach the Arduino LCD Shield to the arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Step 3: Hooking it up to your vehicle, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    http://www.instructables.com/tag/type-id/category-technology/http://www.instructables.com/tag/type-id/category-workshop/http://www.instructables.com/tag/type-id/category-living/http://www.instructables.com/tag/type-id/category-food/http://www.instructables.com/tag/type-id/category-play/http://www.instructables.com/tag/type-id/category-outside/http://www.instructables.com/member/mviljoen2/?utm_source=pdf&utm_campaign=title

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    Intro: Hack an ELM327 Cable to make an Arduino OBD2 ScannerIn my previous instructable i created an OBD2 Simulator so that i didn't have to test my Arduino OBD2 Reader in the car the whole time but instead in the comfort of myown home.

    Stuff you need.

    Arduino UNO

    LCD shield

    ELM327 USB cable.

    What it can read

    Coolant Temp,IAT Temp,Ambient Temp, Throttle %,RPM,Vehicle Speed, Air flow Rate,Barometric Pressure

    I will be removing the board from the ELM327 Enclosure and then bypass the USB bridge chip and attach the Serial TX/RX pins of the arduino to the Serial TX/RX pinsonto the ELM327 board, program the arduino and attach the ELM327 OBD2 connector to the OBD2 port .

    Pretty Simple

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    Step 1: Prepare the ELM327 board to bypass the USB bridge chipStart by removing the sticker on ELM327 Cable's Enclosure, remove the 4 screws with a smallish star screwdriver.

    And then take out the board.

    Tip:Borrow your Girlfrien's/Wife's cutex and make a mark on one side of the connector that runs to the OBD2 Connector, that way when you take it out you will knowwhich side it goes because it can go in both ways, for this instructable its not needed to remove the mentioned connector though.

    Solder 2 wires to the TX and RX pins on the board, in the attached photo's i have included the pin-out information of the USB Bridge chip. Be careful though I managed tode-solder some components which i could not put back, but luckily it still worked afterwards.

    Tip:Program the arduino so that it writes to the serial monitor with some short delays in between, then connect a jumper cable to the TX pin of the arduino and pokearound with the other end on the board to see where you get some serial activity, the surface mounted LED's wil flicker as communication happens, unfortunately this willnot work for the RX side but in the pictures its easy enough to see where I soldered it onto the board.

    NOTE:The USB cable is connected to the board with a 4 pin connector, i cut the middle 2 out so that the ELM327 cannot communicate with the PC whilst its connected,this way it only gets power from my PC's USB port and the serial controller on the board will not be occupied by the PC allowing the Arduino to talk to it

    Once done put it back into the box, I just taped it up because In my Jeep the box is in my way and cannot drive it whilst in the driver seat, I will be using the enclosure forsomething else.

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    Step 2: Attach the Arduino LCD Shield to the arduinoAttach the Arduino LCD Shield to the arduino and hook it up to your PC to be programmed.

    Below is my Arduino Sketch, I noticed that the formatting messes with the code a bit, I have some more information available related to this build you can also view thecode here.

    http://techtinker.co.za/viewtopic.php?f=14&t=17

    // include the library code:#include

    //Declare Serial Read variablesint CmdCount=1;byte inData;char inChar;String BuildINString="";String DisplayString="";long DisplayValue;String SentMessage="";int ByteCount=0;long A;int B;int WorkingVal;String WorkingString="";

    //Declare Buttonsint MenuID=0;

    // initialize the library with the numbers of the interface pinsLiquidCrystal lcd(8, 9, 4, 5, 6, 7);

    void setup(){ // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0, 0); Bootup();//Simulate Bootup process doesnt have to be here this only makes it look cool Retry: lcd.setCursor(0, 0); lcd.print("Connecting...... "); lcd.setCursor(0, 1); lcd.print(" "); Serial.begin(38400);

    delay(500); //Send a test message to see if the ELM327 Chip is responding SentMessage = "ATI"; Serial.println("ATI");delay(500);ReadData(); if (BuildINString.substring(1,7)=="ELM327") { lcd.setCursor(0, 0); lcd.print("Welcome... "); lcd.setCursor(0, 1); lcd.print("Connection OK "); delay(1500); } else { lcd.setCursor(0, 0); lcd.print("Error "); lcd.setCursor(0, 1); lcd.print("No Connection! "); delay(1500); goto Retry; }

    delay(1500);}

    void loop() {int x;x = analogRead (0);//Serial.println(x);lcd.setCursor(10,1);if (x > 800 and x < 820){lcd.print ("Select ");}if (x > 620 and x < 630){if (MenuID>0){MenuID--;}delay(250);}//Leftif (x > 400 and x < 415){lcd.print ("Down ");}if (x > 190 and x < 215){lcd.print ("Up ");}if (x > -10 and x < 10){if (MenuID

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    void ReadData(){ BuildINString=""; while(Serial.available() > 0) { inData=0; inChar=0; inData = Serial.read(); inChar=char(inData); BuildINString = BuildINString + inChar; }

    //if(BuildINString!=""){Serial.print(BuildINString);} BuildINString.replace(SentMessage,""); BuildINString.replace(">",""); BuildINString.replace("OK",""); BuildINString.replace("STOPPED",""); BuildINString.replace("SEARCHING",""); BuildINString.replace("NO DATA",""); BuildINString.replace("?",""); BuildINString.replace(",",""); //Serial.print(BuildINString);

    //Check which OBD Command was sent and calculate VALUE //Calculate RPM I.E Returned bytes wil be 41 0C 1B E0 if (SentMessage=="01 0C") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0); WorkingString = BuildINString.substring(11,13); B = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = ((A * 256)+B)/4; DisplayString = String(DisplayValue) + " rpm "; lcd.setCursor(0, 1); lcd.print(DisplayString); } //Calculate Vehicle speed I.E Returned bytes wil be 41 0C 1B E0 if (SentMessage=="01 0D") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " km/h "; lcd.setCursor(0, 1); lcd.print(DisplayString); }

    //Coolant Temp if (SentMessage=="01 05") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " C "; lcd.setCursor(0, 1); lcd.print(DisplayString); }

    //IAT Temp if (SentMessage=="01 0F") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " C "; lcd.setCursor(0, 1); lcd.print(DisplayString); }

    //Air flow Rate if (SentMessage=="01 10") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0); WorkingString = BuildINString.substring(11,13); B = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = ((A * 256)+B)/100; DisplayString = String(DisplayValue) + " g/s "; lcd.setCursor(0, 1); lcd.print(DisplayString); }

    //Ambient Temp if (SentMessage=="01 46") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " C "; lcd.setCursor(0, 1); lcd.print(DisplayString); }

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    //Throttle position if (SentMessage=="01 11") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " % "; lcd.setCursor(0, 1); lcd.print(DisplayString); } //Barometric pressure if (SentMessage=="01 33") { WorkingString = BuildINString.substring(7,9); A = strtol(WorkingString.c_str(),NULL,0);

    DisplayValue = A; DisplayString = String(DisplayValue) + " kpa "; lcd.setCursor(0, 1); lcd.print(DisplayString); }}

    void Bootup(){lcd.print("WisperChip V2.00 "); for (int i=0; i

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    Related Instructables

    Arduino OBD2Simulator bymviljoen2

    Car datta loggerUsing OBD IIprotocol(atmega 2560+SD card + lcd16x2) byJohanpG

    Custom OBD IIGauge in WithOEM Look byJustinN1

    Mobile CarComputer byslwthr

    Use youriPhone to ScanVehicle CodesAnd ReadSensor Data byProblemS1

    Bench FlashingA GM PCM byrjkorn

    Advertisements

    Comments

    3 comments Add Comment

    atispixs says: Jan 13, 2015. 2:47 AM REPLYI already follow your instruction. The ELM327 hasreturn ELM327 by using ATI command. Yet when I send 01 0C or 01 0D toretrieve the RPM and speed, ELM327 is not seem to return the currentvalue. It is always 0 value. I hope you have any suggestion for me.Thank you for sharing your knowledge.

    liquidhandwash says: Jan 5, 2015. 12:15 AM REPLYThat is cool, great work

    http://www.instructables.com/id/Arduino-OBD2-Simulator/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Arduino-OBD2-Simulator/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Arduino-OBD2-Simulator/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/mviljoen2/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Car-datta-logger-Using-OBD-II-protocol-atmega-2560/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/JohanpG/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Custom-OBD-II-Gauge-in-With-OEM-Look/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Custom-OBD-II-Gauge-in-With-OEM-Look/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Custom-OBD-II-Gauge-in-With-OEM-Look/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Custom-OBD-II-Gauge-in-With-OEM-Look/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/JustinN1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Mobile-Car-Computer/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Mobile-Car-Computer/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Mobile-Car-Computer/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/slwthr/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Use-your-iPhone-to-Scan-Vehicle-Codes-And-Read-Sen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/ProblemS1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Bench-Flashing-A-GM-PCM/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Bench-Flashing-A-GM-PCM/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Bench-Flashing-A-GM-PCM/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/rjkorn/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/?utm_source=pdf&utm_campaign=comments#commentshttp://www.instructables.com/member/atispixs/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/atispixs/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/liquidhandwash/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/liquidhandwash/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/?utm_source=pdf&utm_campaign=comments#DISCUSS

  • http://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/

    seamster says: Oct 10, 2014. 3:18 PM REPLYThanks for sharing this!

    http://www.instructables.com/member/seamster/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/seamster/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Hack-an-ELM327-Cable-to-make-an-Arduino-OBD2-Scann/?utm_source=pdf&utm_campaign=comments#DISCUSS