Go Down

Topic: varying output from tmp36 temperature sensor when running on battery (Read 2085 times) previous topic - next topic


I am trying to set up a simple tmp36 temperature sensor using arduino uno & breadboard. Temp reading is displayed on an LCD. The sketch works fine when connected via USB cable to my PC and shows the correct temp. for example output shows .72 volts & 21.78 degrees C.

However when I disconnect the USB cable & plug in a battery pack to power the uno (4 x AA rechargeable, voltage out from the battery pack is reading 5V on my multimeter) the reading from the tmp36 changes (now showing 1.06V & 56.45 degrees C). Plug the USB cable back in & it goes back to the correct reading.

To minimise power draw the LCD is not using the backlight.

Does anyone have any idea why this is happening ? The documentation for the tmp36 says "Just give the device a ground and 2.7 to 5.5 VDC and read the voltage on the Vout pin. The output voltage can be converted to temperature easily using the scale factor of 10 mV/°C."


Code: [Select]

int tempPin =1;
int tempReading;

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 5, 4, 3, 2);

void setup() {
  // setup LCD's number of columns and rows
  lcd.begin(16, 2);

void loop() {
  tempReading = analogRead(tempPin);
  float voltage = tempReading * .004882814;
  float temperatureC = (voltage - 0.5) * 100;
  lcd.print(" degrees C");


By default the reference voltage for the ADC is VCC. In case of USB power this is 5V. It looks as if VCC is below 5V when running from batteries. Where did you measure the 5V? At the batteries or at the processor?
Check out my experiments http://blog.blinkenlight.net


Hi there,

the 5V is measured at the batteries where it plugs into the barrell connector.

I have now found that if I use 5 x AA NiMH rechargeable batteries (6.2V) then it is slightly better (temp 27 degrees, the real temp is 21 deg)

So presumably the 5V from 4 batteries is not enough to drive the arduino board & supply the right voltage to the TMP36 temp sensor. Having said that when I measure the voltage at the jumper wires (with 4 batteries) going to the tmp36 it reads 3.3V. The tmp36 requires from 2.7V to 5V so it should be enough ?


You can measure X here and Y there but I think the point is that the default reference is VCC as Udo says and without a stable VCC you will never get a reliable reading.

I think you have to either use the internal 1v1 reference and atenuate the sensor output or use and external reference, say 2v5.

Rob Gray aka the GRAYnomad www.robgray.com

Go Up