# How to map 0.40-1.87V to 0-5V? [closed]

I cannot seem to wrap my head around this. I have read about using an instrumentation amplifier, however even then I am not sure how to use this in this scenario. Could someone explain to me how to:

• Map a voltage range of 0.40-1.87(V) to 0-5V

• Map a voltage range of X-Y(V) to 0-5V, where X is non-zero

• You need to provide a bit more detail. What is your expectation ? (accuracy,...) Jul 11, 2018 at 8:28
• @LongPham preferably as accurate as possible, I am scaling a potentiometer reading. Jul 11, 2018 at 9:07
• @nyxaria What's possible partly depends on your constraints, including the monetary ones. ;) Jul 11, 2018 at 9:16
• "An instrumentation amplifier" Post a schematic with the tool, it looks like you put minimal effort into your question, provide maximum information so we can give you good answers instead of speculation. Thanks Jul 11, 2018 at 16:01

The gist of it is basically this:

Let's call the input range (X, Y), the output range (J, K).

Then the 'mapping function' is as follows:

$$V_{\mathrm{out}} = {V_{\mathrm{in}} - X\over Y-X} \times (K-J)+J$$

You can easily derive it - what the division by the endpoints of one range does is it maps the input to some 0 to 1 range. Then you can 'stretch' it to cover the other range. Then just adjust for the offsets.

The hardware implementation usually follows that pretty well.

First, you get the difference of the input against the reference ($X$). Then you amplify it (by the $K-J \over Y-X$) and apply the offset $J$ if required.

In your case, the $X$ and $Y$ are 0.40 V and 1.87 V respectively, $J$ is 0 V (no output offset relative to ground), and $K$ is 5V.

So you just need to implement a thing that does:

$$V_{\mathrm{out}} = {V_{\mathrm{in}} - 0.40 \mathrm{V} \over 1.87\mathrm{V} - 0.4\mathrm{V}} \times 5\mathrm{V}$$

or

$$V_{\mathrm{out}} = (V_{\mathrm{in}} - 0.40 \mathrm{V}) \times {5\mathrm{V} \over 1.87\mathrm{V} - 0.4\mathrm{V}} = (V_{\mathrm{in}} - 0.40 \mathrm{V}) \times 3.4$$

So. You just need to make a differential amplifier that measures against a 0.4V 'reference', and amplifies stuff by 3.4!

• Could you give me an insight as to how I might actually go about doing this on a circuit? :) Jul 11, 2018 at 9:06
• There's this handy calculator for a typical 4-resistor, one-opamp differential amplifier: masteringelectronicsdesign.com/… I've plugged in the numbers you wanted to get, and it should work. However, there is a few things you need to be wary of - be sure the potentiometer's resistance you're measuring is 'small' compared to the input R of the amplifier (so it doesn't skew the results). Getting the 0.4V ref. could be done just with a divider. Since you want an 0 to 5V output, you may need a rail-to-rail output opamp that can work in that range. Jul 11, 2018 at 9:24
• Good answer. If it had an example schematic showing the voltages, then it would be a perfect reference the many questions like this that show up.
– JRE
Jul 11, 2018 at 10:06
• @JRE Thanks for the feedback! I'll modify the answer later today to add those things. :) Jul 11, 2018 at 10:11