brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.06k stars 370 forks source link

Query DTCs #81

Closed ffries closed 7 years ago

ffries commented 7 years ago

Hello,

First congrats for this module.

I queried Renault Espace IV DTCs:

query_dtc.py

import obd

obd.logger.setLevel(obd.logging.DEBUG)

connection = obd.OBD()
r = connection.query(obd.commands.GET_DTC)
print(r.value)

python query_dtc.py

[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/ttyUSB0']
[obd.obd] Attempting to use port: /dev/ttyUSB0
[obd.elm327] Initializing ELM327: PORT=/dev/ttyUSB0 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: '?\r\r>'
[obd.elm327] Choosing baud 38400
[obd.elm327] write: 'ATZ\r\n'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.4\r\r>'
[obd.elm327] write: 'ATE0\r\n'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r\n'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r\n'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATSP0\r\n'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: '0100\r\n'
[obd.elm327] read: b'SEARCHING...\r86 F1 7A 41 00 00 00 00 00 32 \r\r>'
[obd.elm327] write: 'ATDPN\r\n'
[obd.elm327] read: b'A5\r\r>'
[obd.protocols.protocol] map ECU 122 --> ENGINE
[obd.elm327] Connected Successfully: PORT=/dev/ttyUSB0 BAUD=38400 PROTOCOL=5
[obd.obd] querying for supported commands
[obd.obd] Sending command: 0100: Supported PIDs [01-20]
[obd.elm327] write: '0100\r\n'
[obd.elm327] read: b'86 F1 7A 41 00 00 00 00 00 32 \r\r>'
[obd.obd] finished querying with 7 commands supported
[obd.obd] ===================================================================
[obd.obd] Sending command: 03: Get DTCs
[obd.elm327] write: '03\r\n'
[obd.elm327] read: b'87 F1 7A 43 00 00 00 00 00 00 35 \r\r>'

Is this the correct code to display DTCs?

What is read: b'86 F1 7A 41 00 00 00 00 00 32? Is this the ECU?

My car showed a fault (problem with brakes) this morning. It showed a major fault (red sign), so I stopped immediately the car. Then the problem disappeared and I could drive safely.

How can I query if brakes have a problem. Using sensors?

(don't worry about brakes. You are not liable for your answer. The car brakes very well and I am aware of what I am doing. I think this is a false warning but I want to find the cause).

Kind regards, Kellogs

ffries commented 7 years ago

Closing issues. I simply have no DTC. My car reports most problems using CAN, not OBD. Closing.