Introduction: VERY SIMPLY RELAY AND ARDUINO PROJECT

Picture of 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

Picture of 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 ;))

Comments

KwstasM1 (author)2015-04-05

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

ibenkos (author)2014-10-18

Smart idea! Thanks for shearig :)

schel (author)2014-10-02

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.

creator45 (author)schel2014-10-03

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 ;)

seamster (author)2014-09-29

Nice work. Thanks for sharing this!

creator45 (author)seamster2014-09-29

thanks seamster!!

About This Instructable

2,521views

45favorites

License:

More by creator45:The Easiest way to make your own  pcbThe easiest way to make  wardrobe lightsTHE ULTIMATE CONTROL BOX
Add instructable to: