ELM320
OBD (PWM) to RS232 Interpreter
Description
Since the 1996 model year, North American
automobiles have been required to provide an OBD,
or On Board Diagnostics, port for the connection of
test equipment. Data is transferred serially between
the vehicle and the external equipment using these
connections, in a manner specified by the Society of
Automotive Engineers (SAE) standards. In addition
to operating at different voltage levels, these ports
also use a data format that is not compatible with the
standard used for personal computers.
The ELM320 is an 8 pin integrated circuit that is
able to change the data rate and reformat the OBD
signals into easily recognized ASCII characters. This
allows virtually any personal computer to
communicate with an OBD equipped vehicle using
only a standard serial port and a terminal program.
By also enhancing it with an interface program,
hobbyists can create their own custom ‘scan tool’.
This integrated circuit was designed to provide a
cost-effective way for experimenters to work with an
OBD system, so many features such as RS232
handshaking, variable baud rates, etc., have not
been implemented. In addition, this device is only
able to communicate using the 41.6KHz J1850 PWM
protocol that is commonly used in Ford Motor
Company vehicles.
Features
• Low power CMOS design
• High current drive outputs - up to 25 mA
• Crystal controlled for accuracy
• Configurable with AT commands
• Standard ASCII character output
• High speed RS232 communications
• 41.6KHz J1850 PWM Protocol
Connection Diagram
PDIP and SOIC
(top view)
V
DD
XT1
XT2
OBDIn
1
2
3
4
8
7
6
5
V
SS
OBDOut
Tx
Rx
Applications
• Diagnostic Trouble Code Readers
• Automotive Scan Tools
3.58MHz
Block Diagram
XT1
2
3
XT2
Timing and
Control
Tx
Rx
6
5
RS232
Interface
Interpreter
OBD
Interface
4
OBDIn
OBDOut
7
ELM320DSB
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
1 of 10
ELM320
Pin Descriptions
V
DD
(pin 1)
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 microprocessor, so
an external reset signal is not required. Refer to
the Electrical Characteristics section for further
information.
XT1 (pin 2) and XT2 (pin 3)
A 3.579545MHz NTSC television colourburst
crystal is connected between these two pins.
Crystal loading capacitors (typically 27pF) will
also normally be connected between each of the
pins and the circuit common (Vss).
OBDIn (pin 4)
The OBD data is input to this pin, with a high
logic level representing the active state (and a
low, the passive). No Schmitt trigger input is
provided, so the OBD signal should be buffered
to minimize transition times for the internal
CMOS circuitry. The external level shifting
circuitry is usually sufficient to accomplish this –
see the Example Applications section for a
typical circuit.
Rx (pin5)
The computer’s RS232 transmit signal can be
directly connected to this pin from the RS232
line as long as a current limiting resistor
(typically about 47KΩ) is installed in series.
(Internal protection diodes will pass the input
currents safely to the supply connections,
protecting the ELM320.) Internal signal inversion
and Schmitt trigger waveshaping provide the
necessary signal conditioning.
Tx (pin 6)
The RS232 data output pin. The signal level is
compatible with most interface ICs, and there is
sufficient current drive to allow interfacing using
only a single PNP transistor, if desired.
OBDOut (pin 7)
This is the active low output signal which is used
to drive the OBD bus to its active state. Since the
J1850 PWM standard requires a differential bus
signal, the user must create the complement of
this signal to drive the other bus line. See the
Example Application section for more details.
V
SS
(pin 8)
Circuit common is connected to this pin. This is
the most negative point in the circuit.
Ordering Information
These integrated circuits are available in either the 300 mil plastic DIP format, or in the 200 mil SOIC surface
mount type of package. To order, add the appropriate suffix to the part number:
300 mil Plastic DIP............................... ELM320P
200 mil SOIC..................................... ELM320SM
All rights reserved. Copyright 2001 - 2002 Elm Electronics.
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.
ELM320DSB
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
2 of 10
ELM320
Absolute Maximum Ratings
Storage Temperature....................... -65°C to +150°C
Ambient Temperature with
Power Applied....................................-40°C to +85°C
Voltage on V
DD
with respect to V
SS
............ 0 to +7.5V
Voltage on any other pin with
respect to V
SS
........................... -0.6V to (V
DD
+ 0.6V)
Note:
Stresses beyond those listed here will likely damage
the device. These values are given as a design
guideline only. The ability to operate to these levels
is neither inferred nor recommended.
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
Supply voltage, V
DD
V
DD
rate of rise
Average supply current, I
DD
Input low voltage
Input high voltage
Output low voltage
Output high voltage
Rx pin input current
RS232 baud rate
Minimum
4.5
0.05
Typical
5.0
Maximum Units
5.5
V
V/ms
Conditions
see note 2
see note 3
1.0
V
SS
0.85 V
DD
2.4
0.15 V
DD
V
DD
0.6
mA
V
V
V
V
Current (sink) = 8.7mA
Current (source) = 5.4mA
see note 4
see note 5
V
DD
- 0.7
-0.5
9600
+0.5
mA
baud
Notes:
1. This integrated circuit is produced with a Microchip Technology Inc.’s PIC12C5XX as the core embedded
microcontroller. For further device specifications, and possibly clarification of those given, please refer to the
appropriate Microchip documentation (available at http://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.
3. Device only. Does not include any load currents.
4. This specification represents the current flowing through the protection diodes when applying large voltages
to the Rx input (pin 5) through a current limiting resistance. Currents quoted are the maximum that should be
allowed to flow continuously.
5. Nominal data transfer rate when a 3.58 MHz crystal is used as the frequency reference. Data is transferred
to and from the ELM320 with 8 data bits, no parity, and 1 stop bit (8 N 1).
ELM320DSB
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
3 of 10
ELM320
Communicating with the ELM320
The ELM320 relies on a standard RS232 type
serial connection to communicate with the user. The
data rate is fixed at 9600 baud, with 8 data bits, no
parity bit, 1 stop bit, and no handshaking (often
referred to as 9600 8N1). All responses from the IC
are terminated with only a single carriage return
character, and no line feed character. Some users
may wish to improve readability by configuring their
software to insert linefeed characters at the end of
each line.
Properly connected and powered, the ELM320 will
initially display the message:
ELM320 v1.1
>
In addition to identifying the version of the IC,
receipt of this string is a convenient way to be sure
that the computer connections and the settings are
correct. However, at this point no communications
have taken place with the vehicle, so the state of that
connection is still unknown.
The ‘>’ character displayed above is the ELM320’s
prompt character. It indicates that the device is in its
idle state, ready to receive characters on the RS232
port. Characters sent from the computer can either be
intended for the ELM320’s internal use, or for
reformatting and passing on to the vehicle’s OBD bus.
Commands for the ELM320 are distinguished from
those to the vehicle by always beginning with the
characters ‘AT’ (as is common with modems), while
commands for the OBD bus must contain only the
ASCII characters for hexadecimal digits (0 to 9 and A
to F). This allows the ELM320 to quickly determine
where the received characters are to be directed.
Whether an ‘AT’ type internal command or a hex
string for the OBD bus, all messages to the ELM320
must be terminated with a carriage return character
(hex ‘0D’) before it will be acted upon. The one
exception is when an incomplete string is sent and no
carriage return appears. In this case, an internal timer
will automatically abort the incomplete message after
about 10 seconds, and the ELM320 will print a single
question mark to show that the input was not
understood (and was not acted upon).
Messages that are misunderstood by the ELM320
(syntax errors) will always be signalled by a single
question mark (‘?’). These include incomplete
messages, invalid AT commands, or invalid
hexadecimal digit strings. It is not an indication of
whether or not the message was understood by the
vehicle. (The ELM320 is a protocol interpreter that
makes no attempt to assess OBD messages for
validity - it only ensures that an even number of hex
digits were received, combined into bytes, and sent
out the OBD port, so it cannot determine if the
message sent to the vehicle is in error.)
Incomplete or misunderstood messages can also
occur if the controlling computer attempts to write to
the ELM320 before it is ready to accept the next
command (as there are no handshaking signals to
control the data flow). To avoid a data overrun, users
should always wait for the prompt character (‘>’)
before issuing the next command.
Finally, a few convenience items to note. The
ELM320 is not case-sensitive, so ‘ATZ’ is equivalent to
‘atz’, and to ‘AtZ’. The device ignores space characters
as well as control characters (tab, linefeed, etc.) in the
input, so they can be inserted anywhere to improve
readability and, finally, issuing only a single carriage
return character will repeat the last command (making
it easier to request updates on dynamic data such as
engine rpm).
AT Commands
The ELM320 accepts internal configuration
commands in much the same manner that modems
do. Any message received, at any time, that begins
with the character ‘A’ followed by the character ‘T’ will
be considered an internal configuration or ‘AT’
command. These are executed upon receipt of the
terminating carriage return character, and successful
completion of the command is acknowledged by the
printing of the characters ‘OK’.
ELM320DSB
Communications on the OBD bus can generally
begin without requiring the issuance of any AT
commands, as the factory default settings should be
appropriate for most applications. Occasionally the
user may wish to customize settings, such as turning
the character echo off, etc. In these cases, AT
commands must be issued.
The following is a summary of the AT commands
that are recognized by the current version of the
4 of 10
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
ELM320
ELM320. Note that they are not case-sensitive, and
that the character ‘0’ is the number ‘zero’:
ATE0 and ATE1
These commands control whether characters
received on the RS232 port are retransmitted (or
echoed) back to the host computer. To reduce traffic
on the RS232 bus, users may wish to turn echoing
off by issuing ATE0. Echo is initially on at powerup
(default) and can be turned on at any time by issuing
ATE1.
ATH0 and ATH1
These commands control whether or not the header
information is shown in the responses. All OBD
messages have an initial (header) string of three
bytes and a trailing check digit (CRC character) that
is normally not displayed by the ELM320. To see this
extra information, users should turn headers on by
issuing ATH1. The default is H0 (headers off).
ATZ
This combination causes the chip to perform a
complete reset as if power were cycled off and then
on again. All settings are returned to their default
values, and the chip will be put in the idle state,
waiting for characters on the RS232 bus.
OBD Commands
If the bytes received on the RS232 bus do not
begin with the letters A and T, they are assumed to be
commands for the vehicle’s OBD bus. The bytes will
be tested to ensure that they are valid pairs of
hexadecimal digits and, if they are, will be combined
into bytes for transmitting. Recall that no checks are
made as to the validity of the OBD command – data is
simply retransmitted as received.
OBD commands are actually sent to the vehicle
embedded in a data message. The standards require
that every message begin with three header bytes and
end with a checksum byte, which the ELM320 adds
automatically for the user (the header bytes never
change in value, so are stored internally). To view the
extra bytes that are received with the vehicle’s
messages, issue an ATH1 internal command.
Most OBD commands to the vehicle are one or
two bytes in length, but some can be three or more
bytes long. As the ELM320 is considered an
experimenter’s circuit, it will only accept a maximum of
three command bytes (or six hexadecimal digits) per
message. Attempts to send more will result in a syntax
error, with the entire command being ignored and a
single question mark being printed.
The use of hexadecimal digits for all of the data
exchange was chosen as it is the most common data
format used in the relevant SAE standards. It is
consistent with mode request listings and is the most
frequently used format for displaying results. With a
little practice, it should not be very difficult to deal in
hex numbers, but some people may want to obtain a
conversion table or keep a calculator nearby. All users
will be required to manipulate the results in some way,
ELM320DSB
though (combine bytes and divide by 4 to obtain rpm,
divide by 2 to obtain degrees of advance, etc.), and
may find a software front-end helpful.
As an example of sending a command to the
vehicle, assume that A6 (or decimal 166) is the
command that is required to be sent. In this case, the
user would type the letter A, then the number 6, then
would press the return key. These three characters
would be sent to the ELM320 on the RS232 bus. The
ELM320 would store the characters as they are
received, and when the third character (the carriage
return) is received, begin to assess the other two. It
would see that they are both valid hex digits, and
would convert them to a one byte value (decimal value
is 166). Four header bytes would be added, and a total
of five bytes would be sent to the vehicle. Note that the
carriage return character is only a signal to the
ELM320, and is not sent to the vehicle.
After sending a command, the ELM320 listens on
the OBD bus for any responses that are directed to it.
Each received byte is converted to the equivalent
hexadecimal pair of ASCII characters and transmitted
on the RS232 port for the user. Rather than send
control characters which are unprintable on most
terminals, the digits are sent as numbers and letters
(eg. the hex digit ‘A’ is transmitted as decimal value
65, and not 10).
If there was no response from the vehicle, due to
no data being available, or because the command is
not supported, a ‘NO DATA’ message will be sent. See
the error messages section for a description of this
message and others.
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
5 of 10