ELM327 OBD to RS232 Interpreter

ELM327
OBD to RS232 Interpreter
Description
Features
Almost all of the automobiles produced today
are required, by law, to provide an interface for the
connection of diagnostic test equipment. The data
transfer on these interfaces follow several standards,
but none of them are directly usable by PCs or smart
devices. The ELM327 is designed to act as a bridge
between these On-Board Diagnostics (OBD) ports
and a standard RS232 serial interface.
In addition to being able to automatically detect
and interpret nine OBD protocols, the ELM327 also
provides support for high speed communications, a
low power sleep mode, and the J1939 truck and bus
standard. It is also completely customizable, should
you wish to alter it to more closely suit your needs.
The following pages discuss all of the ELM327’s
features in detail, how to use it and configure it, as
well as providing some background information on
the protocols that are supported. There are also
schematic diagrams and tips to help you to interface
to microprocessors, construct a basic scan tool, and
to use the low power mode.
• Power Control with standby mode
• Universal serial (RS232) interface
• Automatically searches for protocols
• Fully configurable with AT commands
• Low power CMOS design
Connection Diagram
PDIP and SOIC
(top view)
MCLR
OBD Tx LED
Vmeasure
OBD Rx LED
J1850 Volts
RS232 Tx LED
J1850 Bus+
RS232 Rx LED
Memory
CAN Rx
Baud Rate
CAN Tx
LFmode
ISO L
Applications
• Diagnostic trouble code readers
• Automotive scan tools
• Teaching aids
Block Diagram
VSS
ISO K
XT1
VDD
XT2
VSS
VPW In
RS232 Rx
ISO In
RS232 Tx
PWM In
PwrCtrl / Busy
J1850 Bus-
IgnMon / RTS
4.00 MHz
Baud Rate
LFmode
6
Memory
5
7
XT1
9
XT2
10
MCLR
1
Vmeasure
2
RS232Rx
18
RS232Tx
17
PwrCtrl / Busy
16
IgnMon / RTS
15
RS232
Interface
Command
and
Protocol
Interpreter
Power
Control
A/D
Converter
ISO 15765-4
SAE J1939
23
25
26
27
24
28
ISO 9141-2
ISO 14230-4
21
22
12
SAE J1850
PWM & VPW
3
4
14
13
11
OBD interfaces
status LEDs
ELM327QSJ
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
1 of 8
ELM327
Pin Descriptions
MCLR (pin 1)
A momentary (>2µsec) logic low applied to this input
will reset the ELM327. If unused, this pin should be
connected to a logic high (VDD) level.
Vmeasure (pin 2)
This analog input is used to measure a 0 to 5V
signal that is applied to it. Care must be taken to
prevent the voltage from going outside of the supply
levels of the ELM327, or damage may occur. If it is
not used, this pin should be tied to either VDD or VSS.
J1850 Volts (pin 3)
This output can be used to control a voltage supply
for the J1850 Bus+ output. The pin normally outputs
a logic high level when a nominal 8V is required (for
J1850 VPW), and a low level for 5V (for J1850
PWM), but this can be changed with PP 12. If this
switching capability is not required for your
application, this output can be left open-circuited.
J1850 Bus+ (pin 4)
This active high output is used to drive the
J1850 Bus+ Line to an active level. Note that this
signal does not have to be used for the Bus- Line (as
was the case for the ELM320), since a separate
J1850 Bus- drive output is provided on pin 14.
return and a linefeed character. If it is at a low level,
lines will be terminated by a carriage return only.
This behaviour can always be modified by issuing an
AT L1 or AT L0 command.
VSS (pin 8)
Circuit common must be connected to this pin.
XT1 (pin 9) and XT2 (pin 10)
A 4.000 MHz oscillator crystal is connected between
these two pins. Loading capacitors as required by
the crystal (typically 27pF each) will also need to be
connected between each of these pins and circuit
common (Vss).
Note that this device has not been configured for
operation with an external oscillator – it expects a
crystal to be connected to these pins. Use of an
external clock source is not recommended. Also,
note that this oscillator is turned off when in the Low
Power or ‘standby’ mode of operation.
VPW In (pin 11)
This is the active high input for the J1850 VPW data
signal. When at rest (bus recessive) this pin should
be at a low logic level. This input has Schmitt trigger
wave shaping, so no special amplification is
required.
Memory (pin 5)
This input controls the default state of the memory
option. If this pin is at a high level during power-up or
reset, the memory function will be enabled by
default. If it is at a low level, then the default will be
to have it disabled. Memory can always be enabled
or disabled with the AT M1 and AT M0 commands.
ISO In (pin 12)
This is the active low input for the ISO 9141 and
ISO 14230 data signal. It is derived from the K Line,
and should be at a high logic level when at rest (bus
recessive). No special amplification is required, as
this input has Schmitt trigger wave shaping.
Baud Rate (pin 6)
This input controls the baud rate of the RS232
interface. If it is at a high level during power-up or
reset, the baud rate will be set to 38400 (or the rate
that has been set by PP 0C). If at a low level, the
baud rate will be initialized to 9600 bps.
PWM In (pin 13)
This is the active low input for the J1850 PWM data
signal. It should normally be at a high level when at
rest (ie. bus recessive). This input has Schmitt
trigger wave shaping, so no special amplification is
required.
LFmode (pin 7)
This input is used to select the default linefeed mode
to be used after a power-up or system reset. If it is at
a high level, then by default messages sent by the
ELM327 will be terminated with both a carriage
J1850 Bus- (pin 14)
This active high output is used to drive the J1850
Bus- Line to an active (dominant) level for J1850
PWM applications. If unused, this output can be left
open-circuited.
ELM327QSJ
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
2 of 8
ELM327
Pin Descriptions (continued)
IgnMon / RTS (pin 15)
This input pin can serve one of two functions,
depending on how the Power Control options
(PP 0E) are set.
If both bit 7 and bit 2 of PP 0E are ‘1’s, this pin will
act as an Ignition Monitor. This will result in a switch
to the Low Power mode of operation, should the
IgnMon signal go to a low level, as would happen if
the vehicle’s ignition were turned off. An internal
‘debounce’ timer is used to ensure that the ELM327
does not shut down for noise at the input.
When the voltage at pin 15 is again restored to a
high level, and a time of 1 or 5 seconds (as set by
PP 0E bit 1) passes, the ELM327 will perform a
‘Warm Start’ and return to normal operation. A low to
high transition at pin 15 will in fact restore normal
operation, regardless of the setting of PP 0E bit 2, or
whether pin 15 was the initial cause for the low
power mode. This feature allows a system to control
how and when it switches to low power standby
operation, but still have automatic wakeup by the
ignition voltage, or even by a pushbutton.
If either bit 7 or bit 2 of PP 0E are ‘0’, this pin will
function as an active low ‘Request To Send’ input.
This can be used to interrupt the OBD processing in
order to send a new command, or as previously
mentioned, to highlight the fact that the ignition has
been turned off. Normally kept at a high level, this
input is brought low for attention, and should remain
so until the Busy line (pin 16) indicates that the
ELM327 is no longer busy, or until a prompt
character is received (if pin 16 is being used for
power control).
This input has Schmitt trigger wave shaping. By
default, pin 15 acts as the RTS interrupt input.
PwrCtrl / Busy (pin 16)
This output pin can serve one of two functions,
depending on how the Power Control options
(PP 0E) are set.
If bit 7 of PP 0E is a ‘1’ (the default), this pin will
function as a Power Control output. The normal state
of the pin will be as set by PP 0E bit 6, and the pin
will remain in that state until the ELM327 switches to
the Low Power mode of operation, when the output
changes to the opposite level. This output is typically
used to control enable inputs, but may also be used
for relay circuits, etc. with suitable buffering. The
ELM327QSJ
discussion on page 84 (‘Modifications for Low Power
Standby Operation’) provides more detail on how to
use this output.
If bit 7 of PP 0E is a ‘0’, pin 16 will function as a
‘Busy’ output, showing when the ELM327 is actively
processing a command (the output will be at a high
level), or when it is idle, ready to receive commands
(the output will be low).
By default, bit 7 of PP 0E is ‘1’, so pin 16 provides
the Power Control function.
RS232Tx (pin 17)
This is the RS232 data transmit output. The signal
level is compatible with most interface ICs (the
output is high when idle), and there is sufficient
current drive to allow interfacing using only a PNP
transistor, if desired.
RS232Rx (pin 18)
This is the RS232 receive data input. The signal
level is compatible with most interface ICs (when at
idle, the level should be high), but can be used with
other interfaces as well, since the input has Schmitt
trigger wave shaping.
VSS (pin 19)
Circuit common must be connected to this pin.
VDD (pin 20)
This pin is the positive supply pin, and should always
be the most positive point in the circuit. Internal
circuitry connected to this pin is used to provide
power on reset of the ELM327 processor, so an
external reset signal is not required. Refer to the
Electrical Characteristics section for further
information.
ISO K (pin 21) and ISO L (pin 22)
These are the active high output signals which are
used to drive the ISO 9141 and ISO 14230 buses to
an active (dominant) level. Many new vehicles do not
require the L Line – if yours does not, you can simply
leave pin 22 open-circuited.
CAN Tx (pin 23) and CAN Rx (pin 24)
These are the two CAN interface signals that must
be connected to a CAN transceiver IC (see the
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
3 of 8
ELM327
Pin Descriptions (continued)
Example Applications section for more information).
If unused, pin 24 must be connected to a logic high
(VDD) level.
RS232 Rx LED (pin 25), RS232 Tx LED (pin 26),
OBD Rx LED (pin 27) and OBD Tx LED (pin 28)
These four output pins are normally high, and are
driven to low levels when the ELM327 is transmitting
or receiving data. These outputs are suitable for
directly driving most LEDs through current limiting
resistors, or interfacing to other logic circuits. If
unused, these pins may be left open-circuited.
Note that pin 28 can also be used to turn off all of the
Programmable Parameters, if you can not do so by
using the normal interface - see page 69 for details.
Unused Pins
When people only want to implement a portion of what the ELM327 is capable of, they often ask what to do with the
unused pins. The rule is that unused outputs may be left open-circuited with nothing connected to them, but unused
inputs must be terminated. The ELM327 is a CMOS integrated circuit that can not have any inputs left floating (or
you might damage the IC). Connect unused inputs as follows:
Pin
1
2
5
6
7
11
12
13
15
18
24
Level
H
H*
H*
H*
H*
H*
L*
L*
H
H
H
Note that the inputs that are shown with an asterisk (*) may be connected to either a High (VDD) or a Low (VSS)
level, but the level shown is preferred.
Absolute Maximum Ratings
Storage Temperature....................... -65°C to +150°C
Ambient Temperature with
Power Applied....................................-40°C to +85°C
Voltage on VDD with respect to VSS..... -0.3V to +7.5V
Note:
These values are given as a design guideline only.
The ability to operate to these levels is neither
inferred nor recommended, and stresses beyond
those listed here will likely damage the device.
Voltage on any other pin with
respect to VSS........................... -0.3V to (VDD + 0.3V)
ELM327QSJ
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
4 of 8
ELM327
Electrical Characteristics
All values are for operation at 25°C and a 5V supply, unless otherwise noted. For further information, refer to note 1 below.
Characteristic
Minimum
Typical
Supply voltage, VDD
4.2
5.0
VDD rate of rise
0.05
Average current, IDD
normal
low power
Input logic levels
Schmitt trigger
input thresholds
Maximum Units
5.5
V
V/ms
12
mA
0.15
mA
low
VSS
0.8
V
high
3.0
VDD
V
4.0
V
rising
falling
2.9
see note 2
ELM327 device only - does not
include any load currents
Pins 5, 6, 7, and 24 only
Pins 1, 11, 12, 13, 15 and 18 only
1.5
V
Output low voltage
0.3
V
current (sink) = 10 mA
Output high voltage
4.4
V
current (source) = 10 mA
Brown-out reset voltage
1.0
Conditions
2.65
A/D conversion time
2.79
9
Pin 18 wake pulse duration
128
IgnMon debounce time
50
2.93
V
msec
AT RV to beginning of response
µsec
to wake from Low Power mode
65
msec
AT LP to PwrCtrl output time
1.0
sec
LP ALERT to PwrCtrl output time
2.0
sec
Reset time
800
msec
2
msec
AT Z
AT WS
Measured from the end of the
command to the start of the ID
message (ELM327 v2.1)
Notes:
1. This integrated circuit is based on Microchip Technology Inc.’s PIC18F2480 device. For more detailed
device specifications, and possibly clarification of those given, please refer to the Microchip documentation
(available at www.microchip.com).
2. This spec must be met in order to ensure that a correct power on reset occurs. It is quite easily achieved
using most common types of supplies, but may be violated if one uses a slowly varying supply voltage, as
may be obtained through direct connection to solar cells or some charge pump circuits.
ELM327QSJ
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
5 of 8
ELM327
AT Command Summary
General Commands
OBD Commands
<CR>
repeat the last command
AL
Allow Long (>7 byte) messages
BRD hh
try Baud Rate Divisor hh
AMC
display Activity Monitor Count
BRT hh
set Baud Rate Timeout
AMT hh
set the Activity Mon Timeout to hh
D
set all to Defaults
AR
Automatically Receive
E0, E1
Echo off, or on*
AT0, 1, 2
Adaptive Timing off, auto1*, auto2
FE
Forget Events
BD
perform a Buffer Dump
I
print the version ID
BI
Bypass the Initialization sequence
L0, L1
Linefeeds off, or on
DP
Describe the current Protocol
LP
go to Low Power mode
DPN
Describe the Protocol by Number
M0, M1
Memory off, or on
H0, H1
Headers off*, or on
RD
Read the stored Data
MA
Monitor All
SD hh
Save Data byte hh
MR hh
Monitor for Receiver = hh
WS
Warm Start (quick software reset)
MT hh
Monitor for Transmitter = hh
Z
reset all
NL
Normal Length messages*
@1
display the device description
PC
Protocol Close
@2
display the device identifier
R0, R1
Responses off, or on*
RA hh
set the Receive Address to hh
S0, S1
printing of Spaces off, or on*
PP xx OFF disable Prog Parameter xx
SH xyz
Set Header to xyz
PP FF OFF all Prog Parameters disabled
SH xxyyzz Set Header to xxyyzz
PP xx ON
enable Prog Parameter xx
SH wwxxyyzz Set Header to wwxxyyzz
PP FF ON
all Prog Parameters enabled
SP h
Set Protocol to h and save it
PP xx SV yy for PP xx, Set the Value to yy
SP Ah
Set Protocol to Auto, h and save it
PPS
SP 00
Erase stored protocol
SR hh
Set the Receive address to hh
SS
use Standard Search order (J1978)
@3 cccccccccccc store the @2 identifier
Programmable Parameter Commands
print a PP Summary
Voltage Reading Commands
ST hh
Set Timeout to hh x 4 msec
CV dddd
Calibrate the Voltage to dd.dd volts
TA hh
set Tester Address to hh
CV 0000
restore CV value to factory setting
TP h
Try Protocol h
RV
Read the input Voltage
TP Ah
Try Protocol h with Auto search
Other
IGN
ELM327QSJ
read the IgnMon input level
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
6 of 8
ELM327
AT Command Summary (continued)
J1850 Specific Commands (protocols 1 and 2)
IFR0, 1, 2
IFRs off, auto*, or on
IFR H, S
IFR value from Header* or Source
ISO Specific Commands (protocols 3 to 5)
FI
perform a Fast Initiation
IB 10
set the ISO Baud rate to 10400*
IB 48
set the ISO Baud rate to 4800
IB 96
set the ISO Baud rate to 9600
IIA hh
set ISO (slow) Init Address to hh
KW
display the Key Words
CAN Specific Commands (continued)
D0, D1
display of the DLC off*, or on
FC SM h
Flow Control, Set the Mode to h
FC SH hhh
FC, Set the Header to hhh
FC SH hhhhhhhh Set the Header to hhhhhhhh
FC SD [1 - 5 bytes] FC, Set Data to [...]
PB xx yy
Protocol B options and baud rate
RTR
send an RTR message
V0, V1
use of Variable DLC off*, or on
J1939 CAN Specific Commands (protocols A to C)
KW0, KW1 Key Word checking off, or on*
DM1
monitor for DM1 messages
SI
perform a Slow (5 baud) Initiation
JE
use J1939 Elm data format*
SW hh
Set Wakeup interval to hh x 20 msec
JHF0, JHF1 Header Formatting off, or on*
SW 00
Stop sending Wakeup messages
JS
use J1939 SAE data format
JTM1
set Timer Multiplier to 1*
JTM5
set Timer Multiplier to 5
MP hhhh
Monitor for PGN 0hhhh
WM [1 - 6 bytes] set the Wakeup Message
CAN Specific Commands (protocols 6 to C)
CEA
turn off CAN Extended Addressing
CEA hh
use CAN Extended Address hh
CAF0, CAF1 Automatic Formatting off, or on*
CF hhh
set the ID Filter to hhh
CF hhhhhhhh set the ID Filter to hhhhhhhh
CFC0, CFC1 Flow Controls off, or on*
CM hhh
set the ID Mask to hhh
CM hhhhhhhh set the ID Mask to hhhhhhhh
CP hh
set CAN Priority to hh (29 bit)
CRA
reset the Receive Address filters
CRA hhh
set CAN Receive Address to hhh
CRA hhhhhhhh set the Rx Address to hhhhhhhh
CS
show the CAN Status counts
CSM0, CSM1 Silent Monitoring off, or on*
CTM1
set Timer Multiplier to 1*
CTM5
set Timer Multiplier to 5
ELM327QSJ
MP hhhh n “
“ and get n messages
MP hhhhhh Monitor for PGN hhhhhh
MP hhhhhh n
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
“
“ and get n messages
7 of 8
ELM327
Outline Diagrams
The diagrams at the right show the two package
styles that the ELM327 is available in.
The first shows our ELM327P product in what is
commonly called a ‘300 mil skinny DIP package’. It is
used for through hole applications.
The ELM327SM package shown at right is also
sometimes referred to as 300 mil, and is often called
an SOIC package. We have chosen to simply refer to
it as an SM (surface mount) package.
The drawings shown here provide the basic
dimensions for these ICs only. Please refer to the
following Microchip Technology Inc. documentation for
more detailed information:
Package Drawings and Dimensions Specification,
(document name en012702.pdf - 7.5MB).
Go to www.microchip.com, select ‘Design Support’
then ‘Documentation’ then ‘Packaging Specifications’,
or go directly to www.microchip.com/packaging
PIC18F2480/2580/4480/4580 Data Sheet,
(document name 39637d.pdf - 8.0MB).
Go to www.microchip.com, select ‘Design Support’
then ‘Documentation’ then ‘Data Sheets, and search
for 18F2480.
ELM327P
2.54
7.24
max
10.92
ELM327SM
1.27
7.50
10.30
Note: all dimensions shown are in mm.
Ordering Information
ELM327 integrated circuits are 28 pin devices, available in either a 300 mil wide plastic (‘skinny’) DIP format or in a
300 mil (7.50 mm body) SOIC surface mount type of package. We do not offer an option for QFN packages.
To order, add the appropriate suffix to the part number:
300 mil 28 pin Plastic DIP..............................ELM327P
300 mil 28 pin SOIC....................................ELM327SM
ELM327 is a registered trademark of Elm Electronics Inc.
All rights reserved. Copyright 2005 to 2014 by Elm Electronics Inc.
Every effort is made to verify the accuracy of information provided in this document, but no representation or warranty can be
given and no liability assumed by Elm Electronics with respect to the accuracy and/or use of any products or information
described in this document. Elm Electronics will not be responsible for any patent infringements arising from the use of these
products or information, and does not authorize or warrant the use of any Elm Electronics product in life support devices and/or
systems. Elm Electronics reserves the right to make changes to the device(s) described in this document in order to improve
reliability, function, or design.
ELM327QSJ
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
8 of 8