Using Arduino Uno and relay FRS1B in a Robot Arm project

Hi,

I made a project called 'Robot Arm with Electromagnet' that has been published here:
http://fritzing.org/projects/robot-arm-with-electromagnet/

Arduino Uno with a program controls two servos and should controls the electromagnet in the and of the arm.
If a switch is off then one can control the arm (only servos) with potentiometers.
If a switch is on then the program controls the arm: two servos and electromagnet.

The schematic can be seen here:
http://fritzing.org/media/projects/thumbs/sidebar/RobotKar2szervoval-2_schem.jpg

My problem is that that relay doesn't switch on/off the electromagnet.
The electromagnet is always switched on.

I use the FRS1B relay and the 2N1613 transistor in the project.

The programcode can be downloaded from here:
http://fritzing.org/media/fritzing-repo/projects/r/robot-arm-with-electromagnet/code/SantaKrisztianRobotkar_arduinoPrg.ino

Why doesn't work relay?

Regards, from Pál

If you replace the relay and transistor with a LED and resistor, does the LED turn on and off?

PaulS:
If you replace the relay and transistor with a LED and resistor, does the LED turn on and off?

When I replace the relay and transistor with a LED and resistor (220 Ohm), and run the program, the LED does turn on and off,
however it doesn't work on pin 13 (switch) and pin 12 (relay) but only on pin 4 (switch) and pin 2 (relay). Does it mean that that I
messed the Arduino? :frowning:

I have more difficulties here: the switch isn't so good and I realise yesterday that that if I replace the switch with two wires on the breadboard, then LED works always right, however I don't understand why turn on/off LED when the "switch" is off (LOW) and not when the "switch" is on (HIGH)? Regarding to the programcode it should works in another way instead.

Yesterday I soldered the end of wires so that I get more reliable connections on breadboard and Arduino connectors.

Sorry for my mistake, I realised these days that , that I did put instead a normal diode a zenner diode to protect the relay. Sorry, I'm a newbe in electronics. So now I replace the zenner diode with the 1N407 diode.

Any advices?