-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for non-standard PIDs #4
Comments
Can you provide an example query and response? i.e.: Query: 2223AD I ask this because custom PIDs depend on the make/model of cars and I don't have an Opel to test on. If you send me your test results I can incorporate the functionality into the library much easier. |
is there any easy way to dump it from Bluetooth ? |
If you have an android or laptop with bluetooth, you can use a BT Serial app to connect and communicate with the ELM327. I use my laptop with Bluetooth Serial Terminal. Then you can use copy and paste or take a screenshot. |
On second thought, you can use this instead to access the ELM327 through the Serial Monitor without a third party app: #include "BluetoothSerial.h"
BluetoothSerial SerialBT;
#define DEBUG_PORT Serial
#define ELM_PORT SerialBT
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
DEBUG_PORT.begin(115200);
ELM_PORT.begin("ESP32test", true);
DEBUG_PORT.println("Attempting to connect to ELM327...");
if (!ELM_PORT.connect("OBDII"))
{
DEBUG_PORT.println("Couldn't connect to OBD scanner");
while(1);
}
DEBUG_PORT.println("Connected to ELM327");
DEBUG_PORT.println("Ensure your serial monitor line ending is set to 'Carriage Return'");
DEBUG_PORT.println("Type and send commands/queries to your ELM327 through the serial monitor");
DEBUG_PORT.println();
}
void loop()
{
if(DEBUG_PORT.available())
{
char c = DEBUG_PORT.read();
DEBUG_PORT.write(c);
ELM_PORT.write(c);
}
if(ELM_PORT.available())
{
char c = ELM_PORT.read();
if(c == '>')
DEBUG_PORT.println();
DEBUG_PORT.write(c);
}
} |
Hi `Attempting to connect to ELM327... rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
I'm not sure how to convert these, but in Torque I'm using the following : |
Ok, cool - now that I have the example queries, I can walk through how to decode/understand the responses and integrate them into the library. Here are the response explanations: Query: 0x2223AD Query: 0x2220FA Query: 0x2220F2 Query: 0x22336A Query: 0x22132A Query: 0x223039 |
I'll update the library sometime in the next couple of weeks or so (as my free time permits, lol) |
thanks! that's exactly the values I could read using Torque I guess if this proves to be working well it may need small instructions on how to extend it for other PIDs and will have variety of uses |
Hi, I'm not good at it, but was trying to understand how it works // my custom code starts here .h file // my custom code starts here .CPP file
} float ELM327::dpfpercent()
} float ELM327::dpfdistance() float ELM327::fueltanklitres() // my custom code ends here .CPP file |
While testing your code is useless because the library doesn't support custom PID queries yet. That being said, you have the right idea. You'll pass the desired service and PID to queryPID() and it will return a 16-bit unsigned int (containing response parts A and B) that you can then use to calculate the value you need. That being said, I don't plan on incorporating any constants into the library's header file since there's no guarantee that such values are valid or supported for all makes/models. I'll let you know once the changes to the library is made. |
sure, I was just trying to understand how it works (didn't test though) |
Should be fixed in release 2.0.0. Let me know if it works for you or not! |
Thank you for 2.0.0 version! Could you please guide me on how to use queries purely in my main sketch ? For now, by comparing the code I created another functions (?) for my purpose in ELMduino.cpp, like below :
and did everything similarly like you did for rpm query, modifying it accordingly How should I calculate when 4 hex digit values are returned ? |
You don't need to add any functions to the library. Honestly, I would advise against it since any updates to the library will overwrite your edits. It's easier to create functions for finding these custom values in your sketch. You can do this because both queryPID() and findResponse() are public members of the ELM327 class: int16_t soot = -1;
if (myELM327.queryPID(34, 13162))
soot = myELM327.findResponse(); Assuming the service and PID numbers are accurate, this will work for all responses regardless of length (i.e. 2 hex digit responses vs 4 hex digit responses). The library packages all available hex digits from the response data and combines them into an unsigned 32 bit number. If only 16 bits of data (2 hex digits) exists in the response, the MSB (Most Significant Byte) is left zeroed out. The only thing you have to worry about is when scaling is needed. For instance, you might need to implement the following: float litersLeft = -1;
if (myELM327.queryPID(34, 4906))
litersLeft = myELM327.findResponse() / 64.0; |
Hi, I've just tried and got success only for standard rpm from ESP32 example
Is it something not properly cleared by findResponse or queryPID ? |
Try this and see what it says: // modified test + my custom PIDs
// based purely on library
#include "BluetoothSerial.h"
#include "ELMduino.h"
#define ELM_PORT SerialBT
#define ESP_BLUETOOTH_NAME "ESP32"
BluetoothSerial SerialBT;
ELM327 myELM327;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
Serial.begin(115200);
ELM_PORT.begin(ESP_BLUETOOTH_NAME, true);
Serial.println("Attempting to connect to ELM327...");
if (!ELM_PORT.connect("V-LINK"))
{
Serial.println("Couldn't connect to OBD scanner - Phase 1");
while (1);
}
if (!myELM327.begin(ELM_PORT))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
while (1);
}
Serial.println("Connected to ELM327");
for (int a = 0; a < 10; ++a)
{
digitalWrite(LED_BUILTIN,HIGH); delay(100);
digitalWrite(LED_BUILTIN,LOW); delay(100);
}
}
void loop()
{
int32_t rpm = -1;
int32_t soot = -1;
int32_t burn = -1;
float litersLeft = -1;
float tempRPM = myELM327.rpm();
if (myELM327.status == ELM_SUCCESS)
{
rpm = (int32_t)tempRPM;
Serial.print("RPM: "); Serial.println(rpm);
}
else
printError();
if (myELM327.queryPID(34, 13162))
{
int32_t tempSoot = myELM327.findResponse();
if (myELM327.status == ELM_SUCCESS)
{
soot = tempSoot;
Serial.print("DPF burns: "); Serial.println(soot);
}
else
printError();
}
if (myELM327.queryPID(34, 4906))
{
int32_t tempLitersLeft = myELM327.findResponse() / 64.0;
if (myELM327.status == ELM_SUCCESS)
{
litersLeft = tempLitersLeft;
Serial.print("Liters: "); Serial.println(litersLeft);
}
else
printError();
}
if (myELM327.queryPID(34, 8434))
{
int32_t tempBurn = myELM327.findResponse();
if (myELM327.status == ELM_SUCCESS)
{
burn = tempBurn;
Serial.print("DPF burns: "); Serial.println(burn);
}
else
printError();
}
for (int a = 0; a < 5; ++a)
{
digitalWrite(LED_BUILTIN,HIGH); delay(200);
digitalWrite(LED_BUILTIN,LOW); delay(200);
}
}
void printError()
{
Serial.print("Received: ");
for (byte i = 0; i < PAYLOAD_LEN; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
switch (myELM327.status)
{
case ELM_SUCCESS:
{
Serial.println(F("\tELM_SUCCESS"));
}
case ELM_NO_RESPONSE:
{
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
}
case ELM_BUFFER_OVERFLOW:
{
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
}
case ELM_GARBAGE:
{
Serial.println(F("\tERROR: ELM_GARBAGE"));
}
case ELM_UNABLE_TO_CONNECT:
{
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
}
case ELM_NO_DATA:
{
Serial.println(F("\tERROR: ELM_NO_DATA"));
}
case ELM_STOPPED:
{
Serial.println(F("\tERROR: ELM_STOPPED"));
}
case ELM_TIMEOUT:
{
Serial.println(F("\tERROR: ELM_TIMEOUT"));
}
case ELM_GENERAL_ERROR:
{
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));
}
}
delay(100);
}
|
I tried your code, and it zeroes out values since the first run :
when I comment out all but rpm it works :
so I tried commenting out rpm and running just first custom query (soot, we should get result within range 0-100, it just prints wrong description, not as the name suggests - burn is 0/1) :
looks like there is something that zeroes the query result? |
What seems to be happening is that the header for the query responses aren't being found. If this happens, findResponse() returns 0 and that's what you're seeing here. The big things to ensure are that the response header in findResponse() is formed correctly and the ELM327 is returning responses with the correct header. For now, please try this new sketch: // modified test + my custom PIDs
// based purely on library
#include "BluetoothSerial.h"
#include "ELMduino.h"
#define ELM_PORT SerialBT
#define ESP_BLUETOOTH_NAME "ESP32"
BluetoothSerial SerialBT;
ELM327 myELM327;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
Serial.begin(115200);
ELM_PORT.begin(ESP_BLUETOOTH_NAME, true);
Serial.println("Attempting to connect to ELM327...");
if (!ELM_PORT.connect("V-LINK"))
{
Serial.println("Couldn't connect to OBD scanner - Phase 1");
while (1);
}
if (!myELM327.begin(ELM_PORT))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
while (1);
}
Serial.println("Connected to ELM327");
for (int a = 0; a < 10; ++a)
{
digitalWrite(LED_BUILTIN,HIGH); delay(100);
digitalWrite(LED_BUILTIN,LOW); delay(100);
}
}
void loop()
{
int32_t rpm = -1;
int32_t soot = -1;
int32_t burn = -1;
float litersLeft = -1;
/////////////////////////////////////////////////////// RPM
float tempRPM = myELM327.rpm();
Serial.print("Payload received for rpm: ");
for (byte i = 0; i < PAYLOAD_LEN; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
{
rpm = (int32_t)tempRPM;
Serial.print("RPM: "); Serial.println(rpm);
}
else
printError();
/////////////////////////////////////////////////////// Soot
if (myELM327.queryPID(34, 13162))
{
int32_t tempSoot = myELM327.findResponse();
Serial.print("Payload received for soot: ");
for (byte i = 0; i < PAYLOAD_LEN; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
{
soot = tempSoot;
Serial.print("Soot: "); Serial.println(soot);
}
else
printError();
}
/////////////////////////////////////////////////////// Liters
if (myELM327.queryPID(34, 4906))
{
int32_t tempLitersLeft = myELM327.findResponse() / 64.0;
Serial.print("Payload received for liters: ");
for (byte i = 0; i < PAYLOAD_LEN; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
{
litersLeft = tempLitersLeft;
Serial.print("Liters: "); Serial.println(litersLeft);
}
else
printError();
}
/////////////////////////////////////////////////////// Burns
if (myELM327.queryPID(34, 8434))
{
int32_t tempBurn = myELM327.findResponse();
Serial.print("Payload received for DPF burns: ");
for (byte i = 0; i < PAYLOAD_LEN; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
{
burn = tempBurn;
Serial.print("DPF burns: "); Serial.println(burn);
}
else
printError();
}
for (int a = 0; a < 5; ++a)
{
digitalWrite(LED_BUILTIN,HIGH);
delay(200);
digitalWrite(LED_BUILTIN,LOW);
delay(200);
}
}
void printError()
{
if (myELM327.status == ELM_SUCCESS)
Serial.println(F("\tELM_SUCCESS"));
else if (myELM327.status == ELM_NO_RESPONSE)
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
else if (myELM327.status == ELM_BUFFER_OVERFLOW)
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
else if (myELM327.status == ELM_GARBAGE)
Serial.println(F("\tERROR: ELM_GARBAGE"));
else if (myELM327.status == ELM_UNABLE_TO_CONNECT)
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
else if (myELM327.status == ELM_NO_DATA)
Serial.println(F("\tERROR: ELM_NO_DATA"));
else if (myELM327.status == ELM_STOPPED)
Serial.println(F("\tERROR: ELM_STOPPED"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_TIMEOUT"));
else if (myELM327.status == ELM_GENERAL_ERROR)
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));
}
delay(500);
}
|
Also, I just made a small edit to the library that should make things run a little better in release 2.0.1. Please try the above sketch with the new release. |
Ok, so I wrote a quick ELM327 emulator in Python to do some "live" testing of the custom PIDs. Turns out there was a bug in how I was converting the decimal values of the query's service and PID numbers to hex. I fixed the bug in release 2.0.2. Let me know if it solves your problem. |
Hi, I tested your modified code, here are the results
|
Ok, I think I FINALLY got it, lol. For "long" queries like these custom ones, I needed to add an extra '\0' char to the end of the query and header char strings. This bug prevented the Arduino from identifying the response header (even though it was present in the ELM327's response). I verified it worked with the ELM simulator. Current lib version: 2.0.7 |
Everything seems to work now, thank you!
|
What do you mean by "getting -1"? Do you mean the values are consistently -1 and not properly updated or is the ELM327 class's member "status" consistently -1? These two different cases mean different things and is useful in debugging. As for speeding up initial connection to the ELM327, there's no way to do this as far as I'm aware. The main delay seems to reside in the ESP32's bluetooth library's code, so there's not much you can do "sketch level". I'm planning on making another small update soon that will help with the reconnect issue. |
With release 2.0.8 you can monitor the bool |
Seems like things are working for you, so I'll go ahead and close this issue |
Hello, a want to build this project in my Opel Insignia, I have a TTGO and many ELM adaptors. The problem it in "Connection"
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h>
#include "opel.h"
#include "BluetoothSerial.h"
#include "ELMduino.h"
#include <WiFi.h>
#include "Free_Fonts.h"
#define ELM_PORT SerialBT
#define ESP_BLUETOOTH_NAME "ESP32"
BluetoothSerial SerialBT;
ELM327 myELM327;
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library
void setup() {
delay(100);
Serial.begin(115200);
ELM_PORT.begin(ESP_BLUETOOTH_NAME, true);
Serial.println("Attempting to connecting...");
tft.init();tft.setRotation(3);
tft.setSwapBytes(true);
tft.pushImage(0, 0, 240, 135, opel);
delay(1000);
// change "V-LINK" to your OBD reader bluetooth name //
if (!ELM_PORT.connect("OBDII"))
//if (!ELM_PORT.connect("V-LINK"))
{
Serial.println("Couldn't connect to OBD scanner - Phase 1");
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setCursor(10,40);
tft.setTextFont(4);
tft.println("OBD error 1");
delay(2000);
// let it not connect & retest connection at the end of the loop
//while (1);
}
if (!myELM327.begin(ELM_PORT))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setCursor(10,40);
tft.setTextFont(4);
tft.println("OBD error 1");
delay(2000);
//while (1);
}
Serial.println("Connected to ELM327");
}
void loop() {
int32_t rpm = -1;
int32_t soot = -1;
int32_t burn = -1;
int32_t km = -1;
int32_t litersLeft = -1;
// read values first, then display
// read RPM
float tempRPM = myELM327.rpm();
if (myELM327.status == ELM_SUCCESS)
{
rpm = (int32_t)tempRPM;
Serial.print("RPM: "); Serial.println(rpm);
}
else
printError();
// read DPF soot level
if (myELM327.queryPID(22, 3275)) //PID DPF Level ok on torque
// if (myELM327.queryPID(34, 13162)) //PID DPF Level
{
int32_t tempSoot = myELM327.findResponse();
if (myELM327.status == ELM_SUCCESS)
{
soot = tempSoot;
Serial.print("DPF soot: "); Serial.println(soot);
}
else
printError();
}
// read DPF km since last regen
if (myELM327.queryPID(22, 3277)) //PID DPF Last Regeneration ok on torque
{
int32_t tempKm = myELM327.findResponse();
if (myELM327.status == ELM_SUCCESS)
{
km = tempKm;
Serial.print("DPF km: "); Serial.println(km);
}
else
printError();
}
// read fuel liters left
if (myELM327.queryPID(34, 4906)) ////PID Fuel in Tank
{
int32_t tempLitersLeft = myELM327.findResponse() / 64.0;
if (myELM327.status == ELM_SUCCESS)
{
litersLeft = tempLitersLeft;
Serial.print("Liters: "); Serial.println(litersLeft);
}
else
printError();
}
// read DPF burn status 0/1
if (myELM327.queryPID(22, 3274)) //PID DPF burn status ok on torque
{
int32_t tempBurn = myELM327.findResponse();
if (myELM327.status == ELM_SUCCESS)
{
burn = tempBurn;
Serial.print("DPF burns: "); Serial.println(burn);
}
else
printError();
}
// reading ends, now display it all / blink screen
if (burn > 0 && burn <11) {
dpfBlink(soot);
} else {
oneScreen(soot, km, burn, litersLeft, rpm);
delay(1000);
// adjust the refresh rate here, mainly visible in rpm update rate
}
// check if it's still connected after the loop
if (!myELM327.connected)
{
Serial.println("Lost connection..");
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setFreeFont(FF18);
//tft.setTextFont(4);
tft.setCursor(10,40);
tft.println("Lost connection..");
// try to reconnect
ELM_PORT.connect("OBDII");
Serial.println("reconnecting..");
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setFreeFont(FF18);
tft.setCursor(10,40);
//tft.setTextFont(4);
tft.println("reconnecting..");
delay(500);
myELM327.begin(ELM_PORT);
// ESP.restart();
}
}
void dpfBlink(uint8_t dpfSoot)
{
// Serial.println("aaah! DPF burns!");
// display 2 blinking screens
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setCursor(40,40);
tft.setFreeFont(FF18);
tft.println("DPF burns!");
tft.setFreeFont(FF17);
tft.setCursor(20,70);
tft.println("don't turn the engine off");
tft.setFreeFont(FF19);
tft.setCursor(40,110);
tft.print("Soot :");tft.print(String(dpfSoot));
tft.drawString("%", 140, 110);
// screen blink
for (int a = 0; a < 13; ++a) {
tft.invertDisplay(true);
delay(200);
tft.invertDisplay(false);
delay(200);
}
// screen blink
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setCursor(30,40);
tft.setTextSize(1);
tft.setFreeFont(FF18);
tft.println("DPF soot level");
tft.setFreeFont(FF24);
tft.drawString(String(dpfSoot), 60, 75);
tft.drawString("%", 120, 75);
// screen blink
for (int a = 0; a < 12; ++a) {
tft.invertDisplay(true);
delay(200);
tft.invertDisplay(false);
delay(200);
}
// screen blink
tft.invertDisplay(true);
// Serial.println("DPF blink ended");
}
void oneScreen (uint8_t dpfSoot, uint16_t dpfKm, uint8_t dpfBurn, uint8_t fuel, uint16_t rpm){
if (dpfSoot > 130) {dpfSoot = 0;}
if (dpfKm > 999) {dpfKm = 0;}
if (dpfBurn > 11) {dpfBurn = 0;}
if (fuel > 100) {fuel = 0;}
if (rpm > 7000) {rpm = 0;}
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setFreeFont(NULL);
tft.drawString("DPF soot :", 10, 5, 4);
tft.drawString(String(dpfSoot), 130, 5, 4);
tft.drawString("DPF km :", 10, 31, 4);
tft.drawString(String(dpfKm), 130, 31, 4);
tft.drawString("fuel :", 10, 57, 4);
tft.drawString(String(fuel), 130, 57, 4);
tft.drawString("rpm :", 10, 83, 4);
tft.drawString(String(rpm), 130, 83, 4);
tft.drawString(String(dpfBurn), 220, 125, 1);
}
void printError()
{
if (myELM327.status == ELM_SUCCESS)
Serial.println(F("\tELM_SUCCESS"));
else if (myELM327.status == ELM_NO_RESPONSE)
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
else if (myELM327.status == ELM_BUFFER_OVERFLOW)
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
else if (myELM327.status == ELM_GARBAGE)
Serial.println(F("\tERROR: ELM_GARBAGE"));
else if (myELM327.status == ELM_UNABLE_TO_CONNECT)
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
else if (myELM327.status == ELM_NO_DATA)
Serial.println(F("\tERROR: ELM_NO_DATA"));
else if (myELM327.status == ELM_STOPPED)
Serial.println(F("\tERROR: ELM_STOPPED"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_TIMEOUT"));
else if (myELM327.status == ELM_GENERAL_ERROR)
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));
delay(500);
} |
A wide range of issues can cause ELM327's to timeout - what sort of things have you checked already? Did you read up on other people in other issues who resolved their timeout problems? Are you using a BT or WiFi ELM327? |
Also, are you using the latest release of the library? Note that the examples have a new void printError()
{
Serial.print("Received: ");
for (byte i = 0; i < myELM327.recBytes; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
Serial.println(F("\tELM_SUCCESS"));
else if (myELM327.status == ELM_NO_RESPONSE)
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
else if (myELM327.status == ELM_BUFFER_OVERFLOW)
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
else if (myELM327.status == ELM_UNABLE_TO_CONNECT)
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
else if (myELM327.status == ELM_NO_DATA)
Serial.println(F("\tERROR: ELM_NO_DATA"));
else if (myELM327.status == ELM_STOPPED)
Serial.println(F("\tERROR: ELM_STOPPED"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_TIMEOUT"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));
delay(100);
} |
Hello and thanks for replay. I use Bluetooth ELM adaptor, and newest version on ELMduino. I use TTGO ESP32 adaptor like on this project. |
If i use V-LINK (Vgate) BT Adapter, the boart restarting after unable to connect.. |
Interesting...It looks like the ELM327 isn't responding. Perhaps it's a config issue. Try this sketch with the BT ELM327 and manually enter the following inputs into the serial monitor:
Let me know what response you get |
Problem with sketch The sketch name had to be modified. |
No connection, just like other sketch 17:30:43.520 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) |
Once you delete the offending lines, what's the ELM327's response? |
No answer from ELM, it is not connected. Can i use your code LINK with WiFI OBD adapter. i made on test-sketch but how to "#define......" the WIFI with serial like on BT "#define ELM_PORT SerialBT" |
Either your ELM327 uses a different baud, your car isn't on, another BT device is hogging the connection, or it's defective. Also, was your car made before 2008? |
If you want to use the WiFi ELM327, try this sketch, however, you might want to look at this first |
I have 5 deferent OBD Adapters. ELM327 blue some old version ELM Blue picture ELM327 v,1.5 blue, ELM327 v2.1 blue, Vgate Icar2 orange, Vgate V-LINK, And other one model of ELM327. Only ELM327 old version connected with my sketch, but ELM Old version doesn't have a CANBUS communication for my car. The car is Opel (Vauxhall) Insignia 2011 Like on the Original project. All ELM Adapters have seam chips inside. `#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip const char* ssid = "V-LINK"; //IP Adress of your ELM327 Dongle TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library void setup() ///////////////////////////////////////// WiFi.mode(WIFI_AP); while (WiFi.status() != WL_CONNECTED) Serial.println(""); if (client.connect(server, 35000)) myELM327.begin(client); uint32_t rpm = -1; // read values first, then display // read RPM // read DPF soot level
} // read DPF km since last regen
} // read fuel liters left
} // read DPF burn status 0/1
} // reading ends, now display it all / blink screen
// check if it's still connected after the loop } void dpfBlink(uint8_t dpfSoot)
} void oneScreen (uint8_t dpfSoot, uint16_t dpfKm, uint8_t dpfBurn, uint8_t fuel, uint16_t rpm){
tft.fillScreen(TFT_BLACK); tft.setFreeFont(NULL); tft.drawString("DPF soot :", 10, 5, 4); tft.drawString("DPF km :", 10, 31, 4); tft.drawString("fuel :", 10, 57, 4); tft.drawString("rpm :", 10, 83, 4); tft.drawString(String(dpfBurn), 220, 125, 1); } if (myELM327.status == ELM_SUCCESS) delay(100); |
Please add support for non-standard PIDs, for example the ones from Opel mentioned here
https://www.club-opel.com/forum-tema/pid-kody-pro-obd2-165356
The text was updated successfully, but these errors were encountered: