temperature sensor + relay = electrical noise (?)

Hi guys,

First of all, I'm a junior programmer, so no electrical skills at all. Maybe I'll use some wrong therms but hope someone will understand the problem I'm facing :slight_smile:
What I'm trying to do, is a web server where the client controls a home heater (simulated by an LED).
I'm using: - arduino uno R3

I've tried many software solutions, but the temperature error is not stable at all - sometimes I get 1 degree error, somethimes 3 degrees;
What i've tried: - Chebyshev filter (Chebyshev filter - Wikipedia) - worked somehow, but still not accurate.

I'd be very happy to find a solution to this..
Thanks

  1. How is the system powered? If the relay draws too much the reference voltage of the analogRead() may be not 5.0V (check with voltmeter?)

  2. can you post your code?

Problem: each time the relay turns on, the temperature jumps ~2 degrees up - so from 22 C temp gets 24.

I've tried many software solutions,

It sounds to me like it is a hardware problem. It sounds like the current being drawn from the relay is causing a small dip in the supply voltage. This in turn affects the reference voltage and hence the reading.
Alternatively depending on how the grounds are connected you could be getting what is called ground lift by the current from the relay.
Try connecting the sensor and relay to a physically different ground on the arduino.

What is powering the unit? How much current is being supplied?

robtillaart:

  1. How is the system powered? If the relay draws too much the reference voltage of the analogRead() may be not 5.0V (check with voltmeter?)

That was a great question! I used only the USB as a power source. I changed it to arduino's orignial power supply and seems that the problem is solved! I don't now how come I didn't thought at this before.

before connecting power supply (temp to change the relay = 30):
28.42
28.56
29.30
29.83
30.47
33.01
32.76
32.71

after connecting power supply
28.81
29.00
28.96
29.79
30.18
30.57
31.30
31.05
30.57

Thank you !

LE:

Grumpy_Mike:
Try connecting the sensor and relay to a physically different ground on the arduino.

this is also good to know :slight_smile: I'll try that, just out of curiosity..
Thanks