stanleyhuangyc / ArduinoOBD

OBD-II library and sketches for Arduino
http://freematics.com
968 stars 519 forks source link

Quick and non-blocking method to connect the OBD-II? #54

Open benjaminBrownlee opened 6 years ago

benjaminBrownlee commented 6 years ago

I noticed that if the OBD-II has stopped communication with the adapter, it takes 11 to 15 seconds for methods such as obd.init and obd.readPID to affirm that the vehicle is off. Is there a way to asynchronously connect to the adapter, or at least a quick check mode that takes less than a second?

MichaelPate commented 5 years ago

In terms of hardware, if you are trying to quickly see if the vehicle is off, you could poll for voltages on the ignition switch (or perhaps the data lines) and then attach that to one of the Arduino's inputs, using proper protection where appropriate. Then adding a "kill switch" to the code would tell you instantly if the car is off. No voltage, the car must be off.