Digital Inputs interfering with Analog Inputs...

I'm having a problem reading temperature values precisely. I am making a DIY thermostat and I have a TMP36 temperature sensor hooked up. I also have a 3-way switch hooked up and some pushbuttons as well. The problem is that I whenever I turn on one of the switches, the temperature reading goes up maybe 1 degree instantly, and then after when I switch it off, it goes back down. Does anyone know why? I need to read temperature values very precisely and is willing to buy any other extra supplies necessary to make this happen. I maxed out the digital pins on the Arduino but does that matter? If you can help me it would be much appreciated...

I need to read temperature values very precisely and is willing to buy any other extra supplies necessary to make this happen. I maxed out the digital pins on the Arduino but does that matter? If you can help me it would be much appreciated...

Well posting a schematic might help, but my gut says you may have too high an expectation of the Atmel AVR processors in the way of A/D accuracy. From the datasheet:

? 10-bit Resolution ? 0.5 LSB Integral Non-linearity ? ± 2 LSB Absolute Accuracy

That coupled with a non instrumentation quality reference voltage used in the standard arduino board (usb or on-board regulator is the default reference), you may or may not meet your accuracy requirements. One method that can improve the apparent accuracy is to take multiple analog readings and take an average of the inputted values.

There are many external A/D chips and modules that use I2C or SPI interface that come in much higher resolution and accuracy specifications. The built in A/D converter in an Arduino can be very useful, but is not of instrumentation quality.

+1 to lefty’s comments - I gave up on the analog inputs for measuring temperature long ago on my project, but haven’t found an ideal replacement yet. Right now, I’m using the ultra-common and popular DS1820 One Wire temperature probe, which seems dead stable.

My only real complaint is that the range of measurement and increments are larger than I need. Instead of 1 degree C steps over -55 to +125 (or whatever it is, don’t have the datasheet in front of me) I’d like .1 degree C steps over, say, 15 to 35 degrees C. Anyone know of an easy-to-implement digital temperature probe with that sort of range and accuracy?

PS - iRagDoll, hope I’m not hijacking your thread, but it sounds like we’re trying to solve the same problem (accurate and precise temperature readings within a few 10’s of degrees of room temp).

The DS1820 One Wire Temperature Probe works perfectly ur sayin? Like the temperature doesnt jump very wildly and is very precise?

I haven't had any jumping problems. I've run it in circuits with lots of other stuff going on, and other than a documented issue with a specific version of the DS1820 chip, I haven't had a single sign of interference or other issues. The off the shelf library from the playground works fine with it.

I don't have any sort of robust way to verify calibration but it's proven as accurate as any other temperature measurement method I have available as a hobbyist.

As noted above, the big problem for me is that the steps are way too big. I'd like to know tenth of degree changes, but it operates on much larger steps. If your application would be suitable for larger steps, go for it.

One other thing to note - when you ask the chip to take a reading, the standard library from the Playground includes a .75 second delay as dictated in the DS1820 datasheet. This can be annoying if you need the Arduino to be doing other things. I bet there would be a way to alter the library to remove that delay, as long as you introduced code such that the One Wire bus was inactive during that period you'd be able to have the Arduino doing other things instead of just idling.

Is this the temperature sensor that you are talking about?

http://www.sparkfun.com/commerce/product_info.php?products_id=245

Yes, but please do some searching on here for the library first - one of the sub-versions of the sensor causes all sorts of problems, and I don't remember which it was off the top of my head.