Go Down

### Topic: temperature sensor + relay = electrical noise (?) (Read 2072 times)previous topic - next topic

#### rotsloth

##### Dec 16, 2012, 08:16 pm
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
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
- temperature sensor ( http://www.robofun.ro/senzori/vreme/senzor-temperatura-brick )
- relay (similar to this:  http://www.dhgate.com/2-channel-relay-module-for-arduino-arm-pic/p-ff80808137e9dbf3013826966df333e8.html )
I've programmed arduino to turn on the relay if the temperature drops under 22C ( the LED simulating the heater will light up)
Problem: each time the relay turns on, the temperature jumps ~2 degrees up  - so from 22 C temp gets 24. Lets suppose the real temperature is 22C: now the temperature value in arduino is 24. In order to turn the relay off, temp should drop under 22. So from 24 to 22 temp decreases with 2C, but when it reaches value 22, the real value of temperature is 20. At this point, the temperature from ardiono drops to 20 - correct value;

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 (http://en.wikipedia.org/wiki/Chebyshev_filter) - worked somehow, but still not accurate.
- Connected Arduino 3V3 pin to Arduino AREF pin like in the second image  http://learn.adafruit.com/tmp36-temperature-sensor/using-a-temp-sensor  but didn't used any of those resistors because I don't know what type is the one from left, connected to 3v3 pin and analog pin0. If someone knows, I'll appreciate his help.

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

#### robtillaart

#1
##### Dec 16, 2012, 08:30 pmLast Edit: Dec 16, 2012, 08:37 pm by robtillaart Reason: 1
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?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### Grumpy_Mike

#2
##### Dec 16, 2012, 08:33 pm
Quote
Problem: each time the relay turns on, the temperature jumps ~2 degrees up  - so from 22 C temp gets 24.

Quote
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?

#### rotsloth

#3
##### Dec 16, 2012, 08:58 pmLast Edit: Dec 16, 2012, 09:05 pm by rotsloth Reason: 1

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:

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

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

Go Up

Please enter a valid email to subscribe