scotty562

Hello everyone. I've got my Arduino setup and functioning properly. I've just setup two DS18B20 digital temp sensors and they work just fine. What I'm trying to do now is modify the code so that if the insideTemp is > 100F then I turn on a relay.

Ideally I'd like to be able to do something like below, but when I do it's not happy for some reason.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

scotty562

I guess I don't understand. The DS18B20 tutorials I found say I need the one wire library to make this temp sensor work. That's why I thought I needed it. I'm not clear on the buffer to drive the relay either. The 5v of the arduino is enough to make it click.

Edit: Never mind. I think my title showed my ignorance so I edited it to be more clear.

5v isn't the problem, current is the problem.Most relays are going to draw more current than an Arduino I/O pin can safely supply.

Have a look at some of the interfacing examples over at the Playground.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

The DS18B20 tutorials I found say I need the one wire library to make this temp sensor work. That's why I thought I needed it

You do need it, at least unless you want to handle to protocol yourself. It looks fine as you now have it.

As to switching your relay, you may need to do a little refactoring; having the temperature read inside the print routine makes it awkward to control your fan since only one temp sensor's reading should be allowed to control the fan. One solution would be to have the print function return the temperature it read. Less elegant would be to read the inside temp again after displaying the results and put your fan controlling if statements there.

scotty562

I would like to have float collector = printTemperature(insideThermometer); not need a separate function to work. I'd like to be able to say: float collector = value of sensor1, but my lack of programming knowledge inhibits this. For what I'm doing it doens't really bother me that much as it's functional. Although it would be nice to know how to do it.

For the relay control I got one of these: http://www.powerswitchtail.com/Pages/default.aspx should be good to go once that gets here.

I would like to have float collector = printTemperature(insideThermometer); not need a separate function to work. I'd like to be able to say: float collector = value of sensor1, but my lack of programming knowledge inhibits this. For what I'm doing it doens't really bother me that much as it's functional. Although it would be nice to know how to do it.