lm35 is not working properly when arduino is externally powered

Hello,

I am new with lm35. So first I have uploaded just the basic code to get the output. It displays accurate data on 1602 LCD. But the problem is arising when I connect the arduino UNO with external 12V power supply.

As an example..

When the Arduino is powered from USB it displays 20.4*c-20.7*c. But when it is connected with 12V the temperature fluctuates from 11*c to 32*c.

Please help. Thank you.

  1. Are you feeding the 12V external supply via the barrel jack, or are you feeding it into the Vin and Gnd pins of the Arduino? If the latter, then you need to use one ground pin to connect the LM35, and a different ground pin to connect the 12V supply (and any output devices). Otherwise, the resistance and inductance of the common ground connection and wire means that current in the power supply and output circuits will affect the voltage on the analog input pin that you are using to read the LM35.

  2. The +5V supply is not always very stable, especially when using USB power. I recommend usnig the 3.3V supply as the analog reference when reading sensors with absolute voltage output, such as the LM35.

In my opinion there are two possible issues:

First, when the +5V is not stable your ADC reading will vary because in standard mode +5V is taken as the reference voltage for the ADC. You could try to take the internal 1.1V reference for the ADC.

Secondly, the LM35 can have a swing problem, especially when your wires are long (1m can be enough). I had this once, too. This is hard to track because it appears only sometimes (due to noise in the system). I wrote a post in my blog about this point. If interested, look at:

http://heliosoph.mit-links.info/connecting-an-arduino-with-a-lm35-temperature-sensor-special-issues/

Elektrix

Thank you all.

I am using 9v now. It is working accurately. But I am still not sure why the error has occurred.

Thank you.