OBD2 ELM327 Clone
#1
wer hat Lust mal was zu basteln?

https://www.obdsol.com/solutions/chips/stn1110/


kann man fix und fertig aufgebaut in DL bei EXP-Tech beziehen:

https://www.exp-tech.de/obd-ii-uart

übertrifft jeden ELM327!

Kann man recht leicht am Arduino anschließen:

[Bild: 51a7ae23ce395f9d11000003.png]
Bildrechte bei Sparkfun!!

Software:

Code:
#include <SoftwareSerial.h>

//Create an instance of the new soft serial library to control the serial LCD
//Note, digital pin 3 of the Arduino should be connected to Rx of the serial LCD.

SoftwareSerial lcd(2,3);

//This is a character buffer that will store the data from the serial port
char rxData[20];
char rxIndex=0;

//Variables to hold the speed and RPM data.
int vehicleSpeed=0;
int vehicleRPM=0;

Code:
void setup(){
  //Both the Serial LCD and the OBD-II-UART use 9600 bps.
  lcd.begin(9600);
  Serial.begin(9600);

  //Clear the old data from the LCD.
  lcd.write(254);
  lcd.write(1);  

  //Put the speed header on the first row.
  lcd.print("Speed: ");
  lcd.write(254);
  //Put the RPM header on the second row.
  lcd.write(128+64);
  lcd.print("RPM: ");

  //Wait for a little while before sending the reset command to the OBD-II-UART
  delay(1500);
  //Reset the OBD-II-UART
  Serial.println("ATZ");
  //Wait for a bit before starting to send commands after the reset.
  delay(2000);

  //Delete any data that may be in the serial port before we begin.
  Serial.flush();
}

Code:
void loop(){
  //Delete any data that may be in the serial port before we begin.  
  Serial.flush();
  //Set the cursor in the position where we want the speed data.
  lcd.write(254);
  lcd.write(128+8);
  //Clear out the old speed data, and reset the cursor position.
  lcd.print("        ");
  lcd.write(254);
  lcd.write(128+8);
  //Query the OBD-II-UART for the Vehicle Speed
  Serial.println("010D");
  //Get the response from the OBD-II-UART board. We get two responses
  //because the OBD-II-UART echoes the command that is sent.
  //We want the data in the second response.
  getResponse();
  getResponse();
  //Convert the string data to an integer
  vehicleSpeed = strtol(&rxData[6],0,16);
  //Print the speed data to the lcd
  lcd.print(vehicleSpeed);
  lcd.print(" km/h");
  delay(100);

  //Delete any data that may be left over in the serial port.
  Serial.flush();
  //Move the serial cursor to the position where we want the RPM data.
  lcd.write(254);
  lcd.write(128 + 69);
  //Clear the old RPM data, and then move the cursor position back.
  lcd.print("          ");
  lcd.write(254);
  lcd.write(128+69);

  //Query the OBD-II-UART for the Vehicle rpm
  Serial.println("010C");
  //Get the response from the OBD-II-UART board
  getResponse();
  getResponse();
  //Convert the string data to an integer
  //NOTE: RPM data is two bytes long, and delivered in 1/4 RPM from the OBD-II-UART
  vehicleRPM = ((strtol(&rxData[6],0,16)*256)+strtol(&rxData[9],0,16))/4;
  //Print the rpm data to the lcd
  lcd.print(vehicleRPM);

  //Give the OBD bus a rest
  delay(100);

}

Code:
/The getResponse function collects incoming data from the UART into the rxData buffer
// and only exits when a carriage return character is seen. Once the carriage return
// string is detected, the rxData buffer is null terminated (so we can treat it as a string)
// and the rxData index is reset to 0 so that the next string can be copied.
void getResponse(void){
  char inChar=0;
  //Keep reading characters until we get a carriage return
  while(inChar != '\r'){
    //If a character comes in on the serial port, we need to act on it.
    if(Serial.available() > 0){
      //Start by checking if we've received the end of message character ('\r').
      if(Serial.peek() == '\r'){
        //Clear the Serial buffer
        inChar=Serial.read();
        //Put the end of string character on our data string
        rxData[rxIndex]='\0';
        //Reset the buffer index so that the next character goes back at the beginning of the string.
        rxIndex=0;
      }
      //If we didn't get the end of message character, just add the new character to the string.
      else{
        //Get the new character from the Serial port.
        inChar = Serial.read();
        //Add the new character to the string, and increment the index variable.
        rxData[rxIndex++]=inChar;
      }
    }
  }
}


mehr Lesestoff:

https://learn.sparkfun.com/tutorials/obd...okup-guide


