how to interface relay with arduino

hello i am new to project, i was trying to interface arduino with relay.
relay has NC, NO, and C outlet which i was trying to connect with arduino. any idea frens how to connect.

NC normally closed, when the magnet coil is of this is on
NO normally open, when you apply power to the magnet coil this is on (likewise when the magnet is off this is "normally open")
C common, the shared points tween the three

as far as hooking it up look up some basic motor tutorials, as the important parts are about the same, otherwise its a switch

:slight_smile:

Look at these relays powering motors. The principle is the same for any load:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

Thanx guys i really appreciate ur quick reply. I am using 12 V relay here's the website

http://www.hobbyengineering.com/H1325.html

i need to detect the trigging of the relay when the signal is received.

If you're really trying to use the arduino to sense the contacts of the relay that is activated by something else, you can use the C and NO contacts the same way you would use a pushbutton switch... (but people are usually connecting relays the other way around, so the arduino can cause the relay to switch other things, and people jumped to conclusions...)

thanx Richard Crowley and westfw

I mean A) Something else is driving this 12V relay and you want Arduino to detect when the relay is activated.

Sorry for not clarifying the question.

I'm still confused about coding, when we make a condition loop on programming ( lets say trigger is on and we received the signal) what kind of signal do we receive though, is there any way to find what kind of signal we receiving, so that we can specified at condition loop (IF statement) saying IF (INpin == ????)

Read and understand the button tutorial.

Korman

The signal you read is the logic level on a digital pin. You find this with the digitalRead(pin) function.

Supposed you have connected your relay contacts between input pin 4 and ground and enabled the internal pull up resistor then you could use:-

if(digitalRead(4)) { // do what you want when the pin is high }
else { // do what you want when the pin is low})

or if you don't understand this short cut then:-
if(digitalRead(4) == HIGH) { // do what you want when the pin is high }
else { // do what you want when the pin is low})
will do exactly the same

than x for the help guys, I really appreciate your quick response.