Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION

FACULTY OF INTERNATIONAL EDUCATION

PROGRESS REPORT

DESIGN A SYSTEM TO DISPLAY VEHICLE


PARAMETER THROUGH OBD2 ON SMARTPHONES

NGUYỄN MINH PHÚ


Student ID: 20145426
NGÔ TẤN TRUNG
Student ID: 20145443

Major: AUTOMOTIVE ENGINEERING


Supervisor: ASSOC. PROF .DR. ĐỖ VĂN DŨNG

Ho Chi Minh City, January 2024


Acknowledgements
Table of Contents
Chapter 1: INTRODUCTION
1.1. Header 1
1.1.1. Sub Header 1.1
1.1.2. Sub Header 1.2
1.2. Header 2
1.2.1. Sub Header 2.1
Chapter 2: LITERATURE REVIEW
Chapter 3: <RESEARCH CONTENT 1>
Chapter 4: <RESEARCH CONTENT 2>
Chapter 5: EXPERIMENT RESULTS/ FINDINGS AND ANALYSIS
Chapter 6: CONCLUSION AND RECOMMENDATIONS
References
Appendices
1. Basic knowledge
1.1. CAN
1.1.1. What is CAN
The Controller Area Network (CAN bus) is the nervous system, enabling
communication.
In turn, 'nodes' or 'electronic control units' (ECUs) are like parts of the body,
interconnected via the CAN bus. Information
sensed by one part can be shared with another.

This is where the CAN standard comes in handy:


The CAN bus system enables each ECU to communicate with all other ECUs -
without complex dedicated wiring.
Specifically, an ECU can prepare and broadcast information (e.g. sensor data) via the
CAN bus (consisting of two wires, CAN low and CAN high). The broadcasted data
is accepted by all other ECUs on the CAN network - and each ECU can then check
the data and decide whether to receive or ignore it.

1.1.2. Benefits
Top 4 benefits of CAN:
- Simple & low cost: ECUs communicate via a single CAN system instead of via
direct complex analogue signal lines - reducing errors, weight, wiring and costs.
- Fully centralized The CAN bus provides 'one point-of-entry' to communicate with
all network ECUs - enabling central diagnostics, data logging and configuration
- Extremely robust The system is robust towards electric disturbances and
electromagnetic interference - ideal for safety critical applications (e.g. vehicles)
- Efficient CAN frames are prioritized by ID so that top priority data gets immediate
bus access, without causing interruption of other frames
1.1.3. CAN frame
Communication over the CAN bus is done via CAN frames.

The 8 CAN bus protocol message fields


- SOF : The Start of Frame is a 'dominant 0' to tell the other nodes that a CAN node
intends to talk.
- ID : The ID is the frame identifier - lower values have higher priority.
- RTR : The Remote Transmission Request indicates whether a node sends data or
requests dedicated data from another node.
- Control : The Control contains the Identifier Extension Bit (IDE) which is a
'dominant 0' for 11-bit. It also contains the 4 bit Data Length Code (DLC) that
specifies the length of the data bytes to be transmitted (0 to 8 bytes).
- Data : The Data contains the data bytes aka payload, which includes CAN signals
that can be extracted and decoded for information.
- CRC : The Cyclic Redundancy Check is used to ensure data integrity.
- ACK : The ACK slot indicates if the node has acknowledged and received the data
correctly.
- EOF : The EOF marks the end of the CAN frame.
1.2. OBD II
1.2.1. What is OBD II
In short, OBD2 is your vehicle's built-in self-diagnostic system. You've probably
encountered OBD2 already: Ever noticed the malfunction indicator light on your
dashboard? That is your car telling you there is an issue. If you visit a mechanic, he
will use an OBD2 scanner to diagnose the issue. To do so, he will connect the
OBD2 reader to the OBD2 16 pin connector near the steering wheel. This lets him
read OBD2 codes aka Diagnostic Trouble Codes (DTCs) to review and troubleshoot
the issue.
The five OBD II protocols
As explained above, CAN bus today serves as the basis for OBD2 communication
in the vast majority of cars through ISO 15765. However, if you're inspecting an
older car (pre 2008), it is useful to know the other four protocols that have been used
as basis for OBD2. Note also the pinouts, which can be used to determine which
protocol may be used in your car.
● ISO 15765 (CAN bus): Mandatory in US cars since 2008 and is today used in the
vast majority of cars
● ISO14230-4 (KWP2000): The Keyword Protocol 2000 was a common protocol
for 2003+ cars in e.g. Asia
● ISO9141-2: Used in EU, Chrysler & Asian cars in 2000-04
● SAE J1850 (VPW): Used mostly in older GM cars
● SAE J1850 (PWM): Used mostly in older Ford cars
1.2.2. OBD II parameter IDs (PID)
To get started recording OBD2 data, it is helpful to understand the basics of the raw
OBD2 message structure. In simplified terms, an OBD2 message consists of an
identifier and data. Further, the data is split in Mode, PID and data bytes (A, B, C,
D) as below.

OBD2 message fields explained


