OBD (PWM) To RS232 Interpreter ELM320: Description Features
OBD (PWM) To RS232 Interpreter ELM320: Description Features
OBD (PWM) To RS232 Interpreter ELM320: Description Features
Description Features
Since the 1996 model year, North American • Low power CMOS design
automobiles have been required to provide an OBD,
• High current drive outputs
or On Board Diagnostics, port for the connection of
test equipment. Data is transferred serially between • Crystal controlled for accuracy
the vehicle and the external equipment using this
• Fully configurable using AT commands
connection, in a manner specified by the Society of
Automotive Engineers (SAE) standards. In addition • Standard ASCII character output
to operating at different voltage levels, these ports
• High speed RS232 communications
also use a data format that is not compatible with the
standard used for personal computers. • 41.6KHz J1850 PWM protocol
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 Connection Diagram
only a standard serial port and a terminal program. PDIP and SOIC
By also enhancing it with an interface program, (top view)
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 VDD 1 8 VSS
OBD system, so a few features such as RS232
XT1 2 7 OBDOut
handshaking, variable baud rates, etc., have not
been implemented. In addition, this device is only XT2 3 6 Tx
able to communicate using the 41.6KHz J1850 PWM
OBDIn 4 5 Rx
protocol that is commonly used in Ford Motor
Company vehicles.
Applications
• Diagnostic trouble code readers
• Automotive scan tools
3.58MHz
Block Diagram
2 3
XT1 XT2
Timing and
Control
Tx 6 4 OBDIn
RS232 OBD
Interpreter
Interface Interface
Rx 5 7 OBDOut
Pin Descriptions
VDD (pin 1) Rx (pin 5)
This pin is the positive supply pin, and should The computer’s RS232 transmit signal can be
always be the most positive point in the circuit. directly connected to this pin from the RS232
Internal circuitry connected to this pin is used to line, as long as a current limiting resistor
provide power on reset of the microprocessor, so (typically about 47KΩ) is installed in series.
an external reset signal is not required. Refer to (Internal protection diodes will pass the input
the Electrical Characteristics section for further currents safely to the supply connections,
information. protecting the ELM320.) Internal signal inversion
and Schmitt trigger waveshaping provide the
XT1 (pin 2) and XT2 (pin 3) necessary signal conditioning.
A 3.579545 MHz NTSC television colourburst
crystal is connected between these two pins. Tx (pin 6)
Crystal loading capacitors (typically 27pF) will The RS232 data output pin. The signal level is
also normally be connected between each of the compatible with most interface ICs, and there is
pins and the circuit common (Vss). sufficient current drive to allow interfacing using
only a single PNP transistor, if desired.
OBDIn (pin 4)
OBDOut (pin 7)
The OBD data is input to this pin, with a high
logic level representing the active state (and a This is the active low output signal which is used
low, the passive). No Schmitt trigger input is to drive the OBD bus to the active state. Since
provided, so the OBD signal should be buffered the J1850 PWM standard requires a differential
to minimize transition times for the internal bus signal, the user must create the complement
CMOS circuitry. The external level shifting of this signal to drive the other bus line. See the
circuitry is usually sufficient to accomplish this – Example Application section for more details.
see the Example Application section for a typical
circuit. VSS (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 208 mil SOIC surface
mount type of package. To order, add the appropriate suffix to the part number:
300 mil Plastic DIP............................... ELM320P 208 mil SOIC..................................... ELM320SM
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.
Notes:
1. This integrated circuit is produced with a Microchip Technology Inc.’s PIC12C509A 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).
Overview
The following describes how to use the ELM320 to features of this product as well.
obtain a great deal of information from your vehicle. To It is not as daunting as it first appears. Many users
many, the quantity of information will be overwhelming, will never need to issue an ‘AT’ command, adjust
and to others it is not nearly enough. timeouts or change the headers. For most, all that is
We begin by discussing just how to talk to the IC, required is a PC or a PDA with a terminal program
then how to adjust some options through the use of (such as HyperTerminal or ZTerm), and knowledge of
‘AT’ commands, and finally go on to actually talk to the one or two OBD commands, which we provide in the
vehicle, obtaining trouble codes and resetting them. following…
For the more advanced experimenters, there are also
sections on how to use some of the programmable
AT Commands
Several parameters within the ELM320 can be ‘OK’ on the successful completion of a command, so
adjusted in order to modify its behaviour. These do not the user knows that it has been executed.
normally have to be changed before attempting to talk Some of the following commands allow passing
to the vehicle, but occasionally the user may wish to numbers as arguments in order to set the internal
customize the settings, for example by turning the values. These will always be hexadecimal numbers
character echo off, adjusting the timeout value, or which must be provided in pairs. The hexadecimal
changing the header addresses. In order to do this, conversion chart in the next section may prove useful
internal ‘AT’ commands must be issued. if you wish to interpret the values. Also, one should be
Those familiar with PC modems will immediately aware that for the on/off types of commands, the
recognize AT commands as a standard way in which second character is a number (1 or 0), the universal
modems are internally configured. The ELM320 uses terms for on and off, respectively.
essentially the same method, always watching the The following is a summary of all of the AT
data sent by the PC, looking for messages that begin commands that are recognized by the current version
with the character ‘A’ followed by the character ‘T’. If of the ELM320, sorted alphabetically. Users of
found, the next characters will be interpreted as previous versions of this product (v1.x) should note
internal configuration or ‘AT’ commands, and will be that their ICs will only support the E, H and Z options.
executed upon receipt of a terminating carriage return
character. The ELM320 will reply with the characters
AR [ Automatically set the Receive address ] E0 and E1 [ Echo off (0) or on(1) ]
Responses from the vehicle will be acknowledged These commands control whether or not characters
and displayed by the ELM320, if its internally stored received on the RS232 port are retransmitted (or
receive address matches the address that the echoed) back to the host computer. To reduce traffic
message is being sent to. With the auto receive on the RS232 bus, users may wish to turn echoing
mode in effect, the value used for the receive off by issuing ATE0. The default is E1 (echo on).
address will be chosen based on the current header
bytes, and will automatically be updated whenever
FD [ send Formatted Data ]
the header bytes are changed.
This command requests that all responses be
The value that is used for the receive address is
returned as standard ASCII characters which are
determined based on the contents of the first header
readable on virtually any standard terminal program.
byte. If it shows that the message uses physical
Hex digits are shown as two ASCII characters, and
addressing, the third header byte of the header is
spaces are provided between each byte as a
used for the receive address, otherwise (for
separator. Also, every line will end with a carriage
functional addressing) the second header byte,
return character and (optionally) a linefeed
increased in value by 1, will be used. Auto Receive
character, ensuring that every response appears on
is turned on by default.
a new line. This is the default mode.
AT Commands (continued)
I [ Identify yourself ] the MA and MR monitoring modes, any RS232
Issuing this command causes the chip to identify activity (single character) aborts the monitoring.
itself, by printing the startup product ID string (this is
currently ‘ELM320 v2.0’). Software can use this to PD [ send Packed Data ]
determine exactly which integrated circuit it is talking
This option is for those that are building a computer
to, without resorting to resetting the entire IC.
interface and want the fastest data transfer rate
possible while still operating at 9600 baud. When
L0 and L1 [ Linefeeds off (0) or on(1) ] selected, responses from the vehicle will be
Whether the ELM320 transmits a linefeed character formatted as an initial length byte followed by the
after each carriage return character is controlled by actual response bytes from the vehicle, with no
this option. If an ATL1 is issued, linefeed generation trailing carriage returns or linefeed characters. The
will be turned on, and for ATL0, it will be off. Users data will not be altered in any way, except for the
may wish to have this option on if using a terminal conversion to standard RS232 bytes.
program, but off if using a custom interface (as the Note that the length byte only represents the total
extra characters transmitted will only serve to slow number of data bytes following, and does not include
the vehicle polling down). The default setting is L1 itself. Also, if there was a data (checksum) error, the
(linefeeds on) length byte will have its most significant bit set, so
the user should always check first to see if the length
is greater than 127. (The other 7 bits still provide a
MA [ Monitor All messages ]
valid byte count if there is an error, so one need only
Using this command places the ELM320 into a bus ignore the msb, or subtract 128 from the value.)
monitoring mode, in which it displays all messages
A ‘NO DATA’ response has no data bytes, but still
as it sees them on the OBD bus. This continues
sends a length byte with value ‘0’.
indefinitely until stopped by activity on the RS232
input. To stop the monitoring, one should send any
single character then wait for the ELM320 to respond R0 and R1 [ Responses off (0) or on(1) ]
with a prompt character (‘>’). Waiting for the prompt These commands control the ELM320’s automatic
is necessary as the response time is unpredictable, display of responses. If responses have been turned
varying depending on the IC was doing when off, the IC will not wait for anything to be returned
interrupted. If for instance it is in the middle of from the vehicle after sending a request, and will
printing a line, it will first complete the line then return immediately to waiting for RS232 commands.
return to the command state, issuing the prompt This is useful if sending commands blindly when
character. If it were simply waiting for input, it would using the IC for a non-OBD network application, or
return immediately. The character which stops the simulating an ECU, in a basic learning environment.
monitoring will always be discarded, and will not It is not recommended that this option normally be
affect subsequent commands. used, however, as the vehicle may have difficulty if it
is expecting an acknowledgement byte and never
MR hh [ Monitor for Receiver hh ] receives one. The default is R1 (responses on).
This command also places the IC in a bus monitoring
mode, displaying only messages that were sent to SH xx yy zz [ Set the Header to xx yy zz ]
the hex address given by hh (i.e. messages which This command allows the user to control the values
are found to have that value in their second byte). that are sent as the three header bytes in the
Any RS232 activity (single character) aborts the message. The value of hex digits xx will be used for
monitoring, as with the MA command. the first or priority/type byte, yy will be used for the
second or target byte, and zz will be used for the
MT hh [ Monitor for Transmitter hh ] third or source byte. These remain in effect until set
again, or until restored to the default values with the
Another monitoring command, which displays only
AT D, or AT Z commands. The default header values
messages sent by Transmitter address hh. As with
AT Commands (continued)
are 61 6A F1, as required by the SAE J1979
Diagnostic Test Modes (OBDII) standard.
AT Command Summary
Figure 1 (at the right) shows all of the ELM320
commands in one convenient chart. In order to help
with the understanding of these, we have grouped
the commands into three functional areas, but this
has no bearing on how the commands are to be
used, it is only for clarity. You may find this chart to
be useful when experimenting with the IC.
OBD Commands
If the bytes received on the RS232 bus do not received, and when the third character (the carriage
begin with the letters A and T, they are assumed to be return) is received, begin to assess the other two. It
commands for the vehicle’s OBD bus. The bytes will would see that they are both valid hex digits, and
be tested to ensure that they are valid pairs of would convert them to a one byte value (with a
hexadecimal digits and, if they are, will be combined decimal value of 166). Three header bytes and a
into bytes for transmitting to the vehicle. Recall that no checksum byte would be added, so a total of five bytes
checks are made as to the validity of the OBD would be sent to the vehicle. Note that the carriage
command – data is simply retransmitted as received. return character is only a signal to the ELM320, and is
OBD commands are actually sent to the vehicle not sent on to the vehicle.
embedded in a data message. The standards require After sending a command, the ELM320 listens on
that every message begin with three header bytes and the OBD bus for any responses that are directed to it.
end with a checksum byte, which the ELM320 adds Each received byte is converted to the equivalent
automatically to every message. The ELM320 powers- hexadecimal pair of ASCII characters and transmitted
on expecting to be used for the OBDII mandated on the RS232 port for the user. Rather than send
emissions diagnostics, and sets the header bytes control characters which are unprintable on most
accordingly. If you wish to perform more advanced terminals, the digits are sent as numbers and letters
functions, these bytes may be changed through the (e.g. the hex digit ‘A’ is transmitted as decimal value
use of AT commands. To view the extra bytes that are 65, and not 10).
received with the vehicle’s messages, turn the header If there was no response from the vehicle, due to
display on by issuing an ATH1 command. no data being available, or because the command is
The command portion of most OBD messages is not supported, a ‘NO DATA’ message will be sent. See
usually only one or two bytes in length, but can the error messages section for a description of this
occasionally be longer as the standard allows for as message and others.
many as seven. The current version of the ELM320
will accept the maximum seven command bytes (or 14
hexadecimal digits) per message, while users of
previous versions (v1.x) were limited to only three Hexadecimal Decimal
command bytes. In either case, attempts to send more Number Equivalent
than the maximum number of bytes allowed will result
0 0
in a syntax error, with the entire command being
ignored and a single question mark printed. 1 1
The use of hexadecimal digits for all of the data 2 2
exchange was chosen as it is the most common data 3 3
format used in the relevant SAE standards. It is 4 4
consistent with mode request listings and is the most 5 5
frequently used format for displaying results. With a 6 6
little practice, it should not be very difficult to deal in
7 7
hex numbers, but some may initially find the table in
8 8
Figure 2 or a calculator to be invaluable. All users will
eventually be required to manipulate the results in 9 9
some way, though (combine bytes and divide by 4 to A 10
obtain rpm, divide by 2 to obtain degrees of advance, B 11
etc.), and may find a software front-end more helpful. C 12
As an example of sending a command to the D 13
vehicle, assume that A6 (or decimal 166) is the E 14
command that is required to be sent. In this case, the
F 15
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 Figure 2. Hex to Decimal Conversion
ELM320 would store the characters as they are
Error Messages
When hardware or data problems are <DATA ERROR
encountered, the ELM320 will respond with one of the The error check result (CRC byte) was not as
following short messages. Here is a brief description of expected, indicating a data error in the line pointed
each… to (the ELM320 still shows you what it received).
There could have been a noise burst which
BUS BUSY interfered, or a circuit problem. Try re-sending the
The ELM320 tried to send the mode command or request.
request for about 0.5 seconds without success.
Messages are all assigned priorities, which allows
NO DATA
one message to take precedence over another.
More important things may have been going on, so There was no response obtained from the vehicle
try re-issuing your request. before a timeout occurred. The mode requested may
not be supported, so the vehicle ignored you, or the
timeout value was too short, or possibly the ignition
BUS ERROR key needs to be turned to ‘on’. Try issuing a 01 00
An attempt was made to send a message, and the command to be sure that the vehicle is ready to
data bus voltage did not respond as expected. This receive commands, and if that works, try adjusting
could be because of a circuit short or open, so check the timeout to a longer value using the Set Timeout
all of your connections and try once more. AT command.
DATA ERROR ?
There was an incomplete message received, and it This is the standard response for a misunderstood
was not enough to form a meaningful response. This command received on the RS232 bus. Usually it is
may have been caused by the key being turned off, due to a typing mistake.
or a loose connection, for example. Any monitoring
that was in progress will have been aborted.
>ATZ
to be sure the IC is reset and responding
>0100
to be sure the car is responding
>0101
to see how many codes are present
(look at the second digit of the 3rd byte)
>03
to see the codes
Ignore the first byte and read the others in
pairs. The table on page 10 helps.
>04
to reset the codes
Example Application
The SAE J1962 standard dictates that all OBD negative supply. The RS232 pin connections shown
compliant vehicles must provide a standard connector are for a standard 9 pin connector. If you are using the
near the driver’s seat, the shape and pinout of which is older 25 pin style, please refer to the web site help
shown in Figure 3 below. The circuitry described here pages for the equivalent pins.
will be used to connect to this plug without modification RS232 data from the computer is directly
to your vehicle. connected to pin 5 of the ELM320 through a 47KΩ
The male J1962 connector required to mate with a current limiting resistor. This resistor allows for voltage
vehicle’s connector may be difficult to obtain in some swings in excess of the supply levels while preventing
locations, and you could be tempted to improvise by damage to the ELM320. A single 100KΩ resistor is
making your own connections to the back of your also shown in this circuit so that pin 5 is not left floating
vehicle’s connector. If doing so, we recommend that if the computer is disconnected.
you do nothing which would compromise the integrity Transmission of RS232 data is via the single PNP
of your vehicle’s OBD network. The use of any transistor connected to pin 6. This transistor allows the
connector which could easily short pins (such as an output voltage to swing between +5V and the negative
RJ11 type telephone connector) would definitely not voltage stored on the 0.1µF capacitor (which is
be recommended. charged by the computer’s TxD line). Although it is a
The circuit of Figure 4 on the next page shows simple connection, it is quite effective for this type of
how the ELM320 would typically be used. Circuit application.
power has been obtained from the vehicle (via OBD Finally, the crystal shown connected between pins
pins 16 and 5) and, after some minor filtering, is 2 and 3 is a common TV type that can be easily and
presented to a low power (100 mA) 5 volt regulator. inexpensively obtained. The 27pF crystal loading
The output of this regulator powers several points in capacitors shown are only typical, so you may have to
the circuit as well as an LED (for visual confirmation select other values depending on what is specified for
that power is present). the crystal you obtain.
The remaining two connections to the vehicle This completes the description of the circuit. While
(OBD pins 2 and 10) are for the differential data it is the minimum required to talk to an OBD equipped
system specified by the J1850 PWM standard. When vehicle (it relies on such techniques as using the
no data is being transmitted, both wires are idle with internal current limiting of the 78L05 for circuit
the transistor drivers off, and the resistive pullup and protection, for example), it is a fully functional circuit.
pulldown allow voltage levels to float to the supply As an experimenter, you may want to expand on it,
levels. Note that the PNP driver transistor and the providing more protection from faults and electrostatic
2.7KΩ pullup resistor both have series protection discharge, or providing a different interface for the
diodes to prevent backfeeds into the ELM320 circuitry. RS232 connection to the computer. Then perhaps a
The ELM320 has only one OBD data output line Basic program to make it easier to talk to the vehicle,
(pin 7). It is an active low signal, so must be used to and a method to log your findings, and…
drive the open-collector ‘Bus +’ signal via the PNP
transistor as shown. By using a portion of this same
signal to drive the NPN transistor for the ‘Bus -’ signal,
one obtains open collector differential drive.
Data is received from the OBD bus, then 1 8
converted and level-shifted by the NPN/PNP transistor
9 16
pair that are shown connected to pin 4 of the ELM320.
The NPN transistor detects the differential data signal
while allowing for the presence of common mode
voltages, and the PNP transistor provides the 0 to 5 Figure 3. Vehicle Connector
volt levels required by OBDIn (pin 4).
A very basic RS232 interface is shown connected
to pins 5 and 6 of the ELM320. This circuit ‘steals’
power from the host computer in order to provide a full
swing of the RS232 voltages without the need for a
OBD
Interface
4.7KΩ
2
(Bus +)
4.7KΩ
10
(Bus -)
+5V
RS232
10KΩ Interface
(DB9F)
+5V
+5V 2 (RxD)
0.01µF 10KΩ
4.7KΩ
3 6
27pF 4 5 3 (TxD)
+5V
47KΩ
100KΩ
+5V
10KΩ
1 (DCD)
4.7KΩ 4 (DTR)
6 (DSR)
4.7KΩ 7 (RTS)
8 (CTS)