i have posted the arduino program i used in a post
not to far from this one
i used this method to read the boost sensor signal
it may not work for all car but it’s worth a shot
..i short i used an obd program design for the arduino and tweaked a bit
normaly when you want an obd value you send 7df 01 and the data you want to read
in my case i was using torque to ask for a value that the car doesn’t display … and the car was just not responding to it….
and the arduino is monitoring the bus
when he see’s 7df 01 number you chose
the arduino just respond 7e8 41 the number you choose and the value from the arduino you want to send
here is a exemple
i just had to change some adress in the library in this case
normaly with an arduino obd program you send a request on 7df and listen to the answer on 7e8
so the filter are set to only let 7e8 thru
in this case i want to see only 7df and respond with 7e8
/*********************************************************************
* Mechanic – Hacking your car
*
* Copyright (C) 2013 Joerg Pleumann
*
* This example is free software; you can redistribute it and/or
* modify it under the terms of the Creative Commons Zero License,
* version 1.0, as published by the Creative Commons Organisation.
* This effectively puts the file into the public domain.
*
* This example is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* LICENSE file for more details.
*/
#include
ObdInterface obd;
ObdMessage out;
ObdMessage in;
int SensorValue = 0;
float PsiValue = 0;
float Temp;
int ValuePID90xA;
int ValuePID90xB;
int ValuePID08xA;
void setup() {
Serial.begin(115200);
//while (!Serial);
Serial.println();
Serial.println();
Serial.println(” ADDR LN MO PI D0 D1 D2 D3 D4?);
Serial.println(“——– — — — — — — — –“);
obd.setSlow(false);
obd.setExtended(false);
obd.setDebug(false);
obd.setNoFilter(false); // Show all messages, not just ECU answers
obd.begin();
out.address = 0x7e8;
out.mode = 0x41;
}
void loop() {
if (obd.receiveMessage(in)) {
Serial.println(in);
if (in.pid == 0x90) { // Si pid est 90 envoie la valeur courante
Serial.println(“sending”);
Serial.print(” PID 0x90,Sensor “);Serial.print(SensorValue);
Serial.print(” Psi: “); Serial.print(PsiValue);
Serial.print(” A: “); Serial.print(ValuePID90xA);
Serial.print(” B: “); Serial.println(ValuePID90xB);
out.address = 0x7e8;
out.length = 0x4;
out.pid = 0x90;
out.values[0] = ValuePID90xA;
out.values[1] = ValuePID90xB;
obd.sendMessage(out);
}
if (in.pid == 0x08) { // Si pid est 08 envoie la valeur courante
Serial.println(“sending”);
Serial.print(” PID 0x08,Sensor “);Serial.print(SensorValue);
Serial.print(” A: “); Serial.println(ValuePID08xA);
out.address = 0x7e8;
out.length = 0x4;
out.pid = 0x08;
out.values[0] = ValuePID08xA;
out.values[1] = 0;
obd.sendMessage(out);
}
}
// Valeur pour PID 0x90
SensorValue = analogRead(A0) + 1;
PsiValue = (45.6125*SensorValue/1024) + 0.148721; // 5 Volts ou 1024 = 45.6125 Psi, 0.148721 il y a un leger offset dans les valeurs
ValuePID90xA = (int) PsiValue;
Temp = (PsiValue – ValuePID90xA) * 100;
ValuePID90xB = (int) Temp;
/*
Serial.print(” PID 0x90,Sensor “);Serial.print(SensorValue);
Serial.print(” Psi: “); Serial.print(PsiValue);
Serial.print(” A: “); Serial.print(ValuePID90xA);
Serial.print(” B: “); Serial.println(ValuePID90xB);
*/
// Valeur pour PID 0x08
ValuePID08xA = map(SensorValue,0,1024,0,256); // 5 Volts ou 1024 = 45.6125 Psi et modifier en 0 a 255 et envoye comme pid de short trim bank 2
/*
Serial.print(” PID 0x08,Sensor “);Serial.print(SensorValue);
Serial.print(” A: “); Serial.println(ValuePID08xA);
*/
delay(20);
}
torque pid
ps … for speed i would say usb is faster BUT
car bus are most of the time the limiting factor not the bluetooth speed
|