0

Its my first attempt to work with relay I tried to test my relay with this simple code

int Relay = 2; void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(Relay,OUTPUT);
}

void loop() {


  digitalWrite(Relay,HIGH);
  delay(1000);
  digitalWrite(Relay,LOW);
  delay(1000);
}

I use thius simple 12V Relay

Connected to IN -> Digital 2 GND -> GND VCC -> 5V

The only thing is happened is the LED of the relay blinking in every sec. but can not hear the clicking sound from the relay box or testing with a multimeter's diode function the two(NC and COM) OUTs aren't close I tried to test other relays(from the same type) but does not do anything else.

thank you for your help What can be wrong?

  • Can you try the relay without arduino? 5V->5V, GND->GND, IN->0V/5V should simulate the arduinos programm. If it does not click, it may be damaged. – ansi_lumen Jul 27 '18 at 10:58
1

NC is "Normally Connected" - this contact is connected to COM ("common") if coil of the relay is not powered - the relay is disconnected.

NO "Normally Open" is connected to COM when the coil of the relay is powered - the relay is connected.

Some relays have the coil powered when the signal from MCU is LOW.

If the coil of the relay doesn't click, but the signaling LED lights up, then VCC is not connected. Check if you plugged the wire really to 5 V on Arduino side.

0

You need to define Relay. If the LED on the relay module is blinking, then you must have defined as pin 2 output, but omitted it from the code you posted. Please post all of the code!

It is good practice for all user variables to start with lowercase, e.g. relay not Relay. Then the code becomes:

relay = 2;
void setup(){
pinMode(relay,OUTPUT);
digitalWrite(relay,"LOW");
}

void loop(){
digitalWrite(relay,"HIGH");
delay(1000);
digitalWrite(relay,"LOW");
delay(1000);
}

If the relay still does not click on/off, test the microcontoller voltage output on the relay pin using your voltmeter. Check the relay is not dead or mis-wired.

  • sorry the relay was defined just made a mistake when copying the source code – Andrewboy Jul 27 '18 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.