Arduino-LM35 issues

Hi, I am currently making an incubator, using an Orpat fan heater. I have an Arduino Uno, connected to an LM35. the readings are displayed on a 16x2 LCD. I have no problems upto now. The problem starts when i connect a 5v 20mA relay to the circuit.

I have connected a transistor SL100 through a 1k resistor to the arduino. The emmiter is grounded, while the collecter is connected to the 5V supply through a diode.

Across the diode is connected the relay.

I have put the relay's Normally closed and common across the live wire of the power lines of the heater.

Everytime i switch on the power to the heater, the LCD begins showing garbled digits....while my LM35 fluctuates within a 10-15 degree range.

Is this a programming problem or a physical one ?. If its a physical problem, what changes should i make to handle this ?

Do you have capacitors across the power supply?

Is this a programming problem or a physical one ?.

Yes : physical one. Welcome to the real world. :grin: Are you perfect? Like all humans, including me, I think not. For components it is the same. Copper cables do not have zero resistance and the Ohms law applies.

Remember LM35 give only 10 mV per degree.

If its a physical problem, what changes should i make to handle this ?

The important cable is GND cable. The current drawn by the LM35 is extremely low so it does not intervene. But if you use the GND cable to control a relay, current will be much higher and because of the Ohms law there will be a voltage across the GND cable.. Consequently Arduino show more degrees.

You should not use GND cable that connects LM35 GND to Arduino board GND f[u]or another component.[/u]

With only 10mV per degree it is prohibited. I hate to prohibit, but here it is mandatory.

[u]Another possible problem:[/u] Like any CMOS IC LM35 does not support capacitive cables. Long cable are capacitive. If it is the case a serial resistor must be added to the output of LM35 series to protect it from cable capacity.

See the datasheet, preferably datasheet from National Semiconductor. Datasheet recommends 2 kohms, I obtained an optimum with 4.7 kohms.