I created a circuit on my arduino duemilanove to and wrote some software to measure from analog input 0, 1 and 2.
To each of these, I hooked up a voltage divider (5V ... GND) to measure the resistance of a photoresistor, a PTC temperatur resistor and battery voltage (VIN).
However, it turns out that each of these voltage dividers, because they are all connected to the same 5V source, form another "bigger" voltage divider (the sum of resistance across one of them is not equal to the other).
e.g. on the temperature sensor, I'm getting too low a voltage (and thus resistance), so I'm reading 15°C instead of 27°C.
making things worse, the light and temperature sensors will change their resistance, so that the ratio of voltages in the "bigger" voltage resistor will change as well...
any ideas to circumvent the problem (or at least correct it mathematically, if possible)?
Here is the diagram showing all the voltage dividers. There is also one (small green) LED and a button which are independently hooked up between 5V and GND (not shown here).
The power source is (should be) the Arduino, via USB (for serial monitoring) but I need to hook up the 9V battery to VIN as well so that there is a value on ADC Pin 3.
Could this problem have anything to do with the TWI Interface on ADC 4 & 5 (there is a AT24C512 EEPROM as well)?
R_25 for the PTC is about 1020 ohms, the photoresistor is of unknown type.
(PS is this the right way to post images?)
Sorry if that wasn't clear enough: the Arduino will provide the 5V source. For debugging, I'll connect it via USB, so I the voltage on the 5V Arduino pin will then be 4.8V or so (whatever the USB will output). But I'm also planning to use it standalone off of 8 AA batteries (NiMH, about 9.4V) and will use the Arduino 5V regulator that comes onboard.
I took another closer look at the problem and found out that it's not the voltage dividers who are interfering with each other because [u]on two of the three[/u] analog inputs I get correct measurements.
I think it has something to do with switching the analog reference on the Arduino. The one pin (the PTC resistor) that is reading wrong is only doing that if I enable the internal 1.1V reference.
For the other two pins, I use the default reference (5V by Arduino onboard voltage regulator). However, when I modify the software to read only one pin with the 1.1V reference, the results are correct again.