One of my favorite Mechanical Relays is the Reed Relay. They come in a variety of coil voltages, and the one we use has a 5v coil, and is a perfect match for the Arduino. It has a resistance of 500 ohms, so it draws 10ma, right within the range of the Arduino output capabilities. Reed Relays come with or without snubber diodes. Snubber diodes are used to prevent the inductive kick of the coil from damaging the port on the Arduino. We will be using a Reed Relay with a built in snubber.
We will be using a digitalWrite command to output a 5v HIGH to the output pin that connects to the + pin on the reed relay. The Magnecraft W107DIP-5 is a fairly inexpensive Reed Relay, with Normally Open contacts. Normally Closed, and SPDT varieties are also available.
Connect Pin 3 of the reed relay to the output pin (13) on the Arduino. Connect Pin 5 of the reed relay to Gnd. Pins 1 & 7 are your switched contacts. Connect Pin 1 to power, Pin 7 to load, and the other pin of your load to the other power connector. The load and load power can be AC or DC, and up to .5 amp current draw.
int outputPin = 13; // Relay connected to digital pin 13
void setup()
{
pinMode(outputPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(outputPin, HIGH); // sets the relay on
delay(5000); // waits for 5 seconds
digitalWrite(outputPin, LOW); // sets the relay off
delay(5000); // waits for 5 seconds
}