Need guidance with themosistor and relay

Hi, this is my first project... so please be lenient.

I'm building a solar furnance, and I want to start a 12 PC fan when the temperature in the panel is higher than the temperature in the house.

Here is my components description:

  • Arduino uno
  • 2 LM335 for the temperature
  • 1 relay 5vcd (# JZC-11F - 220/250v ac5a)
  • 1 LCD screen to display the temperatures.
  • 2 12v PC fans
  • 9V 500ma power supply for the board
  • 12v 200ma power supply for the fans

The relay is activated by a transistor.
I've put a fly back diode on the relay.

I'm able to have a good temperature reading but as soon as the relay goes on, the temperature goes wild.
I suppose it's because there is a drop in the voltage (from 4.95v to 4.5v) when the relay is activated.

I've tried to connect the grd and the 5v of the coil to a 5v transformer (while the base of the transistor is connect to a digital pin of the board) and it works.

Do you see any problem in this configuration?
Do you have any suggestions so I don't have to use 3 differents power supply (I was thinking to also plug the 12v in the arduino board)

Thanks for your help

I dont know why the relay messes things up , but i have just made the same thing you are describing, and have a few comments,

you mention two lm335, are you reading two temps? if so , the adc needs time to recover inbetween analogue reads, i put a delay(20) and then take the analog read a second time in order to get a stable result from both my lm35 and my voltae divider,

Second,
Why use a realy to power the fan , you can just use a bigger transistor to run the fan, I have a big old mosfet that can run 50a running a pc fan, its overkill, but i pulled it from a dead charger so i dont care, if you put a flyback diode on the transistor you should be ok,

i left mine on the bench running all day with no issues,

I don't have any problem with the LM335. I'm doing a double reading of pin 0 and 1 every 10 sec and I always have a constant reading. 1 sensor is off by .6 degre but if I switch the order of the sensor, I ended up with the same reading. Here is my sketch for the temperature reading:

if (millis() - previousMillis > interval){
for(int i = 0;i<=1;i++){ // read twice as the 2nd reading is more accurate
temp_out = CheckTemp(0); // Outside thermometer is on pin 0
temp_in = CheckTemp(1); // Inside thermometer is on pin 1
if (temp_out > temp_in){
digitalWrite(motorPin, HIGH);
}
else{
digitalWrite(motorPin, LOW);
}
}
previousMillis = millis();
}

Second,
what you said makes a lot of sence and I would never have thought about it by myself. I was using a relay because... my level of knowledge is still pretty limited.

Could you give me a transistor reference number so I can find something equivalent. I almost understand what to look for when looking a a P2N2222A reference sheet (Motorola 2N222 datasheet pdf) but I'm quite lost when looking at a mosfet sheet (HTTP 301 This page has been moved). The terminology is not the same (collector, base, emitter VS gate, drain, source).

Thanks

i am at the same level of ignorance as you im afraid, i was also trying to control fan speed with a relay, then i googled a bit and found a page similar to this ,

http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/

that page is a good one to help understand how to connect it all, i didnt use a tip120 though, i just grabbed an old transistor from the parts box and tried it out,

what you want to make sure of is that the transistor can easily handle the volts and amps needed , with a good margin, otherwise it will get hot and you will need a heatsink, i would use a heatsink anyway though