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 ;))
6 Comments
8 years ago on Introduction
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
8 years ago
Smart idea! Thanks for shearig :)
8 years ago on Introduction
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.
Reply 8 years ago on Introduction
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 ;)
8 years ago on Introduction
Nice work. Thanks for sharing this!
Reply 8 years ago
thanks seamster!!