DIY OBD-II Car Computer Interface with LCD and Microcontroller

You’re expecting an electronics video? Well,
you’re right. In this video, we’re going to show you how you can hook up your NerdKits
microcontroller kit to the onboard computer in your car and read the data from it. Since 1996, all cars by law have a onboard
computer that is hooked up to a bunch of sensors in your car. The primary purpose of these
sensors is to provide diagnostic information about the car, like for your annual emissions
test, or troubleshooting the check engine light. Or you can also connect to the computer
to get interesting real-time data, such as speed and RPMs. We have three wires that go to the NerdKit
and plug right into the port. The three wires are the battery, ground, and the data line. Those three wires go up to the breadboard,
which holds the microcontroller and the small circuit that helps interface with the car’s
computer. All cars are required to have an OBD-II connector,
but that doesn’t mean they all follow the same standard. In fact, most major car manufacturers
follow a different standard for communicating with this bus. So, before undertaking this
project, make sure you know what standard your car follows. The car we’re reading data from is a ’97 Chevy
Cavalier, which means that it’s using the VPW standard, mostly found on GM cars. Most digital signaling uses high and low voltages
to represent digital 1s and 0s. However, the variable pulse width protocol uses a slightly
different method. It varies the duration of the high and low periods to indicate 1s and
0s, and it uses a voltage transition to indicate that the next bit has started. The NerdKit is continuously polling the car
computer and retrieving the data about the velocity, RPM, percentage throttle, and the
engine coolant temperature. This circuit uses two optocouplers to allow
the microcontroller to communicate at the higher voltage levels used by the car. This
way, the two halves of the circuit are connected optically, but not electrically. Inside each
optocoupler is an LED and a phototransistor. The current flowing through the LED produces
light that turns on the phototransistor, and this is how the information is passed back
and forth. We actually use two optocouplers: one for transmitting to the car, and one for
receiving information from the car. The code implements the VPW standard. It uses
two timer interrupts and a pin change interrupt. One of the timer interrupts is used for receiving,
and one for sending, and the pin change is used to figure out when a transition has happened. When we’re trying to read the data from the
car, we use the pin change interrupt to watch the voltage changes. When a transition has
occured, we check the timer and decide whether the car was sending a high bit, or a low bit. When we’re trying to send information to the
car, we use the other timer to decide when we want to change the pin voltage depending
on whether we want to send a 0 or a 1. In the main loop, we keep sending the codes
to read the values we want, and display the values to the LCD. For more information about our kits, or more
videos like this one, visit www.NerdKits.com. Now, let’s go for a drive.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *