Controlling a relay

hi,

this diagram is great, thanks. i think it's shown me that i was trying to do this the wrong way. i was assuming that you could control the relay directly as if it were an LED or something, which seems to sort of work. can anyone tell me what the transistor and rectifier actually do?

the Arduino can source about 20 millimaps of current through a pin.. a relay typically takes 100-300ma. So the transistor is there to amplify the signal from the Arduino to the current level required by the relay. Try googling "transistor amplifier theory", or "NPN Switch" if you want to know more.

D