I would like to modify my car with the help of Arduino to display the current gear. I wasn't quite sure where should I post this question as it is a car topic, as well as an electric engineering and mathematics topic.

I want to get the engine rpm and current speed (and any additional information I need) via the OBD2 port of my car. The best solution would be with a small cable adapter so I could simply hide the cable behind the dashboard. The OBD2 for Arduino adapter is just too big, unfortunately the connector in my car is under the steering wheel so it should be as compact as possible as I don't want to accidentally kick it. For the Arduino part I would like to use an ATtiny85 (since it is so compact) and a small display, 7 segment or LED matrix.

The math part is to calculate the current gear from the OBD data. How should I do it? Is it even possible? There is an extension for the Torque app (RacingMeter) that shows the current gear, I am not sure how, but that is where the idea came from.

  • 1
    \$\begingroup\$ Thinking about it, you probably posted this topic in the best SE to get useful answers. This is mostly an embedded problem. The math part is trivial. \$\endgroup\$
    – user36129
    Mar 18, 2015 at 10:35
  • \$\begingroup\$ The speed versus rpm will be a simple ratio depending on the total ratio of the gear selected and the rest of the drive train. Have you got as far as something that can read / log the recordings? If so you could just grab the speed versus RPM in each gear and divide a sample to get the ratio rather than trying to work it all out (which will depend on tire size and the diff as well etc). \$\endgroup\$
    – PeterJ
    Mar 18, 2015 at 10:38
  • 1
    \$\begingroup\$ Unless you are driving a car with a manual transmission and a clutch, there's no fixed relationship between engine RPM and the transmission gear. I realize that you're probably talking about a manual transmission, but I just wanted to make the point explicit for anyone else reading the question. \$\endgroup\$
    – Dave Tweed
    Mar 18, 2015 at 10:43
  • \$\begingroup\$ @DaveTweed: how is there a fixed relationship between engine rpm and gear in a manual transmisson? for the same speed in gear 3 you have different rpm than in gear 4, 5 etc. \$\endgroup\$
    – PlasmaHH
    Mar 18, 2015 at 10:47
  • \$\begingroup\$ @PlasmaHH: You can infer the gear from the ratio between engine RPM and driveshaft RPM. You infer the driveshaft RPM from knowing the vehicle speed, tire size and the differential gear ratio. But the RPM ratio is not fixed if you have a torque converter or a continuously-variable transmission of some sort. \$\endgroup\$
    – Dave Tweed
    Mar 18, 2015 at 10:54

2 Answers 2


First identify the protocol your car is using is it CAN,KWP,J1850 etc. Buy this sparkfun board or build one so that you can communicate with ECU of any above protocol



To obtain RPM you have to give 01 0C Refer this link for conversion formula of obtained raw data to required value http://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01

Current gear

Gear is a proprietary PID so it wont be available from standard PIDs you need the companys PID list. Else just add only gear app in torque.Then use an OBD splitter cable log the data (request and response) passing to ECU byt torque app and identify the PID. But you have to figure out the conversion formulas by your own.


It may be way easier than you think. Actually you dont need to calculate. Most on board computers ECUs will transmit the current engaged gear as part of the odb2 data pack. I recommend using a 5dollar usb odb2 usb connector to your pc using software like scanmaster or the like to check what data your car's ecu provides.

If this is not your issue and still want to calculate, yes it can be done, find out your cars gear ratio for each gear (tech spec sheet or google it) then measuring the wheel radius youl have a relation between revs and speed, now, if you get speed and revs from the ecu through odb2, the division of those two will be equal or very similar to one of the gear ratios, this tells you which gear you're in.

Now, for the space issue, you can probably push the odb2 plug into the back of the shroud where it is and use the extra space for the arduino. The odb2 plugs are usually pluged into place from inside the dash.

  • \$\begingroup\$ and which are the PIDs of the gear transmitted over OBD? \$\endgroup\$
    – jumpjack
    Jan 17, 2021 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.