ich werde mir das Board kaufen und an einem Raspberry Pi in Betrieb nehmen und eine GUI stricken Prost!


Mitstreiter willkommen........und das Teil ist nicht nur aber auch für die C5 und C6 benutzbar!





  Zitieren


Nachrichten in diesem Thema
OBD2 ELM327 Clone - von Tom V - 01.09.2015, 19:01
[Kein Betreff] - von cowi-c5 - 01.09.2015, 19:14
[Kein Betreff] - von Tom V - 01.09.2015, 19:18
[Kein Betreff] - von cowi-c5 - 01.09.2015, 23:31
[Kein Betreff] - von cooper - 01.09.2015, 23:32
[Kein Betreff] - von Tom V - 02.09.2015, 06:54
[Kein Betreff] - von CustosOnLinux - 02.09.2015, 08:08
[Kein Betreff] - von cooper - 02.09.2015, 22:34
[Kein Betreff] - von Zaphod - 03.09.2015, 08:11
RE: OBD2 ELM327 Clone - von CustosOnLinux - 07.10.2016, 12:02

Möglicherweise verwandte Themen...
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Obd2 Corvette.ZR1 0 12.146 06.06.2017, 21:11
Letzter Beitrag: Corvette.ZR1
  OBD2 Diagnosegerät .. Welches funktioniert bei der C6? (ASR-Störung!) Wer weiss Rat? wormser68 13 29.814 14.11.2013, 08:46
Letzter Beitrag: TobiasB
  Aufbau einer VIN im OBD2 J1850 Datenstrom Tom V 1 13.054 07.09.2013, 19:09
Letzter Beitrag: Tom V
  OBD2 / Class2 Busadressen der C5 Tom V 0 11.284 06.09.2013, 21:41
Letzter Beitrag: Tom V

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Forenübersicht
Technikforen
-- C 1 Technikforum
-- C 2 Technikforum
-- C 3 Technikforum
-- C 4 Technikforum
---- C4 ZR-1 Technikforum
-- C 5 Technikforum
---- C5 Z06-Technikforum
-- C 6 Technikforum
---- C6 Z06-Technikforum
---- C6 ZR1-Technikforum
-- C7 Technikforum
---- C7 Z06 Technikforum
-- C8 Diskussionsforum
-- Tuningforum
-- Allgemeines Technikforum
---- OBD2
Other Vette-Stuff
-- Man sieht sich
---- Nachbetrachtungen
---- Stammtische Deutschland
------ Baden-Württemberg
------ Bayern
------ Berlin/Brandenburg
------ Hessen
------ Nordrhein- Westfalen
------ Niedersachsen/HB/HH
------ Rheinland-Pfalz
------ Sachsen
------ Thüringen
------ Schleswig Holstein
---- Stammtische Österreich
------ Wien / St. Pölten
---- Stammtische Schweiz
------ Ostschweiz/Vorarlberg
------ Treffen Schweiz
-- Jäger & Sammler
-- Vettetalk
---- Reiseberichte
-- Corvette-Bilder der Mitglieder
---- Membervideos
-- Sonstige Schöne Vettepics
---- Corvettevideos
-- Vettelady's Corner
-- Wissenswertes & Kurioses
-- Werkstätten & Händler
-- CORVETTE & Parts - For Sale!
---- laufende Auktionen bei EBAY
---- Transporthilfeforum
---- for sale - Alles ohne Corvette!
-- Wanted !
-- Wer weiß was
---- Fragen vor dem Kauf
-- Paragraphen & Pamphlete
Smalltalk und Forumsschnack
-- Über dieses Forum
---- Teammitteilungen
---- In Memoriam
-- Hallo, ich bin's!
-- Motorsport
-- Off Topic
---- Jux & Dallerei
---- Das Club-Forum
---- Don't feed the troll!
-- Glückwunsch- und Grußforum
-- Bits und Bytes
-- Comic-Forum
-- Das Modellautoforum
-- Testforum
Händlerangebote
-- Info-Forum
-- ACP Euskirchen
-- Dyno-Center
-- KTS American Parts
-- Corvetteproject (Molle)
-- Schmidt Revolution
-- NCRS Central Europe
-- IDP-CORVETTE ( INJA )
-- TIKT Performance Parts
-- BG Sportwagen
-- SPEEDSTYLE
-- V8Lounge
-- AVI Schilling & Wendt Assekuranzmakler
-- Autosalon am Park GmbH
-- NCRS Central Europe
-- Hoffmann Classics
-- CCRP Austria
-- RockAuto.com
-- Stingrays-Shop.com
-- corvetteparts.de