Peter Clement
Published

Working with Relay with Arduino

This will show you how to interface the Relay and the Arduino for the purpose of switching

BeginnerFull instructions provided13,595
Working with Relay with Arduino

Things used in this project

Story

Read more

Schematics

Relay schematic

Code

Relay

Arduino
Main code to configure the Relay
/*   Relay and Arduino >>>> code by @_carlos_dev     */

int relayPin = 8;           //Assign Pin 8 to the relay control/signal pin

void setup() {
  // put your setup code here, to run once:
  pinMode(relayPin, OUTPUT);      //Setting the Relay pin as an Output Pin
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(relayPin, HIGH);        //Turn the relay ON for 1 second
  delay(1000);
  digitalWrite(relayPin,LOW);          //Turn the relay OFF for 1 second
  delay(1000);
}

Relay Tester

Arduino
To test the coil and electromagents of the relay
/*   Relay and Arduino >>>> code by @_carlos_dev     */

int relayPin = 8;                       //Assign Pin 8 to the relay control/signal pin

void setup() {
  // put your setup code here, to run once:
  pinMode(relayPin, OUTPUT);          //Setting the Relay pin as an Output Pin
}

void loop() {
  // put your main code here, to run repeatedly:

}

Relay

Credits

Peter Clement

Peter Clement

7 projects • 7 followers
I'm a Student and a Developer and I work on both Hardware and Software related Projects, also a big Outdoor fan 😎 and loves cooking 😋

Comments