Freematics OBD-|| TTL Adapter fails to initiate

Hi,

im working on a project to read the speed of my car, but it fails to initiate the OBD-ll TTL Adapter. Everything works just fine as long as i don't include the OBD-ll Adapter. Somehow, when im looking in the Serial Monitor it puts out some weird stuff. I'm using RPM for testing, so i don't need to drive while testing it. Because of that i've got the *1 included in the loop. Aswell im using a Sparkfun Serial 7-Segment display. Also, I'm sending the data via I²C to the display.

Here the code:

#include <OBD.h>
#include <Wire.h>
#include <SoftwareSerial.h>


COBD obd;

#define rxPin 6
#define txPin 5

int kmh;
float test;
int hkmh;
int tkmh;
int okmh;

void setup()
{
  obd.begin();
  obd.setBaudRate(9600);
  Serial.println("I2C Test");
  Wire.begin();
  Wire.setClock(100000);
  Wire.beginTransmission(0x71);
  Wire.write(0x76);
  Wire.write("[");
  Wire.write("-");
  Wire.write("-");
  Wire.write("]");
  Wire.endTransmission();
  Serial.println("Setup done");
  while (!obd.init());
}

void loop()
{
  obd.readPID(PID_RPM, kmh);
  test = kmh;
  hkmh = ( test * 1 ) / 1000 ;
    tkmh = ( ( test * 1 ) - ( hkmh * 1000 ) ) / 100 ;
      okmh = ( ( test * 1 ) - ( hkmh * 1000 ) - ( tkmh * 100 ) ) / 10 ;

  Wire.beginTransmission(0x71);
  Wire.write(0x76);
  Wire.endTransmission();
  Wire.beginTransmission(0x71);
  Wire.write("-");
  Wire.write(hkmh);
  Wire.write(tkmh);
  Wire.write(okmh);
  Wire.endTransmission();
  delay(100);
}

The Serial Monitor prints this:

16:22:40.316 -> ATZ
⸮⸮⸮⸮⸮!⸮
I2C Test
16:22:46.597 -> Setup done
16:22:46.597 -> ATZATZ

obviously the error comes from the obd.init. After it says that the setup is done it keeps printing ATZ.

An image of the wiring is attached.

Thanks for your help

I have not delved into the OBD library that you are using but this, in your code, seems odd to me:

  obd.begin();
  obd.setBaudRate(9600);
  Serial.println("I2C Test");

You have not instated Serial (ie Serial.begin), you seem to successfully print "I2C Test" to serial monitor!

That would suggest to me that 'obd' is using the hardware Serial... and if that is the case might explain why you having a problem when you include the OBD-ll Adapter....

I've included Serial.begin(9600); in the setup code and it didn't change much.
Now it prints

17:31:06.657 -> ⸮⸮⸮⸮⸮⸮!⸮I2C Test
17:31:12.939 -> Setup done
17:31:12.939 -> ATZATZ

I used the code they said how to setup the OBD.