The following URL will take you to YourDuino site where they have safe opto-isolated relays.
The relays are good for 110v and 220v and are opto-isolated preventing you from any shock from the arduino board.(very safe). If you get shocked from the relay side then consider turning off the power of your house first. dah.
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156How to connect to the arduino sensor shield
http://arduino-info.wikispaces.com/ArduinoPowerA sensor shield should be purchased that stacks on top of the arduino uno.
(You have much more flexibility with this sensor shield for future projects such as a real time clock which can be used for timing when the relay is turned on or off).
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=95How to connect to the Arduino uno here: (about half way down).
http://arduino-info.wikispaces.com/ArduinoPowerNow if the instructions are not clear for you relay please note the following:
Sensor Shield Information:
1) ROWS on the sensor shield: There are "rows" of pins on the sensor shield in the middle marked GVS from top to bottom and on some other boards we have instead - + S where:
- is the ground G.
+ is power 5V
S is the pin # that corresponds to the pin # on your relays.
2) COLUMNS on the sensor shield: are numbered 0 to 13. These are pin numbers on your shield that can be connected to pins numbers on your relay.
3) Code sample that will turn the relays on then off.
/* YourDuino Example: Relay Control 1.10
* Handles "Relay is active-low" to assure
* no relay activation from reset until
* application is ready
*/
int Relay_1 = 2; // relay_1 will operate through pin #2
int Relay_2 = 3; // relay_2 will operate through pin #3
int Relay_3 = 4; // relay_3 will operate through pin #4
int Relay_4 = 5; // relay_4 will operate through pin #5
void setup() /****** SETUP: RUNS ONCE ******/
{
//-------( Initialize Pins so relays are inactive at reset)----
digitalWrite(Relay_1, HIGH);
digitalWrite(Relay_2, HIGH);
digitalWrite(Relay_3, HIGH);
digitalWrite(Relay_4, HIGH);
//---( THEN set pins as outputs )----
pinMode(Relay_1, OUTPUT);
pinMode(Relay_2, OUTPUT);
pinMode(Relay_3, OUTPUT);
pinMode(Relay_4, OUTPUT);
delay(4000); //Check that all relays are inactive at Reset
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
//---( Turn all 4 relays ON in sequence)---
digitalWrite(Relay_1, LOW);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_2, LOW);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_3, LOW);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_4, LOW);// set the Relay ON
delay(4000); // wait see all relays ON
//---( Turn all 4 relays OFF in sequence)---
digitalWrite(Relay_1, HIGH);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_2, HIGH);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_3, HIGH);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_4, HIGH);// set the Relay OFF
delay(4000); // wait see all relays OFF
}//--(end main loop )---