Relay problems

Hi, i'm trying to interface my Arduino Mega with a 6v relay with an external power suply, actually i'm trying in this way:

A1: arduino digital pin
R1: 1 kOhm
R2: 330 Ohm
D1: 1N4007
Q1: 2N222A

i've bridged arduino gnd and power suply gnd.

withou the relay and D1, led blinks without problems, when i attach em, everything stop working :smiley:

int transistor=53;
void setup(){
  pinMode(transistor,OUTPUT);
}
void loop(){
  digitalWrite(transistor,HIGH);
  delay(1000);
  digitalWrite(transistor,LOW);
  delay(1000);
}

any idea to get it to work ? :smiley:

any idea to get it to work

yep get the circuit right.
You have a common collector transistor amplifier. This you do not want.
see:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html
for how to drive a relay with a transistor.

done :wink: working :wink: tnx :wink: