# Signal condition circuit

#### 1:1

Joined Jan 25, 2007
27
Hai dear forum member,

I'm current design a scale and shifting circuit use for positioning sensing.
My sensor is a 10K linear pot(potentiometer) connect to 5v & Gnd. Ideally this linear pot output will be Vref/2 (mean the position is balance). <Vref/2 mean the pole fall to the left, >Vref/2 mean the pole fall to the right.

The linear pot output is connect to microcontroller A/D (10bits). The microcntroller +Vref & -Vref is 5volt and GND, so I want the controller read the signal such as condition set below.

*Input to microcontroller is swing between 0~5volt
Output from linear pot is 0~5 volt as well, but Vref/2 is equal to 0volt input to the microcontroller.*

I have using a differential op-amp to implement the shifting, an additional offset voltage (Vref/2) is use to compensate the linear pot output (because Vref/2 is mean the pole is balance,so 0 volt will input to the microcontroller represent no error occur). But adding this offset voltage will cause the input to the microcontroller swing between -2.5v ~ +2.5 v. *Note, i need the voltage into microcntroller swing within 0~5 volt (+Vref & -Vref).

Could any one give me some ideal to solve this problem?
I was think about is it possible do it in software instead of alter the hardware.

#### hgmjr

Joined Jan 28, 2005
9,027
Isn't it possible to leave the input hardware alone and handle the digital value in the software as a signed 10-bit number with the most significant bit used to indicate the sign of the value above and below the Vin/2?

hgmjr

#### mrmeval

Joined Jun 30, 2006
833
Without a graphic schematic I can't tell what you're doing.

This has a method for using a potentiometer
http://www.seattlerobotics.org/encoder/jul97/basics.html

Using the values in the shown schematic, you can calculate what the voltage ranges the pot will allow. With the sweep all the way to the 'top', the value for R2 at the sweep is 10k. The voltage drop across R2 = Vcc * (R2 / (R2 + R3)) = 5.0 * (10k / (10K + 330)) = 4.84 volts. Thus, the highest digital value will be 4.84 / 0.0195 = 248. Actually, it will be 247 since the A/D conversions are zero based. The lowest value should be zero, since with the sweep all the way to the bottom, the A/D port will be connected to GND. Thus, the limiting resistor has reduced the useful range of the POT.

To increase the range, you can increase the value of R2. For example, using a 100K pot means 5.0 * (100k / (100k + 330)) = 4.98 volts. Thus, 4.97 / .0195 = 255, which will be 254 when adjusted for the zero based conversion.

There are two types of potentiometers on the market. Audio and Linear. A Linear pot changes its value at a linear rate. There is an easy mathematical relationship between the angular position and the resistance.

An 'Audio Taper' or 'Audio' pot changes its value on a logarithmic scale. These are not well suited as positional sensors.