ELMduino icon indicating copy to clipboard operation
ELMduino copied to clipboard

What function do i use to check existing dtcs codes?

Open kassiooliver opened this issue 4 years ago • 2 comments
trafficstars

kassiooliver avatar Feb 05 '21 00:02 kassiooliver

For an overview of DTCS codes, check this out

While I haven't tested it myself, according to this, the monitorStatus() should allow you to begin checking each trouble code. Then, you send (in ASCII) 03 to get the information on each code. Since this message has no PID, you'll have to send it manually and parse the response manually. I literally just googled all this 5min ago, but once I get some time (could be months), I'll seriously consider adding this functionality into the lib so users won't have to manually do it all...

PowerBroker2 avatar Feb 05 '21 03:02 PowerBroker2

Having a way to check codes and subsequently clear them would be wonderful.

Thanks for the library!

rudydelorenzo avatar Feb 23 '21 01:02 rudydelorenzo

Hello. The description of the library say's "Also, you can use ELMduino to view and clear your car's trouble codes". I assume it is implemented now and I am just to dumb to find it :) Did anybody has a working example of reading the stored dtc? :)

TerAtoM avatar Jan 15 '23 17:01 TerAtoM

I have the same question has @TerAtoM. Is already implemented in the library or we still have to manually do it? I check the library src and found the freezeDTC() method to use. my question is if that is the one i can use to get them? Thank you so much @PowerBroker2 for the effort put in develop the library.

NickEsColR avatar May 24 '23 22:05 NickEsColR

For now, try the process in my first comment

PowerBroker2 avatar May 24 '23 23:05 PowerBroker2

I'm almost done adding a method to query and return the current DTC codes. I've implemented both blocking and non-blocking variants and I'm not sure which approach is preferred. NB is more in keeping with the overall design intent of the library, but fetching codes doesn't seem like something one would do in conjunction with other activities. More likely, we just want to get the list and then display it. Also I'm not sure about potential side-effects of performing other actions while the codes are being processed. So, blocking during this request seems reasonable and I think I'm leaning towards that.

@PowerBroker2 do you have any advice on this point?

jimwhitelaw avatar Dec 07 '23 01:12 jimwhitelaw

I've implemented both blocking and non-blocking variants and I'm not sure which approach is preferred

I'm ok with having both options available - especially if already implemented. As long as the user uses an FSM like in the multi-PID example sketch, there shouldn't be an issue with the non-blocking version, although most will probably want to use the blocking version.

PowerBroker2 avatar Dec 07 '23 06:12 PowerBroker2

Updating this discussion to note that a new method currentDTCCodes() has been added that accomplishes this. It's not yet in a tagged release and some additional testing seems prudent, but I have had it working with 2 adapters and 2 vehicles. If anyone else can try this out, it would be appreciated.

@TerAtoM, I have added two example programs to demonstrate checking for MIL (Check Engine Light) status / code count and fetching any current DTCs.

jimwhitelaw avatar Dec 12 '23 01:12 jimwhitelaw

This has been implemented on main and will be included in the next tagged version

PowerBroker2 avatar Dec 21 '23 03:12 PowerBroker2

For an overview of DTCS codes, check this out

While I haven't tested it myself, according to this, the monitorStatus() should allow you to begin checking each trouble code. Then, you send (in ASCII) 03 to get the information on each code. Since this message has no PID, you'll have to send it manually and parse the response manually. I literally just googled all this 5min ago, but once I get some time (could be months), I'll seriously consider adding this functionality into the lib so users won't have to manually do it all...

Is it possible to visualize the DTCs instead of just seeing if the DTCs is present or not? I want to see the DTCs... the actual trouble code which we see using a scan tool. Is it possible?

Naveen-S06 avatar Jan 22 '24 06:01 Naveen-S06

Is it possible to visualize the DTCs instead of just seeing if the DTCs is present or not? I want to see the DTCs... the actual trouble code which we see using a scan tool. Is it possible?

ESP32_Check_DTC.ino

PowerBroker2 avatar Jan 22 '24 12:01 PowerBroker2

Is it possible to visualize the DTCs instead of just seeing if the DTCs is present or not? I want to see the DTCs... the actual trouble code which we see using a scan tool. Is it possible?

ESP32_Check_DTC.ino

Can you help me out on interfacing the ELM327 with Arduino UNO? Can anyone provide me the pin diagrams for it?

Naveen-S06 avatar Jan 23 '24 09:01 Naveen-S06

Unless you intend to open up your ELM327 and solder connections to it, you’re likely better off using a Bluetooth connection. You will need to add a device like the HC05/HC06 Bluetooth module your arduino board. There’s lots of tutorials about how to do that. Personally, I think it’s a lot easier to use an esp32 board (~$10) that has BT built in.

jimwhitelaw avatar Jan 23 '24 16:01 jimwhitelaw

@PowerBroker2 Hey I connected Arduino Uno with HC05 Bluetooth module with pins (HC05 - RX, TX, VCC, GND to Uno - 10, 11, 5v, GND) and I've successfully connected ELM327 bluetooth obd2 tool to arduino. I have this code to read engine rpm but it is not getting connected to the obd2 scanner. please help me out with this. I'm doing this on a Skoda Octavia mk2 (Laura) Code: #include "ELMduino.h" #include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

ELM327 myELM327;

uint32_t rpm = 0;

void setup() { #if LED_BUILTIN pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); #endif

Serial.begin(115200); mySerial.begin(115200);

Serial.println("Attempting to connect to ELM327...");

if (!myELM327.begin(mySerial, true, 2000)) { Serial.println("Couldn't connect to OBD scanner"); while (1); }

Serial.println("Connected to ELM327"); }

void loop() { float tempRPM = myELM327.rpm();

if (myELM327.nb_rx_state == ELM_SUCCESS) { rpm = (uint32_t)tempRPM; Serial.print("RPM: "); Serial.println(rpm); } else if (myELM327.nb_rx_state != ELM_GETTING_MSG) myELM327.printError(); } O/P: Couldn't connect to OBD scanner

Naveen-S06 avatar Jan 24 '24 12:01 Naveen-S06