Professional Documents
Culture Documents
Leaf Obd Readthedocs Io en Latest
Leaf Obd Readthedocs Io en Latest
Release 2022.3.12+6c7ec78
Seth Fischer
1 Reference 1
1.1 Diagnostic connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Parameter identifiers 3
2.1 358 turn signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 5B3 SoH, GID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 5C5 odometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Tutorials 9
3.1 Monitoring the Nissan Leaf using an ELM327 diagnostic tool . . . . . . . . . . . . . . . . . . . 9
A Related material 15
B Glossary 17
C Disclaimer 19
D License 21
D.1 Trade marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
D.2 Prose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
D.3 Code listings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Bibliography 23
Index 25
i
ii
CHAPTER
ONE
REFERENCE
The Nissan Leaf is fitted with a Type A diagnostic connector as defined in ISO 15031-3 or its equivalent SAE J1962.
Type A diagnostic connectors have 16 pins arranged in two rows of eight. Nine of the pins have a mandated
designation - with use of the remaining pins being at the discretion of the vehicle manufacturer.
1.1.1 Location
The Leaf ’s diagnostic connector is located beneath the steering column as is seen in Figure 1.1.
Figure 1.1: Nissan Leaf OBD-II vehicle diagnostic connector (mating-end view)
1
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
The Leaf has three CAN buses commonly referred to as: AV-CAN, EV-CAN, and Car-CAN. The CAN protocol used
in the Leaf is ISO 15765-4 CAN (11-bit ID, 500 kBd) which is often abbreviated to “ISO 15765-4 (CAN 11/500).”
Each CAN bus carries messages relating to a different aspect of the vehicle’s operation:
AV-CAN Messages related to the display screen.
Car-CAN Messages related to general vehicle operation including EV related messages.
EV-CAN Messages related to the battery and drive system.
Figure 1.2 depicts the mating-end view of the OBD-II vehicle diagnostic connector. Colours of the CAN bus
symbols are selected to correspond with the colour code of four-pair ethernet cable.
Figure 1.2: Nissan Leaf OBD-II diagnostic connector contact designation (mating-end view)
As depicted in Table 1.1, the Leaf uses five contacts with a mandated designation: chassis ground, signal ground,
Car-CAN high, Car-CAN low, and permanent +12 V DC. Designation of the remaining pins is specific to the Leaf :
AV-CAN low, +12 V DC when vehicle powered on, AV-CAN high, EV-CAN low, and EV-CAN high.
1 CAN bus symbol colours correspond to 4-pair ethernet cable colour code.
2 Mandated allocation defined in ISO 15031-3.
3 [myn10].
2 Chapter 1. Reference
CHAPTER
TWO
PARAMETER IDENTIFIERS
PID 0x358
Name Turn signal
2.1.1 AZE0
3
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
ELM327 console
Listing 2.1: Read PID 0x358 – turn signal status (ELM327 console)
1 > ATZ
2 > ATI
3 > ATL1
4 > ATH1
5 > ATS1
6 > ATAL
7 > ATSP6
8 > ATCRA 358
9 > ATMA
10 358 00 08 80 00 00 00 00 00
11 358 00 08 80 00 00 00 00 00
12 358 00 08 80 00 00 00 00 00
13 358 00 08 82 00 00 00 00 00
14 358 00 08 82 00 00 00 00 00
15 358 00 08 82 00 00 00 00 00
16 358 00 08 80 00 00 00 00 00
17 358 00 08 80 00 00 00 00 00
18 358 00 08 80 00 00 00 00 00
19 358 00 08 84 00 00 00 00 00
20 358 00 08 84 00 00 00 00 00
21 358 00 08 84 00 00 00 00 00
ELM327 Python
Listing 2.2: Read PID 0x358 – turn signal status (ELM327 Python script)
1 #!/usr/bin/env python
2
5 Query the turn signal status of a Nissan Leaf using an ELM327 compatible diagnostic
6 tool.
7
10 * AZE0
11 """
12
13 import serial
14
26 elm.write(b"ATH1\r") # headers on
27 print(elm.read_until(b"\r\n>").decode())
28
43 try:
44 while True:
45 print(elm.read_until(b"\r\n").decode(), flush=True)
46 except KeyboardInterrupt:
47 print("Keyboard interrupt")
48
49 elm.close()
PID 0x5B3
Name SoH, GID
2.2.1 AZE0
𝐹 · 80
ELM327 console
Equations
𝐺𝑖𝑣𝑒𝑛 :
𝑏𝑦𝑡𝑒𝐹 = 𝐸616 = 12310
𝑇 ℎ𝑒𝑛 :
(2.1)
𝐸𝑠𝑡𝑜𝑟𝑒𝑑 = 𝑏𝑦𝑡𝑒𝐹10 · 8010 𝑊 ·ℎ
= 12310 · 8010 𝑊 ·ℎ
= 984010 𝑊 ·ℎ
𝐺𝑖𝑣𝑒𝑛 :
𝑏𝑦𝑡𝑒𝐵 = 𝐴216 = 101000102
𝑇 ℎ𝑒𝑛 :
𝑆𝑜𝐻 = 𝑏𝑦𝑡𝑒𝐵2 >> 1 (2.2)
= 101000102 >> 1
= 010100012
= 8110 %
PID 0x5C5
Name Odometer
2.3.1 AZE0
C 7:0
odometer
byte 2
D 7:0
odometer
byte 3
(low)
ELM327 console
Equations
𝐺𝑖𝑣𝑒𝑛 :
𝑏𝑦𝑡𝑒𝐵 = 016 = 02
𝑏𝑦𝑡𝑒𝐶 = 9𝐵16 = 100110112
𝑏𝑦𝑡𝑒𝐷 = 𝐷𝐶16 = 110111002 (2.3)
16 8
𝑂𝑑𝑜𝑚𝑒𝑡𝑒𝑟 𝑟𝑒𝑎𝑑𝑖𝑛𝑔 = 02 (2 ) + 100110112 (2 ) + 110111002
= 10011011 110111002 = 9𝐵𝐷𝐶16
= 39900 𝑘𝑚
THREE
TUTORIALS
An introduction to reading the Car-CAN bus of the Nissan Leaf using an ELM327 compatible diagnostic tool.
3.1.1 Requirements
ELM327 diagnostic tools are available supporting either wireless or wired communication protocols. Wireless
communication protocols include:
• BT (Bluetooth)
• BTL (Bluetooth Low Energy)
• Wi-Fi
Wi-Fi diagnostic tools have the disadvantage that while in use your mobile or laptop is unable to connect to any
other Wi-Fi network.
The most common wired communication protocol is USB (Universal Serial Bus).
Note: Unfortunately the market is flooded with counterfeit ELM327 microcontrollers which have made their way
into inexpensive diagnostic tools. Often these devices do not fully support the ELM327 specification7 [JRPol-
lock17].
5 https://play.google.com/store/apps/details?id=de.kai_morich.serial_wifi_terminal
6 https://play.google.com/store/apps/developer?id=Kai+Morich
7 https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf
9
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
Genuine ELM327 microcontrollers are supplied by ELM Electronics Inc.8 who recommend seeking the assurance
from the device vendor that they use genuine ELM parts [elm20].
Terminal application
Select a terminal application that can be configured to connect to your diagnostic tool via the appropriate commu-
nication protocol.
Nissan Leaf
The Leaf has three CAN buses commonly referred to as: Car-CAN, EV-CAN, and AV-CAN. The diagnostic con-
nector CAN pin assignments are depicted in Figure 3.1 and listed in Table 3.1. The CAN protocol used in the
Car-CAN bus of the Leaf is ISO 15765-4 CAN (11-bit ID, 500 kBd) which is often abbreviated to “ISO 15765-4
(CAN 11/500).”
Figure 3.1: Nissan Leaf ISO 15031-3 diagnostic connector pin assignment (mating-end view)
Table 3.1: Nissan Leaf ISO 15031-3 diagnostic connector CAN bus pin
assignments
CAN bus Diagnostic connector pins
CAN high CAN low
Car-CAN 6 14
EV-CAN 12 13
AV-CAN 3 11
Standard OBD-II diagnostic tools connect to the Car-CAN bus on pins 6 and 14.
The Leaf does not support any the standard PIDs which are mandated for internal combustion engine vehicles.
This is despite having a OBD-II diagnostic connector in compliance with ISO 15031-3, and the CAN protocols
complying with ISO 15765-4.
In addition to the Leaf not supporting standard PIDs there can be PID variations between Leaf models.
3.1.2 Set up
Set up involves connecting the diagnostic tool to the vehicle and configuring the terminal application which runs
on your mobile or laptop.
Warning: Using a poor quality diagnostic tool may cause the vehicle to behave unexpectedly.
8 https://www.elmelectronics.com/
10 Chapter 3. Tutorials
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
Insert the diagnostic tool into the vehicle’s OBD-II diagnostic connector – which is found beneath the steering
column. Then power-on the vehicle to activate the Car-CAN bus.
Configuration of the terminal application depends on the communication protocol supported by your diagnostic
tool and the terminal software being used.
Wi-Fi:
1. Connect to the diagnostic tool as you would connect to a Wi-Fi access point.
2. Configure the terminal application with the host and port of the diagnostic tool according to the user guide.
Common configuration is:
Host 192.168.0.10
Port 35000
Protocol Raw
The ELM327 is instructed by sending a series of AT commands from the terminal application.
AT commands
Commands used in this tutorial are listed in table Table 3.2. The complete ELM327 command set can be found in
the ELM327 specification9 .
In Listing 3.1 the status of the vehicle’s turn signal is read. Commands on lines 1 to 7 initialise the ELM327.
Command ATCRA 358 on line 8 filters messages with the PID 0x358.
12 Chapter 3. Tutorials
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
14 Chapter 3. Tutorials
APPENDIX
RELATED MATERIAL
10 https://www.nissan-techinfo.com/
11 https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3
15
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
GLOSSARY
AT commands A command language supported by the ELM327 with “AT” meaning “attention.”
AV-CAN Name of the Nissan Leaf CAN bus which carries predominantly infotainment data. Exposed on pins 3
and 11 of the diagnostic connector.
CAN Abbreviation for controller area network.
CAN protocol Transport protocol (layer 4) and network (layer 3) protocol implemented on a CAN bus. The OBD-
II protocol used by the Nissan Leaf is ISO 15765-4 CAN (11-bit ID, 500 kBd).
Car-CAN Name of the Nissan Leaf CAN bus exposed on pins 6 and 14 of the diagnostic connector.
communication protocol A system of rules that allow two or more entities of a communications system to transmit
information.
controller area network A vehicle bus standard designed to allow microcontrollers and devices to communicate
without a host computer.
diagnostic connector A physical connector used to access on-board diagnostics and data streams. The OBD-II
diagnostic connector (defined in ISO 15031-3) is a 16-pin connector which, on a Nissan Leaf, is located
beneath the steering column.
diagnostic tool An electronic device that interfaces with a vehicle’s diagnostic connector.
ELM327 A proprietary, pre-programmed, microcontroller produced by ELM Electronics Inc.1216 for communi-
cating with a vehicle’s on-board diagnostics interface. The ELM327 command protocol is one of the most
popular PC-to-OBD interface standards and is also implemented by other vendors.
ELM327 compatible Used to describe a device capable of translating the on-board diagnostics interface and
which supports the ELM327 command set.
EV-CAN Name of the Nissan Leaf CAN bus which carries data related to the traction battery and electric motor
drive system. Exposed on pins 12 and 13 of the diagnostic connector.
GID Unit named after Gary Giddings who is credited with discovering the significance of 5B3 SoH, GID (page 5)
byte F.
ISO 15031-3 Document published by the International Organization for Standardization1317 (ISO) titled Road
vehicles — Communication between vehicle and external equipment for emissions-related diagnostics —
Part 3: Diagnostic connector and related electrical circuits: Specification and use.
ISO 15765-4 Document published by the International Organization for Standardization14? (ISO) titled Road ve-
hicles — Diagnostic communication over Controller Area Network (DoCAN) — Part 4: Requirements for
emissions-related systems.
kBd Abbreviation for kilobaud where 1 kBd = 1000 Bd (baud).
OBD-II Abbreviation for revision two of the on-board diagnostics standardised interface.
12 https://www.elmelectronics.com/
16 https://www.elmelectronics.com/
13 https://www.iso.org/
17 https://www.iso.org/
14 https://www.iso.org/
17
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
15 https://www.sae.org/
18 https://www.sae.org/
18 Appendix B. Glossary
APPENDIX
DISCLAIMER
An advisory issued by Nissan states that an after market diagnostic tool should never be connected to the diagnostic
connector.
About mounting external communication equipment on the OBD-II connector
Do not attach an aftermarket communication device to the OBD-II connector.
External communication equipment attached to the OBD-II connector may affect the control of the
vehicle engine, brakes, steering, etc., and may not operate normally, leading to unexpected troubles.
—Advisory issued by Nissan [nis15] English translation by Google Translate
Source of translation:
OBD-IIコネクタへの社外品の通信機器装着について
OBD-IIコネクタに社外品の通信機器を取り付けないでください
OBD-IIコネクタへ取り付けた社外品の通信機器が、車両のエンジン・ブレーキ・ステアリ
ング等の
制御に影響を与え、正常に作動せず、思わぬトラブルにつながるおそれがあります。
—Advisory issued by Nissan [?]
19
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
20 Appendix C. Disclaimer
APPENDIX
LICENSE
Nissan and Leaf are trade marks of Nissan Jidosha Kabushiki Kaisha (also trading as Nissan Motor Co., Ltd.).
D.2 Prose
19
This work is licensed under a Creative Commons Attribution 4.0 International
20
License .
MIT License
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 https://creativecommons.org/licenses/by/4.0/
20 https://creativecommons.org/licenses/by/4.0/
21 https://opensource.org/licenses/MIT
21
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
22 Appendix D. License
BIBLIOGRAPHY
23
Nissan Leaf OBD-II manual, Release 2022.3.12+6c7ec78
24 Bibliography
INDEX
A
AT commands, 17
AV-CAN, 17
AZE0, 9
C
CAN, 17
CAN protocol, 17
Car-CAN, 17
communication protocol, 17
controller area network, 17
D
diagnostic connector, 17
diagnostic tool, 17
E
ELM327, 9, 17
ELM327 compatible, 17
EV-CAN, 17
G
GID, 17
I
ISO 15031-3, 17
ISO 15765-4, 17
K
kBd, 17
O
OBD-II, 17
on-board diagnostics, 18
P
parameter ID, 18
PID, 18
S
SAE J1962, 18
SoH, 18
T
terminal application, 18
Type A diagnostic connector, 18
25