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);
}
