I have code written that outputs value to an LCD. My sensor output is .7 volt to 2.6 volt, I want the arduino to output this range as 0 – 1024. I am guessing an op-amp will work but not sure what else is needed. The sensor may fluctuate .1 volt depending on the environment so it would be great if I could have the ability to “trim” the low and high for an exact “0” and “1024” on each start up without having to rewrite the code each time.
Have you considered the map() command? http://arduino.cc/en/Reference/Map
I'd have to think about it, and it might take a couple of op-amps, but you have a range of 1.9V, so you'd need a gain of ~2.6, and a negative offset of -0.7V (at the input before amplification). In order to go down to exactly zero (or below), your op-amps are usually going to need bipolar power supplies.
If you are willing to ignore the offset and not count down to zero, you have a couple of other options... You can supply a 2.6V reference. Or, you can use a voltage divider to bring the maximum down to 1.1V use the optional 1.1V reference.
The sensor may fluctuate .1 volt depending on the environment
In that case, you probably don't need the full range for 1/1000 resolution. If full scale is 1.9V, one count out of 1023 is about 0.002 Volts. As CrossRoads suggested, what you see on the display doesn't have to be what the ADC register reads.
on each start up without having to rewrite the code each time.
There are ways to do software calibration without re-writing the code. In general, you can simply change the value of a variable or two. i.e., You could push a button to calibrate or zero the unit with a known input or condition.
I would like to keep it simple while getting the best resolution. I had thought of using a voltage divider off the arduino’s 5 volt regulator, using a pot for one of the resistors. I can get 2.6 volts to feed to AREF and be able to adjust the pot to get full range at the 1024 end. The low end doesn’t have to be “0” it would just look better. Ideally I wanted a range of “0” to “1000”. I will look into the map() command to shift the screen numbers.
If you use a voltage divider to reduce your max 2.6v below 1.1v you can use the Arduino's 1.1v internal voltage reference.
Robin2: If you use a voltage divider to reduce your max 2.6v below 1.1v you can use the Arduino's 1.1v internal voltage reference.
By compressing the 2.6v to 1.1v isn't that REDUCING my resolution?
No, because you’ve still got ten bits, but they’re spread over 1.1V instead of 5V
How about using External with Aref and supply it from 3.3V? Then 0.7/3.3 x 1023 = 217 and 2.6/3.3 x 1023 = 806.
Or a pot like you suggested, bring it down some more: 0.7/2.65 * 1023 = 270 2.6/2.65 * 1023 = 1003
Thanks everyone for all the ideas.