# Sharp IR range sensor and op amp

Hello,

I was reading a link about amplifying the output voltage for sensors. I am using an Arduino microcontroller that has a 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. However the sharp IR sensor only outputs between 0.4 and 2.5V. Thus I introduced an op amp circuit for a gain of 2 (using Ra=Rb=1kohms).
The issue: When I connect the components and run the Smoothing/Calibration program the serial monitor shows readings of 800 which is about 3.92V. Using the multimeter, I measure this voltage from the output of the op amp (741, 8-pin DIL). I am using 5V and ground power source.

Without the op amp the sensor and Smoothing program works fine, but I am assuming the distance are inaccurate since the max voltage is 2.5V thus the resolution of analogRead() is inaccurate.

I am assuming the distance are inaccurate since the max voltage is 2.5V thus the resolution of analogRead() is inaccurate.

Why are you assuming this? The accuracy of the reading is not compromised because you are not using the full range. If you need to use the full range, you could create a voltage divider using two equal resistors, between +5V and Gnd, and tap the center for Vref. Then, the ADC would divide the 2.5 volt output into 1024 values that represent 0 to 2.5V. No op-amp required.

You can't use a 741 with a +5V and GND supply voltage. The 741 is not "rail-to-rail" and will only get up to about 3.5V on the high side and 1.5V on the low side. It simply won't get any closer to the "rails" (5V and 0V) due to how it's built.

You can use an op-amp like a TLV2371 which is rail-to-rail.

You can also try a separate AREF voltage for the A/D converter (and select it using analogReference()) to make measurements relative to 2.5V instead of 5V and get that little bit of extra precision.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

I ended up using the voltage divider and it works! Thank you!