You are on page 1of 8

User Manual For

Toyota OBD I Diag Port Reader

Ron Riedel
March, 2014

I. Introduction
The Toyota OBD I diag port provides a method of reading serial data from the
ECU, by shorting pin TE2 to E1(ground). This causes the ECU to output 13 serial bytes from
the VF1 pin, at 122.1 baud. The entire cycle is repeated roughly once every 1.25 seconds. The
following parameters are output during each cycle.
A. One 5-bit word which is some kind of ID
B. Fuel injector pulse width in mSec
C. Ignition timing advance in degrees
D. Idle Air Control (IAC) – reports “0” on my engine all the time.
E. RPM
F. VAFM (0-100%)
G. ECT in degC (selectably converted to degF in program)
H. TPS in degrees (0-90)
I. Vehicle speed in km/hour (selectably converted to mph in program)
J. Two unknown/unused bytes – always “0”
K. Two status bytes which report the state of various switches
1. Cold Start Injector
2. Warm-up status
3. Start signal “on” – only during starting
4. Idle switch status
5. Air conditioner “on”
6. Diag status – This flag is set if there is a diagnostic code present

II. Getting Started


A. Hardware
You will need the following:
1. Computer running Windows XP SP3 or Windows 7 (have not tried
with Vista, but will probably work).
2. Serial port with 9-pin connector. If your computer does not have a
serial port (many/most don’t these days), you can buy a USB to serial
port adaptor for $20-$30. I got mine from Radio Shack and it works
well.
3. A few electronic parts available at either Radio Shack or your local
electronics outlet (Fryes, etc.)
a. DB9 female connector to connect to your serial port output.
b. Axial lead 13K resistor
c. Axial lead .01uF capacitor
B. Software
Unzip the archive file into a convenient location on your disk. You should see
three folders, labeled “Setup”, “Runtime Code” and “Source Code”.
1. Runtime code
If you have the Microsoft.net Framework 4 installed on your computer,
you can run the program directly from the .exe in this folder. You can put
this folder anywhere on your disk, but all files in the folder must stay
together.
If you you try running the program and it complains that the Microsoft.net
Framework 4 is missing, you can download it here (free).
http://www.microsoft.com/en-us/download/details.aspx?id=17851

2. Source code
This folder is for the SW geeks. It contains all of the VB.net source code
for the program. There is a separate “readme” file in this folder which
gives more information about the development environment and how the
program works. This source code is freely available and may be modified
without restriction or credit given to anyone. VB.net 2010 Express is a
free, fully functional download from Microsoft, and I use it extensively
professionally in my work.

III. Setup work.


A. Some soldering required
The data output from the VF1 terminal of the diag port is a 0-5V logic signal, but
its drive capability is quite limited. (I think Toyota added some series resistance to
protect the output drivers of the ECU from experiments like this). Consequently, the
drive levels were inadequate to drive the input of my serial port. Also, once the
engine starts, the signal is quite noisy, mostly from ignition pulses. To solve these
two problems, I added a pull-up resistor and a filter capacitor. The following drawing
shows how these are connected.

This is a drawing of the back of the DB9 connector that you should have purchased.
The program uses pin 8, Clear to Send, as its input. The receive pin (pin 2) can not be
used, since the unusual nature of the Toyota data stream precludes using the serial
port UART. All of the decoding is done in software by polling the status of control
pin Clear to Send (CTS).

To provide pull-up, the program drives pin 4, Data Terminal Ready, high. A 13K
resistor from pin 4 connects the pullup to pin 8. The .01uF capacitor from pin 8 to pin
5 (ground) provides noise filtering.
13K

.01uF

To diag port pin E1(gnd)

To diag port pin VF1


(serial data stream)

Connect a long twin-lead or coax to pins 8 and 5 which you can use to run from the
computer to the diag connector. I used left-over garage-door opener wire, and ran the
leads through the firewall into the passenger compartment, so I could have the laptop
on the seat while driving.

B. Configuring the serial port


