https://github.com/f1xpl/openauto
DTC: Diagnostic Trouble Codes 故障诊断码 HEV: hybrid electric vehicle 混合动力电动汽车 MIL: malfunction indicator lamp 故障指示灯 BCD: Binary-Coded Decimal 二进制码十进制数或二-十进制代码,用4位二进制数来表示1位十进制数中的0~9这10个数码
OBD systems give the vehicle owner or repair technician access to the status of the various vehicle sub-systems.
16-pin D-shaped connector
odb socket location:
Modern vehicles have many ECUs, and these can include some or all of the following: engine control module (ECM), powertrain control module (PCM), transmission control module (TCM), brake control module (BCM or EBCM), central control module (CCM), central timing module (CTM), general electronic module (GEM), body control module (BCM), and suspension control module (SCM). These ECUs together are sometimes referred to collectively as the car’s computer though technically they are all separate computers, not a single one. Sometimes an assembly incorporates several individual control modules (a PCM often controls both the engine and the transmission)
https://www.youtube.com/watch?v=yGaTsIfxrzM 是一种控制内燃机各个部分运作的电子装置。 最简单的ECU只控制每个引擎周期的注油量。 在现代汽车上配备的更高级的发动机控制器还控制点火时间、可变阀门时间(VVT)、涡轮增压器维持的推进级别(配备涡轮增压的汽车)和其他外围设备。 also commonly called an engine control module (ECM), is a type of electronic control unit that controls a series of actuators on an internal combustion engine to ensure optimal engine performance. It does this by reading values from a multitude of sensors within the engine bay, interpreting the data using multidimensional performance maps (called lookup tables), and adjusting the engine actuators.
Sensors for air flow, pressure, temperature, speed, exhaust oxygen, * knock and crank angle position sensor makes a very vital impact in EEMS. sensors:
Modern ECUs use a microprocessor which can process the inputs from the engine sensors in real-time. An electronic control unit contains the hardware and software (firmware). The hardware consists of electronic components on a printed circuit board (PCB), ceramic substrate or a thin laminate substrate. The main component on this circuit board is a microcontroller chip (MCU). The software is stored in the microcontroller or other chips on the PCB., typically in EPROMs or flash memory so the CPU can be re-programmed by uploading updated code or replacing chips. This is also referred to as an (electronic) Engine Management System (EMS).
Sophisticated engine management systems receive inputs from other sources, and control other parts of the engine; for instance, some variable valve timing systems are electronically controlled, and turbocharger waste gates can also be managed. They also may communicate with transmission control units or directly interface electronically controlled automatic transmissions, traction control systems, and the like. The Controller Area Network or CAN bus automotive network is often used to achieve communication between these devices.
2008: All cars sold in the United States are required to use the ISO 15765-4 signaling standard (a variant of the Controller Area Network (CAN) bus).
Difference Between Engine and Transmission- The basic difference between an engine and a transmission is that an engine is a device that converts different types of energy into mechanical output while a transmission is an instrument that controls the use of power generated by an engine in a power transmission system.
A transmission control unit (TCU), also known as a transmission control module (TCM), or a gearbox control unit (GCU), is a type of automotive ECU that is used to control electronic automatic transmissions. Similar systems are used in conjunction with various semi-automatic transmissions, purely for clutch automation and actuation. A TCU in a modern automatic transmission generally uses sensors from the vehicle, as well as data provided by the engine control unit (ECU), to calculate how and when to change gears in the vehicle for optimum performance, fuel economy and shift quality.
A Controller Area Network (CAN bus) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other’s applications without a host computer. It is a message-based protocol, designed originally for multiplex electrical wiring within automobiles to save on copper, but it can also be used in many other contexts. For each device, the data in a frame is transmitted serially but in such a way that if more than one device transmits at the same time, the highest priority device can continue while the others back off. Frames are received by all devices, including by the transmitting device.
The CAN bus is one of five protocols used in the on-board diagnostics (OBD)-II vehicle diagnostics standard:
[CAN Bus Explained - A Simple Intro [v1.0 | 2019]](https://www.youtube.com/watch?v=FqLDpHsxvf8) |
[CAN Bus Explained - A Simple Intro [v2.0 | 2021](https://www.youtube.com/watch?v=oYps7vT708E) |
[How to hack your car | Part 1 - The basics of the CAN bus](https://www.youtube.com/watch?v=cAAzXM5vsi0) |
Arduino + CAN driver MCP2515 + OBD-2 Plug pintout(female) by SAE J1962 standard
https://en.wikipedia.org/wiki/OBD-II_PIDs OBD-II PIDs (On-board diagnostics Parameter IDs) are codes used to request data from a vehicle, used as a diagnostic tool.
命令格式: <Command HEX Value: Mode|PID> 例子:01 (mode: current data) 0D (vehicle speed)
返回值: 如果at命令设置了ath1也就是返回header,则: 头三个字节是header,后面的字节是返回结果:41 [PID] xx xx xx… , 41就是response,[PID]就是我们发送的PID指令,后面的xx就是具体的值了
| Service / Mode (hex) | Description | |———————-|——————————————————————————————————-| | 01 | Show current data/显示当前数据 | | 02 | Show freeze frame data/显示冻结帧数据 | | 03 | Show stored Diagnostic Trouble Codes/显示存储诊断故障代码 | | 04 | Clear Diagnostic Trouble Codes and stored values/清除诊断故障代码和存储值 | | 05 | Test results, oxygen sensor monitoring (non CAN only)/测试结果,氧传感器监测 | | 06 | Test results, other component/system monitoring (Test results, oxygen sensor monitoring for CAN only)/测试结果,其他组件/系统监控 | | 07 | Show pending Diagnostic Trouble Codes (detected during current or last driving cycle)/显示等待诊断故障代码 | | 08 | Control operation of on-board component/system/控制电路板组件/系统的操作 | | 09 | Request vehicle information/请求车辆信息 | | 0A | Permanent Diagnostic Trouble Codes (DTCs) (Cleared DTCs)/清除故障诊断码 |
| PIDs (hex) | PID (Dec) | Data bytes returned | Description | Min value | Max value | Units | Formula[a] | |——————————|—————————|———————|—————————————————————————————————————————————————|——————————|—————————|——————-|————————————————————————————————————————| | 00 | 0 | 4 | PIDs supported [$01 - $20] | | | | Bit encoded [A7..D0] == [PID $01..PID $20] See below | | 01 | 1 | 4 | Monitor status since DTCs cleared. (Includes malfunction indicator lamp (MIL), status and number of DTCs, components tests, DTC readiness checks) | | | | Bit encoded. See below | | 02 | 2 | 2 | DTC that caused freeze frame to be stored. | | | | Decoded as in service 3 | | 03 | 3 | 2 | Fuel system status | | | | Bit encoded. See below | | 04 | 4 | 1 | Calculated engine load | 0 | 100 | % | 100 255 𝐴 (or 𝐴 2.55 ) | | 05 | 5 | 1 | Engine coolant temperature | -40 | 215 | °C | 𝐴 − 40 | | 06 | 6 | 1 | Short term fuel trim—Bank 1 | -100 (Reduce Fuel: Too Rich) | 99.2 (Add Fuel: Too Lean) | % | 100 128 𝐴 − 100 (or 𝐴 1.28 − 100 ) | | -100 (Reduce Fuel: Too Rich) | 99.2 (Add Fuel: Too Lean) | % | 100 128 𝐴 − 100 (or 𝐴 1.28 − 100 ) | 07 | 7 | 1 | Long term fuel trim—Bank 1 | | -100 (Reduce Fuel: Too Rich) | 99.2 (Add Fuel: Too Lean) | % | 100 128 𝐴 − 100 (or 𝐴 1.28 − 100 ) | 08 | 8 | 1 | Short term fuel trim—Bank 2 | | -100 (Reduce Fuel: Too Rich) | 99.2 (Add Fuel: Too Lean) | % | 100 128 𝐴 − 100 (or 𝐴 1.28 − 100 ) | 09 | 9 | 1 | Long term fuel trim—Bank 2 | | 0A | 10 | 1 | Fuel pressure (gauge pressure) | 0 | 765 | kPa | 3 𝐴 | | 0B | 11 | 1 | Intake manifold absolute pressure | 0 | 255 | kPa | 𝐴 | | 0C | 12 | 2 | Engine speed | 0 | 16,383.75 | rpm | 256 𝐴 + 𝐵 4 | | 0D | 13 | 1 | Vehicle speed | 0 | 255 | km/h | 𝐴 | | 0E | 14 | 1 | Timing advance | -64 | 63.5 | ° before TDC | 𝐴 2 − 64 | | 0F | 15 | 1 | Intake air temperature | -40 | 215 | °C | 𝐴 − 40 | | 10 | 16 | 2 | Mass air flow sensor (MAF) air flow rate | 0 | 655.35 | g/s | 256 𝐴 + 𝐵 100 | | 11 | 17 | 1 | Throttle position | 0 | 100 | % | 100 255 𝐴 | | 12 | 18 | 1 | Commanded secondary air status | | | | Bit encoded. See below | | 13 | 19 | 1 | Oxygen sensors present (in 2 banks) | | | | [A0..A3] == Bank 1, Sensors 1-4. [A4..A7] == Bank 2… | | 14 | 20 | 2 | Oxygen Sensor 1 A: Voltage B: Short term fuel trim | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 15 | 21 | 2 | Oxygen Sensor 2 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 16 | 22 | 2 | Oxygen Sensor 3 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 17 | 23 | 2 | Oxygen Sensor 4 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 18 | 24 | 2 | Oxygen Sensor 5 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 19 | 25 | 2 | Oxygen Sensor 6 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 1A | 26 | 2 | Oxygen Sensor 7 A: Voltage B: Short term fuel trim | | 0 -100 | 1.275 99.2 | V % | 𝐴 200 100 128 𝐵 − 100 (if B==$FF, sensor is not used in trim calculation) | 1B | 27 | 2 | Oxygen Sensor 8 A: Voltage B: Short term fuel trim | | 1C | 28 | 1 | OBD standards this vehicle conforms to | 1 | 250 | | enumerated. See below | | 1D | 29 | 1 | Oxygen sensors present (in 4 banks) | | | | Similar to PID $13, but [A0..A7] == [B1S1, B1S2, B2S1, B2S2, B3S1, B3S2, B4S1, B4S2] | | 1E | 30 | 1 | Auxiliary input status | | | | A0 == Power Take Off (PTO) status (1 == active) [A1..A7] not used | | 1F | 31 | 2 | Run time since engine start | 0 | 65,535 | s | 256 𝐴 + 𝐵 | | 20 | 32 | 4 | PIDs supported [$21 - $40] | | | | Bit encoded [A7..D0] == [PID $21..PID $40] See below | | 21 | 33 | 2 | Distance traveled with malfunction indicator lamp (MIL) on | 0 | 65,535 | km | 256 𝐴 + 𝐵 | | 22 | 34 | 2 | Fuel Rail Pressure (relative to manifold vacuum) | 0 | 5177.265 | kPa | 0.079 ( 256 𝐴 + 𝐵 ) | | 23 | 35 | 2 | Fuel Rail Gauge Pressure (diesel, or gasoline direct injection) | 0 | 655,350 | kPa | 10 ( 256 𝐴 + 𝐵 ) | | 24 | 36 | 4 | Oxygen Sensor 1 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 25 | 37 | 4 | Oxygen Sensor 2 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 26 | 38 | 4 | Oxygen Sensor 3 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 27 | 39 | 4 | Oxygen Sensor 4 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 28 | 40 | 4 | Oxygen Sensor 5 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 29 | 41 | 4 | Oxygen Sensor 6 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 2A | 42 | 4 | Oxygen Sensor 7 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 0 0 | < 2 < 8 | ratio V | 2 65536 ( 256 𝐴 + 𝐵 ) 8 65536 ( 256 𝐶 + 𝐷 ) | 2B | 43 | 4 | Oxygen Sensor 8 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Voltage | | 2C | 44 | 1 | Commanded EGR | 0 | 100 | % | 100 255 𝐴 | | 2D | 45 | 1 | EGR Error | -100 | 99.2 | % | 100 128 𝐴 − 100 | | 2E | 46 | 1 | Commanded evaporative purge | 0 | 100 | % | 100 255 𝐴 | | 2F | 47 | 1 | Fuel Tank Level Input | 0 | 100 | % | 100 255 𝐴 | | 30 | 48 | 1 | Warm-ups since codes cleared | 0 | 255 | | 𝐴 | | 31 | 49 | 2 | Distance traveled since codes cleared | 0 | 65,535 | km | 256 𝐴 + 𝐵 | | 32 | 50 | 2 | Evap. System Vapor Pressure | -8,192 | 8191.75 | Pa | 256 𝐴 + 𝐵 4 (AB is two’s complement signed)[3] | | 33 | 51 | 1 | Absolute Barometric Pressure | 0 | 255 | kPa | 𝐴 | | 34 | 52 | 4 | Oxygen Sensor 1 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 35 | 53 | 4 | Oxygen Sensor 2 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 36 | 54 | 4 | Oxygen Sensor 3 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 37 | 55 | 4 | Oxygen Sensor 4 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 38 | 56 | 4 | Oxygen Sensor 5 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 39 | 57 | 4 | Oxygen Sensor 6 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 3A | 58 | 4 | Oxygen Sensor 7 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 0 -128 | < 2 <128 | ratio mA | 2 65536 ( 256 𝐴 + 𝐵 ) 256 𝐶 + 𝐷 256 − 128 | 3B | 59 | 4 | Oxygen Sensor 8 AB: Air-Fuel Equivalence Ratio (lambda,λ) CD: Current | | 3C | 60 | 2 | Catalyst Temperature: Bank 1, Sensor 1 | -40 | 6,513.5 | °C | 256 𝐴 + 𝐵 10 − 40 | | -40 | 6,513.5 | °C | 256 𝐴 + 𝐵 10 − 40 | 3D | 61 | 2 | Catalyst Temperature: Bank 2, Sensor 1 | | -40 | 6,513.5 | °C | 256 𝐴 + 𝐵 10 − 40 | 3E | 62 | 2 | Catalyst Temperature: Bank 1, Sensor 2 | | -40 | 6,513.5 | °C | 256 𝐴 + 𝐵 10 − 40 | 3F | 63 | 2 | Catalyst Temperature: Bank 2, Sensor 2 | | 40 | 64 | 4 | PIDs supported [$41 - $60] | | | | Bit encoded [A7..D0] == [PID $41..PID $60] See below | | 41 | 65 | 4 | Monitor status this drive cycle | | | | Bit encoded. See below | | 42 | 66 | 2 | Control module voltage | 0 | 65.535 | V | 256 𝐴 + 𝐵 1000 | | 43 | 67 | 2 | Absolute load value | 0 | 25,700 | % | 100 255 ( 256 𝐴 + 𝐵 ) | | 44 | 68 | 2 | Commanded Air-Fuel Equivalence Ratio (lambda,λ) | 0 | < 2 | ratio | 2 65536 ( 256 𝐴 + 𝐵 ) | | 45 | 69 | 1 | Relative throttle position | 0 | 100 | % | 100 255 𝐴 | | 46 | 70 | 1 | Ambient air temperature | -40 | 215 | °C | 𝐴 − 40 | | 47 | 71 | 1 | Absolute throttle position B | 0 | 100 | % | 100 255 𝐴 | | 0 | 100 | % | 100 255 𝐴 | 48 | 72 | 1 | Absolute throttle position C | | 0 | 100 | % | 100 255 𝐴 | 49 | 73 | 1 | Accelerator pedal position D | | 0 | 100 | % | 100 255 𝐴 | 4A | 74 | 1 | Accelerator pedal position E | | 0 | 100 | % | 100 255 𝐴 | 4B | 75 | 1 | Accelerator pedal position F | | 0 | 100 | % | 100 255 𝐴 | 4C | 76 | 1 | Commanded throttle actuator | | 4D | 77 | 2 | Time run with MIL on | 0 | 65,535 | min | 256 𝐴 + 𝐵 | | 0 | 65,535 | min | 256 𝐴 + 𝐵 | 4E | 78 | 2 | Time since trouble codes cleared | | 4F | 79 | 4 | Maximum value for Fuel–Air equivalence ratio, oxygen sensor voltage, oxygen sensor current, and intake manifold absolute pressure | 0, 0, 0, 0 | 255, 255, 255, 2550 | ratio, V, mA, kPa | 𝐴 , 𝐵 , 𝐶 , 𝐷 × 10 | | 50 | 80 | 4 | Maximum value for air flow rate from mass air flow sensor | 0 | 2550 | g/s | 𝐴 × 10 ; 𝐵 , 𝐶 , and 𝐷 are reserved for future use | | 51 | 81 | 1 | Fuel Type | | | | From fuel type table see below | | 52 | 82 | 1 | Ethanol fuel % | 0 | 100 | % | 100 255 𝐴 | | 53 | 83 | 2 | Absolute Evap system Vapor Pressure | 0 | 327.675 | kPa | 256 𝐴 + 𝐵 200 | | 54 | 84 | 2 | Evap system vapor pressure | -32,768 | 32,767 | Pa | 256 𝐴 + 𝐵 (AB is two’s complement signed)[3] | | 55 | 85 | 2 | Short term secondary oxygen sensor trim, A: bank 1, B: bank 3 | -100 | 99.2 | % | 100 128 𝐴 − 100 100 128 𝐵 − 100 | | -100 | 99.2 | % | 100 128 𝐴 − 100 100 128 𝐵 − 100 | 56 | 86 | 2 | Long term secondary oxygen sensor trim, A: bank 1, B: bank 3 | | -100 | 99.2 | % | 100 128 𝐴 − 100 100 128 𝐵 − 100 | 57 | 87 | 2 | Short term secondary oxygen sensor trim, A: bank 2, B: bank 4 | | -100 | 99.2 | % | 100 128 𝐴 − 100 100 128 𝐵 − 100 | 58 | 88 | 2 | Long term secondary oxygen sensor trim, A: bank 2, B: bank 4 | | 59 | 89 | 2 | Fuel rail absolute pressure | 0 | 655,350 | kPa | 10 ( 256 𝐴 + 𝐵 ) | | 5A | 90 | 1 | Relative accelerator pedal position | 0 | 100 | % | 100 255 𝐴 | | 5B | 91 | 1 | Hybrid battery pack remaining life | 0 | 100 | % | 100 255 𝐴 | | 5C | 92 | 1 | Engine oil temperature | -40 | 210 | °C | 𝐴 − 40 | | 5D | 93 | 2 | Fuel injection timing | -210.00 | 301.992 | ° | 256 𝐴 + 𝐵 128 − 210 | | 5E | 94 | 2 | Engine fuel rate | 0 | 3212.75 | L/h | 256 𝐴 + 𝐵 20 | | 5F | 95 | 1 | Emission requirements to which vehicle is designed | | | | Bit Encoded | | 60 | 96 | 4 | PIDs supported [$61 - $80] | | | | Bit encoded [A7..D0] == [PID $61..PID $80] See below | | 61 | 97 | 1 | Driver’s demand engine - percent torque | -125 | 130 | % | 𝐴 − 125 | | 62 | 98 | 1 | Actual engine - percent torque | -125 | 130 | % | 𝐴 − 125 | | 63 | 99 | 2 | Engine reference torque | 0 | 65,535 | N⋅m | 256 𝐴 + 𝐵 | | 64 | 100 | 5 | Engine percent torque data | -125 | 130 | % | 𝐴 − 125 Idle 𝐵 − 125 Engine point 1 𝐶 − 125 Engine point 2 𝐷 − 125 Engine point 3 𝐸 − 125 Engine point 4 | | 65 | 101 | 2 | Auxiliary input / output supported | | | | Bit Encoded | | 66 | 102 | 5 | Mass air flow sensor | 0 | 2047.96875 | g/s | [A0]== Sensor A Supported [A1]== Sensor B Supported Sensor A: 256 𝐵 + 𝐶 32 Sensor B: 256 𝐷 + 𝐸 32 | | 67 | 103 | 3 | Engine coolant temperature | -40 | 215 | °C | [A0]== Sensor 1 Supported [A1]== Sensor 2 Supported Sensor 1: 𝐵 − 40 Sensor 2: 𝐶 − 40 | | 68 | 104 | 3 | Intake air temperature sensor | -40 | 215 | °C | [A0]== Sensor 1 Supported [A1]== Sensor 2 Supported Sensor 1: 𝐵 − 40 Sensor 2: 𝐶 − 40 | | 69 | 105 | 7 | Actual EGR, Commanded EGR, and EGR Error | | | | | | 6A | 106 | 5 | Commanded Diesel intake air flow control and relative intake air flow position | | | | | | 6B | 107 | 5 | Exhaust gas recirculation temperature | | | | | | 6C | 108 | 5 | Commanded throttle actuator control and relative throttle position | | | | | | 6D | 109 | 11 | Fuel pressure control system | | | | | | 6E | 110 | 9 | Injection pressure control system | | | | | | 6F | 111 | 3 | Turbocharger compressor inlet pressure | | | | | | 70 | 112 | 10 | Boost pressure control | | | | | | 71 | 113 | 6 | Variable Geometry turbo (VGT) control | | | | | | 72 | 114 | 5 | Wastegate control | | | | | | 73 | 115 | 5 | Exhaust pressure | | | | | | 74 | 116 | 5 | Turbocharger RPM | | | | | | 75 | 117 | 7 | Turbocharger temperature | | | | | | 76 | 118 | 7 | Turbocharger temperature | | | | | | 77 | 119 | 5 | Charge air cooler temperature (CACT) | | | | | | 78 | 120 | 9 | Exhaust Gas temperature (EGT) Bank 1 | | | | Special PID. See below | | 79 | 121 | 9 | Exhaust Gas temperature (EGT) Bank 2 | | | | Special PID. See below | | 7A | 122 | 7 | Diesel particulate filter (DPF) differential pressure | | | | | | 7B | 123 | 7 | Diesel particulate filter (DPF) | | | | | | 7C | 124 | 9 | Diesel Particulate filter (DPF) temperature | | | °C | 256 𝐴 + 𝐵 10 − 40 | | 7D | 125 | 1 | NOx NTE (Not-To-Exceed) control area status | | | | | | 7E | 126 | 1 | PM NTE (Not-To-Exceed) control area status | | | | | | 7F | 127 | 13 | Engine run time [b] | | | s | | | 80 | 128 | 4 | PIDs supported [$81 - $A0] | | | | Bit encoded [A7..D0] == [PID $81..PID $A0] See below | | 81 | 129 | 41 | Engine run time for Auxiliary Emissions Control Device(AECD) | | | | | | 82 | 130 | 41 | Engine run time for Auxiliary Emissions Control Device(AECD) | | | | | | 83 | 131 | 9 | NOx sensor | | | | | | 84 | 132 | 1 | Manifold surface temperature | | | | | | 85 | 133 | 10 | NOx reagent system | | | | | | 86 | 134 | 5 | Particulate matter (PM) sensor | | | | | | 87 | 135 | 5 | Intake manifold absolute pressure | | | | | | 88 | 136 | 13 | SCR Induce System | | | | | | 89 | 137 | 41 | Run Time for AECD #11-#15 | | | | | | 8A | 138 | 41 | Run Time for AECD #16-#20 | | | | | | 8B | 139 | 7 | Diesel Aftertreatment | | | | | | 8C | 140 | 17 | O2 Sensor (Wide Range) | | | | | | 8D | 141 | 1 | Throttle Position G | 0 | 100 | % | | | 8E | 142 | 1 | Engine Friction - Percent Torque | -125 | 130 | % | 𝐴 − 125 | | 8F | 143 | 7 | PM Sensor Bank 1 & 2 | | | | | | 90 | 144 | 3 | WWH-OBD Vehicle OBD System Information | | | h | | | 91 | 145 | 5 | WWH-OBD Vehicle OBD System Information | | | h | | | 92 | 146 | 2 | Fuel System Control | | | | | | 93 | 147 | 3 | WWH-OBD Vehicle OBD Counters support | | | h | | | 94 | 148 | 12 | NOx Warning And Inducement System | | | | | | 98 | 152 | 9 | Exhaust Gas Temperature Sensor | | | | | | 99 | 153 | 9 | Exhaust Gas Temperature Sensor | | | | | | 9A | 154 | 6 | Hybrid/EV Vehicle System Data, Battery, Voltage | | | | | | 9B | 155 | 4 | Diesel Exhaust Fluid Sensor Data | | | | | | 9C | 156 | 17 | O2 Sensor Data | | | | | | 9D | 157 | 4 | Engine Fuel Rate | | | g/s | | | 9E | 158 | 2 | Engine Exhaust Flow Rate | | | kg/h | | | 9F | 159 | 9 | Fuel System Percentage Use | | | | | | A0 | 160 | 4 | PIDs supported [$A1 - $C0] | | | | Bit encoded [A7..D0] == [PID $A1..PID $C0] See below | | A1 | 161 | 9 | NOx Sensor Corrected Data | | | ppm | | | A2 | 162 | 2 | Cylinder Fuel Rate | 0 | 2047.96875 | mg/stroke | 256 𝐴 + 𝐵 32 | | A3 | 163 | 9 | Evap System Vapor Pressure | | | Pa | | | A4 | 164 | 4 | Transmission Actual Gear | 0 | 65.535 | ratio | [A1]==Supported 256 𝐶 + 𝐷 1000 | | A5 | 165 | 4 | Commanded Diesel Exhaust Fluid Dosing | 0 | 127.5 | % | [A0]= 1:Supported; 0:Unsupported 𝐵 2 | | A6 | 166 | 4 | Odometer [c] | 0 | 429,496,729.5 | km | 𝐴 ( 2 24 ) + 𝐵 ( 2 16 ) + 𝐶 ( 2 8 ) + 𝐷 10 | | A7 | 167 | 4 | NOx Sensor Concentration Sensors 3 and 4 | | | | | | A8 | 168 | 4 | NOx Sensor Corrected Concentration Sensors 3 and 4 | | | | | | A9 | 169 | 4 | ABS Disable Switch State | | | | [A0]= 1:Supported; 0:Unsupported [B0]= 1:Yes;0:No | | C0 | 192 | 4 | PIDs supported [$C1 - $E0] | | | | Bit encoded [A7..D0] == [PID $C1..PID $E0] See below | | C3 | 195 | ? | ? | ? | ? | ? | Returns numerous data, including Drive Condition ID and Engine Speed* | | C4 | 196 | ? | ? | ? | ? | ? | B5 is Engine Idle Request B6 is Engine Stop Request* |
In the formula column, letters A, B, C, etc. represent the first, second, third, etc. byte of the data. For example, for two data bytes 0F 19, A = 0F and B = 19. Where a (?) appears, contradictory or incomplete information was available.
The ELM327 is a programmed microcontroller produced for translating the on-board diagnostics (OBD) interface found in most modern cars. The ELM327 command protocol is one of the most popular PC-to-OBD interface standards and is also implemented by other vendors.
The original ELM327 was implemented on the PIC18F2480 microcontroller from Microchip Technology.
Why is so important to buy a good adapter? Isn’t it just a simple transmitter?
In fact, ELM327 based adapter is not just a transmitter. It’s a “small computer” that actually handles all communication with the car.
It’s not the software that actually connects to your car’s ECU, it’s ELM327 chip. It can handle about 10 base protocols variations and interprets information from this protocols to a single one.
So, if you have a bad “interpreter”, your software (Car Scanner) and your car ECU wouldn’t understand each other. But if you have a good “interpreter”, they would have a very interesting conversation and you would get all the information you need.
ELM327原版采用PIC18F2480芯片方案,成本比较高。如果用PIC18F25K80做,成本可以降低不少,并且25K80资源要比2480要好很多,芯片与上位机通讯是UART连接,在此基础上可以转换成多种连接方式,如串口转USB、串口转蓝牙、串口转WIFI等,可以用的上位机软件有PC版的,也有手机版的,市场广阔,销量大利润高。 实现方法 方案具体工作就是把代码从PIC18F2480移植到PIC18F25K80,经过分析Datasheet,发现这两颗IC属于同一系列、在引脚功能、内部资源、ROM大小、EEPROM大小、A/D位数都差别不大,这就满足了转码的最基本要求,首先反编译2480,再用25K80编译,一次就全部通过,很好,但不代表就可以直接使用,因为从资料上看,25K80的寄存器位置、有些位标置、有些寄存器配置方法不一样,我们选定2480来反编译刚得到的25K80代码,得到的ASM再与原2480的ASM对比,发现有几十行代码不一样,这说明这里面所涉及到的寄存器在两个IC中处于不同位,我们重点核对这些寄存器在两个IC中的功能,如果一致,就不用更改,不一致就要人工修正。这个产品用到了ADC和CAN,原2480是10位,而25K80是12位,配置方法也不同,我们人工修正配置方法,再把采样结果从12位修改成10位的,新加入的代码放在了空白的地方,经过上机测试,功能完全OK。依托我们强大的反编译技术,项目得到顺利完成。 https://blog.csdn.net/xqhrs232/article/details/84939286
ELM327 USB的两大主要芯片。
第一个是主控芯片:主要负责对ODB接口传输协议的翻译转换,简单来说就是降PC传过来的指令,转换成电讯号发到HS,MS总线上的模块
第二个是RS232芯片:主要作用就是将usb线上收到的PC指令传给主控芯片。
车友会和做外贸的朋友都会留意ELM327 USB系列的两个IC,一个是Main Control
Chip,顾名思义主控IC,另一个是USB Drive Chip,USB驱动IC,以下是我们厂常做的几种款式:
Main Control Chip: PIC18F2580 / PIC18F2480 /PIC18F25K80 (最便宜) USB Drive Chip: FT232BL /FT 232RL
(FT232BL较贵) 混搭模式:IC各选一种,价格不会相同的
非FT232RL芯片,我们叫ELM327 USB with CP2102(这种最便宜)
目前正品ELM327使用的是FT232的芯片。国内山寨厂商用CP2102比较多,目前也有很多开始使用FT232芯片的山寨ELM出现了。不过有些使用FT232芯片的山寨ELM会有跟FoCCCus 软件不兼容,不能辨认ELM的情况。FT232芯片比CP2102有一个好处,可以设置传输的timeout时间,而CP2102是做不到的。 这个timeout值得最大作用就是,主控芯片转换信号时如果处理的比较慢,就可能会托更长的时间才会给PC返回指令结果。而这个timeout就是等待的时间,如果在这段等待时间内没有收到结果,就会放弃等待,软件也会认为发生了错误,或者指令没有响应。所以刷固件失败的同学在修改了timeout时间之后,ELM327的稳定性增强了,说到底还是山寨的ELM处理速度太慢了。 https://a.xcar.com.cn/bbs/thread-20413239-0.html
最低端:PL2303HX的USB-RS232芯片 加上 RS232-OBD II协议的25K80芯片 次低端:CP2012(CP201X)的USB-RS232芯片 加上 RS232-OBD II协议的25K80芯片 中端:CH340的USB-RS232芯片 加上 RS232-OBD II协议的25K80芯片 中高端:进口原装FTDI FT232RL的USB-RS232芯片 加上 RS232-OBD II协议的2480芯片 高端:进口原装的FTDI FT232RL的USB-RS232芯片 加上 RS232-OBD II ELM327正版芯片(这个就是常见的320元左右的ELS27线了)
CSR芯片 VS 国产芯片
ELM327是早年加拿大公司开发的一种OBD协议芯片。市面上后期很多APP,软件,硬件工具都采用327的格式指令。所以后续基于ELM327指令开发OBD蓝牙就叫ELM327蓝牙。芯方案的QBD61 QBD327完全兼容ELM327所有指令 QBD61更是硬件可以完全兼容。 QBD327价格超级低廉。
QBD66是深圳芯方案自行开发的一款进阶OBD协议芯片。
ELM327 蓝牙是一款手动, 低成本 品质低,量大的低端OBD蓝牙产品。开发使用者需要熟悉OBD原始指令,及深厚的相关专业经验知识。且ELM327在无线通讯下容易断线,造成开发应用场景受限,行程数据统计丢失不够精确。 QBD66 蓝牙就是高级全自动版本,高性价比,高可靠性。且QBD66自带OBD逻辑,完成了327很多上位机的功能,相比ELM327多了一层封包,更适合开发者定制,大大方便简化开发周期,提供高可靠的硬件固化解决方案。且QDB66固件可以自带OTA升级,可以拓展更多应用。 https://www.eechina.com/thread-568843-1-1.html
AT Z [reset all]
Reset adapter settings to factory state
AT L1-0
Enable / Disable line feed characters 换行
AT E1-0
Echo on – off
AT H1-0
Headers on – off
AT AT0-1-2
Adaptive Timing Off — adaptive Timing Auto1 — adaptive Timing Auto2
AT ST FF
Set the timeout to max value.
AT D [set all to Default]
Reset settings to the original user-configured state.
AT DP [Describe the current Protocol]
The scanner is able to independently determine the vehicle protocol to which it is connected.
AT IB10 [set the ISO Baud rate to 10400]
The command sets the baud rate for ISO 9141-2 and
ISO 14230-4 10400
AT IB96 [ set the ISO Baud rate to 9600]
The command sets the baud rate for ISO 9141-2 and
ISO 14230-4 9600 for protocols 3,4,5.
AT SP h [ Set Protocol h]
Protocol selection command h, where h is:
0 – Automatic;
1 — SAE J1850 PWM (41.6 Kbaud);
2 — SAE J1850 VPW (10.4 Kbaud);
3 — ISO 9141-2 (5 baud init, 10.4 Kbaud);
4 — ISO 14230-4 KWP (5 baud init, 10.4 Kbaud);
5 — ISO 14230-4 KWP (fast init, 10.4 Kbaud);
6 — ISO 15765-4 CAN (11 bit ID, 500 Kbaud);
7 — ISO 15765-4 CAN (29 bit ID, 500 Kbaud);
8 — ISO 15765-4 CAN (11 bit ID, 250 Kbaud);
9 — ISO 15765-4 CAN (29 bit ID, 250 Kbaud);
AT SP Ah [Set Protocol h with Auto]
notice that the Bluetooth light comes on even though the car is off this is, because the obd2 port has an always-on 12 volt power supply which means that the Bluetooth adapter is always going to be on.
$ bluetoothctl
[bluetooth] # power on
[bluetooth] # pairable on
[bluetooth] # agent on
[bluetooth] # default-agent
[bluetooth] # scan on
//find Device <MAC ADDRESS> Name: OBDII
[bluetooth] # scan off
[bluetooth] # pair <MAC ADDRESS>
// default pin code: 1234 or 0000
[bluetooth] # trust <MAC ADDRESS>
[bluetooth] # quit
$ sudo rfcomm bind rfcomm0 <MAC ADDRESS>
$ cat /dev/rfcomm0
$ sudo apt-get install screen
$ screen /dev/rfcomm0
>atz #resets the device and return the id
>atl1 #enables line feeds
>ath1 #sets display headers
>atsp<n> #how we want to communicate with the port(n is 0-9, set desired commnunication protocol, if not sure, atsp0 will auto search)
><Command HEX Value: Mode|PID>
01 (mode: current data) 0D (vehicle speed)
01 (mode: current data) 2F(Fuel Tank Level Input)
>
多个 ECU Received frames from vehicles with multiple ECU chips https://mechanics.stackexchange.com/questions/22982/received-frames-from-vehicles-with-multiple-ecu-chips
Make A Smart Car Digital Display - DIY Smart Car (Part 4) Simple Car Object Detection - DIY Smart Car (Part 2)
refer:
ELM327 hacking https://area515.org/elm327-hacking/ 当心“山寨”版本的ELM327 OBD-II蓝牙适配器 https://cnx-software.cn/2022/09/01/elm327-obd-ii-bluetooth-adapters/
(Car Diagnostics With A Raspberry PI - DIY Smart Car (Part 3))[https://www.youtube.com/watch?v=DABytIdutKk]
https://www.sdd-technology.com/blog/obd2-reader-car-diagnostics https://github.com/MacFJA/OBD2
O/D OFF是指OVER DRIVE OFF,一般指自动变速器的超速档关闭;汽车O/D是OVER DRIVE的意思,表示超速。 O/D是OVERDRIVE的意思. 当变速箱齿轮比小于1时,这一档就称之为OVERDRIVE.
DIFFERENCES BETWEEN ELM327 SCANNER FIRMWARE VERSION 1.5 AND 2.1
KWP OBD2 ECU Target Address https://mechanics.stackexchange.com/questions/83343/kwp-obd2-ecu-target-address
https://www.linkedin.com/pulse/electronic-control-unit-ecu-vijay-tharad
https://zhuanlan.zhihu.com/p/35973304
Github上的超硬核嵌入式项目之——星球漫游车 https://mp.weixin.qq.com/s/q_QXb3TOFKhXEuMQckLnug https://github.com/nasa-jpl/open-source-rover