Talking to the computer in a 2005 Toyota Camry using Arduino and k-line ISO 9141


Aug 31, 2017


Introduction to K-line Arduino Communication

While a lot of people are making interfaces to connect an Arduino microcontroller to their cars, I wanted to get in on the action. Unfortunately for me, my car is a 2005 Toyota Camry which uses the older K-line interface for communication. Since 2008, all cars went to CAN BUS standard which is what all of the Arduino shields available are made to work with. The hardware available will not work with older cars and there is not much information available on the older OBD interfaces for pre-2008 vehicles. So I gathered everything out there and added my own findings for this tutorial.

Making an Arduino Trip Computer for 2005 Toyota Camry

Goals for this project

  • Begin communication with car computer
  • Request commonly available PID codes to get data from car computer (more information on PID codes from Wikipedia)
  • Display vehicle speed in MPH
  • Calculate and display instantaneous miles per gallon MPG fuel consumption


What you will need

  • Arduino Uno Microcontroller $2
  • MC33290, ISO K Line Serial Link Interface Chip (converts the 12 volt logic of the car computer to 5 volt that is compatible with the Arduino. Essentially takes the place of the Can Bus shield) $2
  • SOT23 to DIP10 Adapter PCB Board Convertor (makes hand soldering to SMD chip possible) $3
  • LCD display $10
  • OBD port connector $8
  • One 510 ohm resistor $0.25
  • Wires $4


Total Cost: under $40 I buy everything off eBay (including Chinese clone arduinos) or from a local electronics store.


Download the source code on github: Opengauge simplified code


How to Tell Which OBD Protocol Your Car Uses

All cars and light trucks built and sold in the United States after January 1, 1996 were required to be OBD II equipped, but several standards exist for the communications protocol. Here is a table of common protocols by manufacturer, though as I will show next, you can easily figure out which protocol is in use by examining the OBD port:

Manufacturer OBD Protocol
SAE J1850 VPW GM vehicles
SAE J1850 PWM Ford
ISO 9141-2 K-Line Chrysler and most Asian Cars
ISO 14230 KWP2000 Some Asian Cars
CAN All 2008+ vehicles

OBDII Connector

  • Pin 2 - J1850 Bus+
  • Pin 4 - Chassis Ground
  • Pin 5 - Signal Ground
  • Pin 6 - CAN High (J-2284)
  • Pin 7 - ISO 9141-2 K Line
  • Pin 10 - J1850 Bus
  • Pin 14 - CAN Low (J-2284)
  • Pin 15 - ISO 9141-2 L Line
  • Pin 16 - Battery Power

You can examine the pinout of your OBD port to determine which communications protocol it uses. For example, on my Camry, only pins 4,5,7,13,15, and 16 were populated. This told me it could only be using K-line protocol. Pin 15 is ISO-9141 L-Line but it doesn't need to connect to the Arduino for any reason.

OBDII Port 2005 Toyota Camry

Connecting the Arduino to the Car

Step 1: prepare OBD cable

If you bought a cheap OBD cable it is probably wired to connect to a CAN BUS enabled vehicle. You will need to cut it open and make sure the wires connect to pins 4, 7, and 16 of the OBD port. I recommend using a multimeter to check the wiring.

Step 2: solder the MC33290 chip

The MC33290 comes in a SMD mount package which is not so useful to us because the pins are small and break easily. Solder the chip to a DIP adapter board so you can solder wires to it reliably.

Step 3: Connect all wiring between components

Check out the data sheet for the MC33290 here. This microcontroller allows bidirectional communication between the K line interface of the onboard computer in the car and an Arduino. It does this by level shifting the logic signals. The ecu in your car uses 12v logic since it runs on a 12v battery. But the Arduino microcontroller uses 5v logic signals.

Info on MC33290 and 3 common ecu protocols here

I used a prototyping breadboard and prototyping wires to connect everything at first but found the wires came loose after a few car rides. You'll want to permanently solder wires for reliability. See the wiring diagram below:


MC33290 Wiring K-Line


Step 4: Upload source code to Arduino board


Download the source code on github: Opengauge simplified code

I owe a lot to the community for this code. The code is based very closely off the obduino project found on github. An open source collaboration among many dedicated individuals.

MC33290 Wiring K-Line
MC33290 Wiring K-Line


How to Calculate Miles Per Gallon MPG from MAF (Mass Air Flow Sensor)


It is a common feature on newer cars to display information like gas mileage and average fuel consumption for a trip. How does the car know how much fuel is being consumed at any given moment? In this case, we are calculating the figure using a commonly available PID code MAF or mass air flow rate. It tells us how much air is coming into the engine in grams per second. Assuming the engine is attaining an ideal air to fuel ratio as well as a few other constants, we can use an equation to calculate fuel burned per second and convert it to miles per gallon:

MPG = (14.7 * 6.17 * 4.54 * VSS * 0.621371) / (3600 * MAF / 100)

  • 14.7 grams of air to 1 gram of gasoline - ideal air/fuel ratio
  • 6.17 pounds per gallon - density of gasoline
  • 4.54 grams per pound - conversion
  • VSS - vehicle speed in kilometers per hour
  • 0.621371 miles per hour/kilometers per hour - conversion
  • 3600 seconds per hour - conversion
  • MAF - mass air flow rate in 100 grams per second
  • 100 - to correct MAF to give grams per second


Other Projects Gallery

Cheap K-Line trip computer for Citroen vehicle on instructables

Ryan Miller's ODBII Arduino Interface

obduino master on github

Test and Send Your Feedback

Give this project a try and let me know how it goes in the comments section. Also send me any questions or suggestions you may have!