Once you have the DB9 connector modified, it’s time to try out the SW.
- First, make sure you have an active serial port on your computer. If you are using
a USB to serial converter, plug it in and make sure Windows knows how to find
it.
- Now, plug your modified DB9 connector into the serial port on your computer.
Do not connect to the diag port just yet.
- Next, navigate to the “Runtime Code” directory, and double click on the shortcut
labeled “ToyotaDiagTestMode”. This tells the program to start, autodetect the
serial port, but not to look for data from the diag port. The program should come
up with the following screen. Look for the box in the top left labeled “Active
Com Port”. It should show the Com Port number that the program found. The
program will always find the lowest numbered active port. If this is not the port
you want to use, you can force a particular port number by editing the
“ToyotaDiag.ini” file in this same directory.
- Next, click on the green button labeled “Start Reading Diag Port”. The indicator
at the very top right should change from a red “Stopped” indication to a green
“Running” indication.
- The form should now look like the following. The program is simply reading
“zeroes” from the disconnected serial port, which translate into the numbers you
see.

Now, use a jumper to connect pin 8 to pin 4 of the DB9 connector. The display
should change to the following. The data now represents readings based on all “ones”
coming back from the serial port.
Finally, click on the blue “Start Data Log” button. It may require two clicks to
activate the first time. It should change color to red-orange. Let the program continue
for about 5 seconds, and then navigate to your C:\tmp directory. It should contain a
file named “ToyotaDiagLog_YYYYMMDDHHmmSS.csv”, where
YYYYMMDDHHmmss is the current date and time. This is a log file which will
record every reading taken by the program into a comma separated file which is
readable directly by Excel, making post driving analysis straight forward. Since the
file name is date and time stamped, the files are easy to keep track of and you will
never accidentally overwrite one.

If all of these tests check out, you are ready to plug the wiring into the diag port.
Follow these steps.
- Close the program to get out of “test mode”.
- Engine off, ignition off
- On the diag port, connect TE2 to E1.
- Connect the wires from the DB9 connector to the diag port as shown.
- Now turn the key on, but do not start the engine. You should see the Check
Engine Light blinking continuously and rapidly, several times/sec.
- Start the program in “normal” mode by double clicking on “ToyotaDiag.exe”.
Once the form comes up, click on the green “Start Reading Diag Port” button.
The form should show something similar to the following data.
-
- To test that you are reading real data, slowly depress the accelerator to the floor.
You should see the TPS reading advance, from near 0 to 50-60 degrees or more.
- Start engine

IV. The “ToyotaDiag.ini” file


A. The program defaults to certain settings, which can be changed by modifying
the .ini file. It is a simple text file, and contains enough comments that editing it
should be straight forward. The parameters that can be changed are
- COM port name. Default is [auto], which means it will automatically find and
use the lowest numbered serial port. If you have multiple ports and want to force
a different port number, simply change the designator to the port number of
choice.
- Units. [English] The program defaults to English units (mph, mpg, degF).
However, for the non-USA users, the program can be switched to metric units,
which will change the display to km/hour, km/liter, and degC.
- Injector flow rate. [200].The program uses injector flow rate, along with engine
rpm, injector pulse width, and vehicle speed to estimate miles per gallon. The
stock 3-vze injector flows at 200 cc/minute. If you have injectors that are
different from stock, you can put your own flow rate into this parameter.
- Number of cylinders.[6]. The fuel mileage calculation requires knowledge of the
number of cylinders. Default is 6, but if you have a 4 cylinder, you can change
this parameter.
- Speed correction. This will allow adjusting the speed calculation for modified tire
sizes and gear ratios. This parameter will also affect fuel mileage calculations, so
get this one right first before modifying the fuel correction.
- Fuel correction. The mpg calculation is based on sound engineering inputs, but
there are things I don’t know about fuel injector timing lag, etc., that can cause
the calculation to be significantly in error. If you’d like to get it closer to your
observed mpg, changing this constant from 1 to something else will do that for
you.

B. Please note the following .ini rules for this file.


- The file must reside in the same directory as the “ToyotaDiag.exe file”.
- Any line containing a ‘ character (for a comment) will be ignored, even if the ‘ is
not the first character in a line. So, don’t add comments after a parameter. Put
comments on a separate line.
- The parameter names must be spelled exactly as given. However, case is not
important.
- The = sign is absolutely required. Spaces before or after it are ignored.
- Parameter values that are text strings (“English, metric, com1, auto”) must be
spelled exactly correctly. However, again case is ignored.
- If a parameter is misspelled or left out of the file entirely, or if the file is missing,
the program will use the defaults given above.

