I'm building a digital gear shift knob, which would display current gear (1-5, R) and based on readings from OBD-II change color when gear shifting is required, to save on fuel consumption.

I need a way to detect the current gear - PID 0D (current gear) is not availiable in this car. I was thinking about doing it based on the horizontal tilt of the gear stick, since there are 6 positions plus a neutral gear:

    1   3   5
     \  |  /
    /   |  \
   2    4   R

Is there a sensor I could use? Or perhaps it'd be possible to build one, e.g. using 6 of these ball switches: https://www.adafruit.com/products/173 There is however a space constraint since everything needs to fit inside a gear knob, therefore I'd prefer a nice single package.

  • My first thought was accelerometer, but you'd have a hell of a job filtering out the acceleration/deceleration/turning g-force and the general vibration of the car. Maybe a gyroscope may work. Tough one this...
    – Majenko
    Commented Jul 1, 2015 at 22:56
  • That's funny. I had the same thought too, use an accelerometer. I think you could do it with just a three axis accelerometer , but like Majenko said, you'd have to filter out the noise. However, my thought is that shifting gears has a distinct motion pattern, so you might be able to implement a state machine. Otherwise, you can "beef" up your accelerometer and go for an IMU. This would allow you to create internal frame of reference for tracking the position of the shift knob.
    – Mlagma
    Commented Jul 1, 2015 at 23:24

3 Answers 3


You could also sense the position of the stick where it enters the floor with hall sensors... 1-5 and reverse would have sensors, neutral would be when none of the other gears are detected.


Many vehicles with manual transmission use two push rods or cables to transmit gear selection to the gearbox. It may be easier to detect the position of those rods/cables than to attempt to filter out the g-forces involved in a moving vehicle.

Alternatively, you could use the ratio of vehicle speed to engine revs (if you can retrieve these from OBDII in your vehicle). Given that these two are directly related when a specific gear is selected and the clutch is engaged, a simple division should give you a ratio you could use to decide which gear is selected.


Your stick goes into the chassis at some point. Why not detect the position down there? But to be sure to save fuel, you'd need to know the rpm/speed and especially the load of the engine. If you are going at a high gear and low speed you won't save fuel either, so the knob is not the right place to detect the gear in question. Go for OBD, get the ratio of speed and rpm and get the load or injection quantities. If you go up the hill and select too high a gear, you won't be happy either.

Your Answer

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

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