K line problem. OBD9141

Arduino Uno + L9637D transceiver (tried w/ and w/o pullup resistor between Vcc and Kline).

With this setup I can get raw data while sniffing diagnostic session initiated by diag tool.

The car is ISO9141 slow init at 10400 baud.

Tried this example code from OBD9141 library, but no communication. Any comments very welcome.

#include "Arduino.h"
// Be sure that the AltSoftSerial library is available, download it from http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html"
#include "AltSoftSerial.h"


#include "OBD9141.h"

#define RX_PIN 2  // connect to transceiver Rx
#define TX_PIN 3  // connect to transceiver Tx
//#define EN_PIN 10  //  pin will be set high (connect to EN pin of SN65HVDA100)

AltSoftSerial altSerial;

OBD9141 obd;


void setup(){
    Serial.begin(9600);
altSerial.begin(10400);
    delay(2000);
  //  pinMode(EN_PIN, OUTPUT);
  //  digitalWrite(EN_PIN, HIGH); // enable the transceiver IC.

    obd.begin(altSerial, RX_PIN, TX_PIN);

}
    
void loop(){
    Serial.println("Looping");

    bool init_success =  obd.init();
    Serial.print("init_success:");
    Serial.println(init_success);

   // init_success = true;
    // Uncomment this line if you use the simulator to force the init to be
    // interpreted as successful. With an actual ECU; be sure that the init is 
    // succesful before trying to request PID's.

    if (init_success){
        bool res;
        while(1){
            res = obd.getCurrentPID(0x11, 1);
            if (res){
                altSerial.print("Result 0x11 (throttle): ");
                altSerial.println(obd.readUint8());
            }
            
            res = obd.getCurrentPID(0x0C, 2);
            if (res){
                Serial.print("Result 0x0C (RPM): ");
                Serial.println(obd.readUint16()/4);
            }


            res = obd.getCurrentPID(0x0D, 1);
            if (res){
                Serial.print("Result 0x0D (speed): ");
                Serial.println(obd.readUint8());
            }
            Serial.println();

            delay(200);
        }
    }
    delay(3000);
}

So you can receive data but the example doesn't show speed, RPM, or throttle values? Perhaps the data format is different from what that OBD library expects?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Do you have the correct connections to the OBD socket?

Thanks.. Tom... :slight_smile:

the connection I use is attached.

K line is connected to OBD pin number 7.

Still having this problem (only sniffing works, can not transmit data).

L9637 k line.jpg

What does "+UB" connect to, OBD-II pin 16 (Battery Power)?

Is GND connected to both Arduino Ground and OBD-II Signal Ground?

arduino ground is connected to vehicle ground

UB is vehicle +12V

ruklis:
arduino ground is connected to vehicle ground

Chassis Ground (4) or Signal Ground (5) or both?

Hi,
What do you want to send to the BUS?

How will you know if you have successfully send a message?

To Tx you will need to have an ID and it must be recognizable to the BUS and the destination.

What are you trying to achieve?

Tom... :slight_smile:

arduino "power" connector is linked to car's ground and 12V.
Buffer IC gets ground via chassis, 5V from arduino.

I use another code for sniff data on K line while using oem diagnostic tool.

I get data then, so it looks it is wired correctly.

When try to initiate diag session with arduino, no data is sent to the car.