● Identifier : For OBD2 messages, the identifier is standard 11-bit and used to
distinguish between "request messages" (ID 7DF) and "response messages" (ID 7E8
to 7EF). Note that 7E8 will typically be where the main engine or ECU responds at.
● Length : This simply reflects the length in number of bytes of the remaining data
(03 to 06). For the Vehicle Speed example, it is 02 for the request (since only 01 and
0D follow), while for the response it is 03 as both 41,
0D and 32 follow.
● Mode : For requests, this will be between 01-0A. For responses the 0 is replaced
by 4 (i.e. 41, 42, … , 4A). There are 10 modes as described in the SAE J1979 OBD2
standard. Mode 1 shows Current Data and is e.g. used for looking at real-time
vehicle speed, RPM etc. Other modes are used to e.g. show or clear stored
diagnostic trouble codes and show freeze frame data.
PID : For each mode, a list of standard OBD2 PIDs exist - e.g. in Mode 01, PID 0D
is Vehicle Speed. For the full list, check out our OBD2 PID overview . Each PID
has a description and some have a specified min/max and conversion formula. The
formula for speed is e.g. simply A, meaning that the A data byte (which is in HEX)
is converted to decimal to get the km/h converted value (i.e. 32 becomes 50 km/h
above). For e.g. RPM (PID 0C), the formula is (256*A + B) / 4.
● A, B, C, D : These are the data bytes in HEX, which need to be converted to
decimal form before they are used in the PID formula calculations. Note that the last
data byte (after Dh) is not used.
Chế độ
Mô tả
(hex)

01 Biểu diễn dữ liệu hiên tại

02 Hiển thị dữ liệu khung cố định

03 Hiện thị mã chuẩn đoán được lưu trữ

04 Xóa mã lỗi và các giá trị lưu trữ

05 Kết quả kiểm tra, giám sát cảm biến oxy (chỉ dành cho CAN)

Kết quả kiểm tra, giám sát thành phần / hệ thống khác (Kết quả kiểm
06
tra, giám sát cảm biến oxy chỉ CAN)

Hiển thị Mã lỗi đang chờ xử lý (được phát hiện trong quá trình lái xe
07
hiện tại hoặc cuối quá trình)

08 Điểu khiển sự hoạt động của các bộ phận trên ON – BOARD

09 Yêu cầu thông tin xe

0A Mã chuẩn đoán cố định (DTCs) (DTCs đã xóa)

2. Design an application to transfer information to the phone


2.1. Block diagram and components
2.1.1. OBD II
2.1.2. CAN shield V3
2.1.3. Adruino Uno R3
2.1.4. Bluetooth HC 05
2.2. The way to get data

A B

A7 A6 A5 A4 A3 A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0

C D

C7 C6 C5 C4 C3 C2 C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
Bảng 3.4: Các mã PIDs
Giá trị
PIDs Số byte trả Giá trị
PID (Dec) Mô tả nhỏ Đơn vị Công thức
(hex) về lớn nhất
nhất
PID được
Bit được
00 0 4 hỗ trợ [01 -
mã hóa
20]

Theo dõi
trạng thái
DTC khi bị
xóa. Bao
Bit được
01 1 4 gồm trạng
mã hóa
thái đèn báo
lỗi MIL và
số lượng
mã DTCs

Đóng băng
02 2 2
DTC

Trạng thái
Bit được
03 3 2 hệ thống
mã hóa
nhiên liệu

Tính toán
04 4 1 0 100 %
tải động cơ

Nhiệt độ
nước làm
05 5 1 -40 215 A-40
mát động

Áp suất
nhiên liệu
0A 10 1 0 765 kPa 3A
(đồng hồ áp
suất)
Áp suất
tuyệt đối
0B 11 1 0 255 kPa A
trên đường
ống nạp

Tốc độ 16,383.
0C 12 2 0 rpm
động cơ 75

0D 13 1 Tốc độ xe 0 255 km/h A

Độ
Van biến
0E 14 1 -64 63.5 (Trước
thiên
TDC)

Nhiệt độ
0F 15 1 -40 215
khí nạp

Khối lượng
grams/
10 16 2 không khí 0 655.35
sec
nạp (MAF)

Vị trí bướm
11 17 1 0 100 %
ga
Bảng 3.5: Các mã PIDs và giá trị hiển thị
PID Số Byte Mô tả Đơn vị Công thức
0D 1 Tốc độ xe Km/h A
0C 2 Tốc độ động cơ rpm ((A*256)+B)/4
11 1 Vị trí bướm ga % A*100/255
Tính toán tải động
04 1 % A*100/255

2.3. SIGNAL DECODING


EXAMPLE:
ID RTR D0 D1 D2 D3 D4 D5 D6
0x1DC 7 0x02 A B 0x00 0x00 0x00 0x00

Under normal conditions, the engine's Powertrain Control Module (PCM) sends the
1DC file on the CAN network every 20 milliseconds or 50 times per second. The
control ECU of the gauge cluster on the dashboard continuously receives on the CAN
network to find and process these files. Every time a file with ID 1DC is received, the
needle position on the speedometer will be updated accordingly. After some testing
showed that the calculation formula used below to calculate engine RPM is
approximate.

Ví dụ, 1 tập tin với ID là 1DC và các Byte Data là 02 02 EC 00 00 00 00. Theo công
thức ta lấy 2 byte D1 và D2, 02EC (mã HEX) sau đó ta chuyển sang mã DEC thành 748
rpm.

You might also like