According to me, the most cool part of a CARPC is where you get OBD2 data to your touch screen interface. It is really cool. I wrote about the protocol called VAN in another article. OBD2 is the way to get data from your engine control unit which also called ECU.

First time when I begin to work on a carpc, I always used free front-ends. But I couldn’t customize the front-end software according to my requirements. So I started to develop my own CARPC front-end. Multimedia applications, navigation, watching TV via 3G and so on..

Getting data from my OBD2 port of my Citroen C4 was different. I tried OBD2 applications like ScanTool.NET, OBDview, etc. always there was missing functionality that one app cannot provide.

Physical Connection to get OBD2 Data

Let me talk about physical connection; In Cars, there is a port with standard 16 pins OBD2 pinout. This is the port when you get your car to technical service used to connect.

OBD2 Port to get OBD2 Data

The easiest way I know to get data from OBD2 is the OBD2 adapters like ELM327. You can connect that adapter to your PC through USB, then the OBD2 socket to your car. It behaves as a COM port through your USB. This means you can test and also get data from HyperTerminal program or Putty. Its command set is like a modem; using AT commands.

If you want to get data from your car, connect to your ELM327 adapter through virtual com port using your terminal program. Then send it a AT command. Just it. By knowing this, and if you know just a bit serial programming, do you really need to purchase a Diagnostics application?  Clearly.. “NO”.

get OBD2 Data using ELM327 USB Kit

Using ELM327 to get OBD2 Data

To begin retrieving  data from your engine, you need to initialise your ELM327 with your car. OBD2 data protocols varies by car vendors and specs. You need to initialize your OBD2 device according to your car vendor and model.

Usually, each value in OBD2 (speed, rpm, engine load..) uses 4 digits Hex number as identifier. You send the request with their identifier id and it responds to you by its identifier id. The logic is very easy at all.

Example: Send command “010C”

Receive response “010C001B”

010C is the identifier, 00 1B are the data hex numbers.

the first 00 is the A, and the 1B is the B let’s say.

we will know that the identifier 010C means rpm. To calculate rpm you need to make math between A and B.


Now let’s clarify the initialization process; (C#.NET Code)

serialPort1.PortName = comPort;

            try { serialPort1.Open(); }
            catch (System.Exception excep) {}

            send_data("ATSP 5");
            send_data("01 00");

The code above, starts sending initialisation commands using threading. ATSP command is important. ATSP 5… number 5 is the protocol for my car. You need the try it with others if this does not work for yours. To try each command one by one, the best way is to use putty. Use the initialisation commands by using your keyboard and try ATSP command from 1 to 5. if the protocol you try is not compatible your car, you get “error” or “no data” response.

ATZ command; resets the ELM327.

ATE0, ATL0; disables extended responses. When it is disabled it is easier to process the responses programmatically.

ATH1; enables the responses with their headers. It is good to enable it because in responses you can see the identifier of data. So it is easier to understand the response.

We talked about the ATSP command. But shortly, ATSP1, ATSP2, ATSP3, ATSP4, ATSP5 are the protocols.

0100 command is to test if the connection is OK.


Each value of engine has a PID (010C, 010D)

01 0C 2 Engine RPM 0 16,383.75 rpm ((A*256)+B)/4
01 0D 1 Vehicle speed 0 255 km/h A

To get the other pids meaning you can use the releated wikipedia page;

Every car does not response to evey pid. Speed, engine rpm, these are standardized pids. And most cars easily respond to that pids.

I can get; speed, engine rpm, engine tempature, engine load, engine air flow rate, vehicle battery voltage from my car. (battery voltage is not obd2 releated data, just vc command)

Other thing is threadings.. they are very important because you have to wait for being ready of elm327 before sending a new command. 200 ms is enough for ELM327’s internal process.

Another trick is that you don’t have to try it with your car. there is a simulation application called “obdsimwindows”. It creates a virtual obd2 port

I read about this simulation program in mp3car forum.