Cannot make my simple circuit function, please help

Hello all,

I wrote a very simple program to act as an thermostat. I used this command: digitalWrite(3, HIGH); Duemilanove is the board I am using.

I hooked up some wires from digital pin 3 to a reed relay. Also a ground to complete the circuit. Problem is when I run the program nothing happen, no relay click and no test across, doesn't seem to have anything going out of the pin when that is turned high, not sure where to go now, please help.

What is the relay? Most likely the arduino cannot source enough current to drive the relay coil.

http://www.cotorelay.com/9000_Spartan.pdf Here is the link for the relay.

power453c: Hello all,

I wrote a very simple program to act as an thermostat. I used this command: digitalWrite(3, HIGH); Duemilanove is the board I am using.

I hooked up some wires from digital pin 3 to a reed relay. Also a ground to complete the circuit. Problem is when I run the program nothing happen, no relay click and no test across, doesn't seem to have anything going out of the pin when that is turned high, not sure where to go now, please help.

Could be several things. Do you have a pinMode(3, OUTPUT); command in your sketch to set the pin to output mode before you do the digitalWrite? Do you have a link to the specific relay you are using to see if a digital pin can drive it properly or not? Is it a 5vdc rated coil? some reed relays will work directly, some will not, depending on their coil current requirement. Also posting your sketch always helps when asking for help as otherwise we have to make assumptions on what you may or may not have done correctly or incorrectly. We are blind, help us help you. ;)

Lefty

power453c: http://www.cotorelay.com/9000_Spartan.pdf Here is the link for the relay.

That datasheet covers several models and several options. You need to exact part number including dash options to be 100% correct in any answer for you.

Lefty

9007-05-01 is the specific one i am using.

// Thermostat

int sensorPin = A0;
int sensorValue = 0;

void setup()
{
// pinMode(10, OUTPUT);
// pinMode(8, OUTPUT);
//pinMode(2, OUTPUT);
pinMode(A0, INPUT);
pinMode(3, OUTPUT);

}

void loop()
{
digitalWrite(8, LOW);
digitalWrite(3, HIGH);
sensorValue = analogRead(sensorPin);
if (sensorPin < 50) //500 is original
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, LOW);
}
}
//}

9007-05-01 is the specific one i am using.

Good, that means it has a 5vdc 500 ohm coil, so a arduino output pin can handle that just fine directly. More important the -01 option means that there is a protection diode built into the relay across the coil terminals, that means the note at the end of the datasheet applies: "note 2 Optional diode is connected to pin #2 (+) and pin #3(-). Correct coil polarity must be observed. "

Which means pin 2 must wire to the arduino output pin and pin 3 to arduino ground. If you wired it backwards there is the possiblity that you burned out the arduino output pin 3, and you may have to try a different output pin if you did have it wired backwards initially.

Lefty

Your code is testing whether the sensorPin number is < 50. I think you meant sensorValue?

Also your relay should work given the specs, but did you note the warning about coil polarity (there is a diode across the coil)? Get this wrong and you will be overloading pin3 and possibly blow it…

Did you try connecting the coil directly to 5V to test its switching before connecting it to pin3? It’s wise to test each part separately before connecting everything together.

Ok, looks like a good match for arduino to drive directly, with built in diode.
You have arduino D3 connected to relay pin 2, and relay pin 3 to ground?

Can you put a print statement in?
sensorValue = analogRead(sensorPin);
serial.Print (sensorValue); // maybe the action is working as intended?
if (sensorPin < 50) //500 is original // << change to sensorValue as MarkT said

Lefty, I didn't scroll back enough, missed yours when I posted mine ...

CrossRoads: Lefty, I didn't scroll back enough, missed yours when I posted mine ...

No problem, I'm just glad our answers agree. :D

Lefty

Thanks every one, i will try these things out and let you know.

Thank you, it now functions well.