# how can I "map" potentiometer value without microcontroller? [closed]

I want to make potentiometer that goes to 0 to 100% ONLY if I start to open it from 50%.
That means, if I open it to 51%, it will report as 2%. if I open it at 75%, it will report as 50%.

In Arduino, I can make it like this

int val = analogRead(0);
if (val < 50)
{
val = 0;
}
//okay that's stupid coding for sure.


How can I do this without arduino?

EDIT : I want to do it WITHOUT microcontroller. EDIT 2 : I want to do it as simple as possible, and if possible without using any IC.

• Pick another micro controller? What do you mean by "report"? a binary number, an analog voltage, a synthesized voice? Commented Aug 5, 2017 at 18:40
• you realize that analogRead is a voltage reading right? It converts it to a decimal value that represents a voltage range between 0 and 5 volts.
– user103380
Commented Aug 5, 2017 at 19:26
• What do you mean by "without arduino"? Do you mean without the Arduino library, or without using a microcontroller at all?
– user39382
Commented Aug 5, 2017 at 19:32
• There is no general way to make that part act as you suggest. There are some situations where it is possible easily and others in which it is not practical (depending on the way it is used in the circuit). You could buy a centre-tapped pot of double the resistance and use the tap as one side of the element. Commented Aug 5, 2017 at 19:38
• You want to do this with a analogue circuit? It is possible to design a OP Amp circuit that solves the challange. Commented Aug 6, 2017 at 10:07

If you look at map()'s documentation you will see that it's a simple scaling function:

long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


If for whatever reason you don't have access to the Arduino standard library, you can just copy this function into your code and use it.

• I didnt realize that. Thanks! But I still want to avoid microcontroller. Commented Aug 6, 2017 at 9:50

This should work.

int val = analogRead(0);
if (val < 50)
{
output = 0;
} else
{
output = ((val - 50)*2);
}