I'm very new to electronics, but I'm trying to reverse the signal coming from a throttle position sensor as well as change the voltage range slightly. The throttle position sensor output signal range is 0.325v-4.75v. How can it be converted to a 4.5v-0.38v signal? I found a similar question on here, but I don't know what would need changed to fit my situation (Reversing a .5-4.5V analog sensor output to 5V-0V) or (How to invert a digital signal). I was told maybe a NPN transistor could be used??? But what size and what size resistors in the circuit to get the range to change? Thanks for any help!

# Electronic – Reversing a throttle position sensor signal

operational-amplifiertransistors

## Best Answer

Use the same circuit as in the answer you linked to. In your case the maths is easier because it's an almost straight inversion.

For an inversion about a 2.5 V offset just change R2 to 100k. How it works:

If you find that the controller isn't quite giving zero speed or full speed then increase the gain a little by increasing the value of R2 by adding series resistance to bring it up to 105 to 120 kΩ. The worst that will happen is that you will have a little "dead-zone" at one or both ends of the throttle. This will result in having to turn a few more degrees before the motor starts or / and reaching full power before the throttle is fully rotated. This will be better than not being able to fully reach zero or full power.

The MCP606 is chosen because it is a rail-to-rail op-amp. This means that it can control its output all the way from the negative rail (0 V) to the positive rail (5 V in your case) unlike some other op-amps which can only get within a volt or two of each rail.

More maths:

The full equation for the configuration is given by

$$ V_{OUT} = -(V_{IN} - V_3)G + V_3 = -(V_{IN} -V3) \frac {R_2}{R_1} + V_3 $$

where \$ G \$ is the gain and \$V_3\$ is the voltage on pin 3.

Let's sort out the gain, G, first.

From the data you provided the input span is 4.75 - 0.325 = 4.425 V and the output span is 4.5 - 0.38 = 4.12 V. So the gain we require is \$ \frac {SPAN_{OUT}}{SPAN_{IN}} = \frac {4.12}{4.425} = 0.931 \$ as you calculated in the comments. We can pop this value back into our equation:

$$ V_{OUT} = -0.93(V_{IN} - V_3)G + V_3 = -0.93 V_{IN} + 1.93 V_3$$

Solving this for \$ V_3 \$ gives

$$ V_3 = \frac {V_{OUT} + 0.93 V_{IN}}{1.93} $$

Putting in the values for one end of the throttle we get

$$ V_3 = \frac {4.5 + 0.93 \cdot 0.325}{1.93} = 2.49 V $$

Double-checking with the readings for the other end of the pot:

$$ V_3 = \frac {0.38 + 0.93 \cdot 4.75}{1.93} = 2.49 V $$

Bingo! 2.49 is 0.4% off 2.5 V so we'll go with 2.5 V which is conveniently half the 5 V supply. Set R3 and R4 to 10 kΩ.