TMP36 x Voltage input in arduino

arduinosensortemperature

I have a project, using a temperature sensor, TMP36 and Arduino. Basically its a bluetooth thermometer. Everything worked fine at breadboard and connected and energized by my notebook. Now I connected it to a 4 x AA recharchable batteries and I started to get wrong temperatures (running on USB, I get 22 degrees, running on batteries, I get 44 degrees).

As formula to get the temperature, I'm using this one:

\$\text{Temp in °C} = \dfrac{Vout(\text{in mV}) – 500 }{ 10}\$

My debug info follows:

UPDATE

  1. USB (5v)

voltage read from TMP36 = 147

voltage converted to 5v arduino

(147 * 5.0) / 1024  = 0.71

temperature = (0.71 - 0.5) * 100 = 21.78
  1. Battery

4 x reachargable AA = 1.2v (voltimeter says 5.6v)
not enough energy to turn it on the BT module, but the board was turned on
(power light was on)

  1. Recharged Battery

4 x reachargable AA = 1.2v (voltimeter says 6v.7)

voltage read from TMP36 = 171
voltage converted to 5v (I assume, that the arduino has a voltage regulator to limit the input to 5v, right?)

171 * 5.0 / 1024 = 0.83 
temperature = (0.83 - 0.5) * 100 = 33

my questions are:

  • Is there a way to correct it via software or should I drop the voltage, using a diode/resistor?

  • At the datasheet its written that the input voltage range is from 7v to 23v. Does it means that it has a regulator to 5v internally to regulate my arduino to 5.5v? Does it means as well that I will need more battery to put it to work?

Arduino used is the Iteaduino BT

schematics
data sheet

Best Answer

You can neither correct it in software, nor use a diode or resistor to drop the voltage if you don't know the cause, or the error function. You get 44° instead of 22°. What would you do to solve this? Divide by 2? Would a reading running on USB of 15° also result in 30° when running on the batteries? A diode would be a bad solution in any case.

My first reaction was that the batteries would give a too high voltage. The first line of the datasheet says 2.7V to 5.5V operation. Now if those were Alkaline batteries you would have 6V, that's outside specifications, and then anything can happen. Always make sure you're within specs before you start looking at other things.
But you say they're rechargeable, that's probably NiMH, at 1.2V per cell that would give you 4.8V, almost the same as the USB's 5V. That can't explain it.

I realize it will be a simple schematic, but still: post it here. We'll need to have a look at every possibility. In the mean time, measure the batteries' voltage and report back.