Relay connection to arduino via transistor

Hi,

Also you might look at the schematic diagram for these very widely used relay boards: http://goo.gl/PcWJ2

Scroll down and look at the schematic diagram. This is like the Arduino.cc example, but adds an optical isolator. This is not costly in large quantities (This 2-relay board is $4 )

There is also another consideration about guaranteeing that relays don 't operate momentarily at startup/reset: http://arduino-info.wikispaces.com/ArduinoPower#4-8

DISCLAIMER: Mentioned stuff from my own shop...