VERY SIMPLY RELAY AND ARDUINO PROJECT

Published

Introduction: VERY SIMPLY RELAY AND ARDUINO PROJECT

WHAT YOU NEED:

1) A REALY MODULE (IM USING KEYES)

2) 9 VOLT BATTERY

3) 9 VOLT BATTERY CONNECTOR

4) 2 JUMPER WIRES ,AND WIRES

5) A 9VOLT LAMP

Step 1: CONNECTING

CLICK THE WHITE BACKGROUND IMAGE..........

THE CODE:
int Relay = 7;
int stateRelay = LOW; ; void setup() {
  pinMode(Relay, OUTPUT);
}
 
void loop() {
 digitalWrite(Relay,LOW); // Turns ON Relays 1
Serial.println("Light ON");
delay(2000); // Wait 2 seconds
digitalWrite(Relay,HIGH); // Turns Relay Off
Serial.println("Light OFF");
delay(2000);
}

AND BOOM!!!!!!!!!!! THERE YOU ARE ;))

Share

    Recommendations

    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    6 Discussions

    i think you have forgot in the void setup "Serial.begin(9600);" so you k=can see the "light on" and "light off" on the serial monitor

    Smart idea! Thanks for shearig :)

    Very informative! so, going by this and something I saw elsewhere but, didnt really "get it" is one of these relays can be attached to a PIR sensor directly for signal and act as a motion switch to "turn on" whatever may be attached to the relay "out" without the need of a micro-controller ie: arduino etc. Do you know how to do this? I've tried but just have an "always on" thing goin' ...no switching going on.

    1 reply

    this is an instuctable for pir senosr with arduino :https://www.instructables.com/id/Arduino-Basics-PIR........but for sure you can make a circuit without a micro-controller ,but is going to a bit hard,i think you cant and you shouldnt connect to your project a relay like this because is made for micro-controles ,it's going to easier with a relay like this (((http://www.google.com/imgres?imgurl=http%3A%2F%2Fw...

    YOU CAN ALSO BUY A PIR SENSOR FOR HOME SECURITY AND ATTACH WHATEVER YOU WANT....IF YOU WANT MORE HELP ASK ME ;)