Hi.
What communication method is faster? USB or Bluetooth?
And second question.
I don't have a few sensors on ODB (f.e. Oil Pressure). I want add this with Arduino. Is any method to connect USB OBD and BT arduino to Torque or i must wait for some update?
just use a NO tooth arduino lol
i used the arduino to insert the data into the communication bus it self ... and then read it with the obdii reader
Can you explain how to insert additional data to communication bus?
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
hello.. i think usb is fater method than youtube...and easier as well
So this part:
if (obd.receiveMessage(in)) {
Serial.println(in);
is responsible for OBD communication like normal OBD adapter?
Can you give link for OBD library?
I don't remember where i got this library
but i'm sure there are lots of them out there
if i remember correctly you can find some files with the canbus adapter chip
for the code
is short the program wait for the message in variable to be non zero then get into the if command
in my case i had to modify the filter
since normaly you send request and the filter just let pass the response adress
but in our case we want to see the request adress
did some research think you will find it here
and some program for sniffing and other stuff
https://github.com/happyjaxx/mechanic
personnaly i started with an aduino and a canbus card
but i used this one for some of my project, it's way smaller
http://www.hobbytronics.co.uk/leonardo-canbus
since the can bus in part of the chip
it support car voltage but regulator tend to get hot
here is a link of some of my library
it's been a while a think ... mechanic V6 is the same a the github one
and the one with the extension is the one with the filter modified not 100%
it's been a couple of year
https://www.dropbox.com/sh/gayu0wr8l4b4cel/AAB7ZaLrlfDPiHQ0pyQaqU6wa?dl=0
here is another easy exemple
it don't fancy library
i got this one from the hobbytronic link
https://github.com/Seeed-Studio/CAN_BUS_Shield/blob/master/examples/OBDII_PIDs/OBDII_PIDs.ino
So you use serial pins for Arduino - Bluetooth communication.
Can "modem" is connected to SPI pins.
Im right?
you need a canbus adapter
and yes from what i remember it use the spi to talk
Great Thread, thanks for sharing