V. So, what is all this data good for


Only you can answer this question, but here are some thoughts based on what
I’ve seen. My vehicle is a ’94 SR5 4Runner with 195,000 miles. The engine has never been
touched except for plugs and a timing belt. It runs well, uses no oil, has good compression on
all cylinders, easily meets emissions, and gets 18-19 mpg. So, the data I’ve collected
represents, I believe, an engine that is running pretty close to how Toyota designed it. Some
comments on the various displayed parameters.
- RPM and MPH. Pretty self-explanatory. Both are quite accurate, because they are
based on the ECU’s precision internal clock. MPH may vary if you have
modified gears or tire sizes.
- ECT (Engine coolant temperature). This is the coolant temp as seen by the ECU.
It should (but might not) relate to what you see on your gauge. It is a good check
to see that the ECU is getting a good “warmed-up” signal from the ECT. If this
value reads low (below 160degF), the ECU is never sensing that the engine is
fully warmed up, and performance will suffer as a result.
- The various fuel and mileage functions. Total trip miles are calculated by
dividing the MPH reading for each sample by the time between samples (time is
based on a precision internal Windows timer with better than 1uSec resolution) to
get distance per sample frame. This is accumulated over the length of the trip and
is quite accurate (subject to tire size and gearing)
- Fuel flow and mileage is calculated from injector flow rate, injector timing, rpm,
and speed. Because the flow rate of injectors is not completely precise, these
numbers are estimates, and are probably best used as relative measures to give a
fairly quick indication of the effects of tuning changes, changed driving habits,
etc. The repeatability and resolution are good, but the absolute accuracy less so.
- TPS degrees. This is the throttle opening signal to the ECU. Again, it is primarily
a good check to see if the TPS is working properly. One thing I noticed is that,
with the hood open, I can rotate the throttle fully open to get a reading of about
87 degrees. However, when I sit inside the truck and press the accelerator, I only
get about 65 degrees. This tells me my throttle linkage needs some work and I’m
losing some available power because of it.
- AFM is a number from 0 to 100%, and is simply a relative measure of air flow.
I’m not sure how to interpret it further, accept to monitor it for any odd behavior.
- Ignition advance tells how far the ECU has advanced timing. It’s interesting to
turn logging on and come back and compare timing advance to rpm, airflow, and
TPS.
- Injector timing has already been discussed.
- The six boxes at the bottom are status switches, and are fairly self-explanatory.
Again, I think they are most useful as a report as to what the ECU is actually
seeing, and can be used to detect bad wiring or bad sensors.

VI. Data logging


One of the most useful features, from my standpoint, is the ability to turn on data
logging and just drive (and stay out of accidents!) while the computer logs all the data. The
data is logged into a .csv file which will load directly into Excel. From there it is easy to
scroll through a test drive and see how things are going, and if you’re good with Excel, to
plot various parameters against time or against each other. I haven’t done much of that yet,
but plan to. The log file is put into the C:\tmp directory, and the filename contains the time
and date so that you can find them back easily.

VII. If things don’t work


I’ve tried to make the program robust, and anticipate what I could in terms of
different hardware and Windows versions, but some of you will run into trouble. Here are a
few things to look out for.
- “No serial port found”. Make sure you have a serial port installed. Go to the
Device Manager under the control panel and check what’s there. Also, if you use
the “Auto” setting, the port you are using must be the lowest numbered COM
port you have. If it’s not, go into the .ini file and set it manually.
- Program works in testmode, but won’t read the serial data from the vehicle.
Check the following
1. Make sure your vehicle supports this diagnostic mode. I know my ’94
does, but I’m not sure how far back this mode goes.
2. Make sure TE2 is jumpered to E1
3. Check the wiring of the DB9 connector.
4. Make sure pin 8 of the DB9 goes to VF1, and pin 5 goes to E1
5. Make sure the ignition is “ON”, not just on “Accessory”.
6. Make sure the voltage on pin 4 of the DB9 is near 7.5 volts when the
program is running.

Depending on the sensitivity and input resistance of your serial port, it is possible
you may need to adjust the value of the 13K resistor. Try removing it first, and it
that doesn’t work, try progressively lower values down to 5K or so to see if that
helps.

Feel free to email me at rjriedel@q.com with specific questions.

You might also like