Ananjar,
is good to see you make progress, at least on connections.
But you connection to transistor is still wrong. If you don't trust me, look at the datasheet of 2n2222a transistor:
or
So I'm saying, and the manufacturer is saying that:
in my drawing:
1 is emitter: must connect to gnd - that's ok;
2 is base: must be connected to resistor that comes from arduino pinout - it's inverted with collector;
3 is collector; must be connected to diode(anode side - non striped side) and relay - it's inverted with base.
You cannot change this (I saw that you already did it), I repeat, you cannot change this just because your computer powers off when usb is connected. Your usb is not saying: "your transistor has swapped pins". It's saying: "oh, something is wrong".
And what could be wrong? Well, looking your pics, the only thing I can see is the base swapped with collector.
But you're saying if connecting all like the drawing the usb powers off.
Then there are some possibilities:
- your transistor has short circuited while you trying to make the project work;
- your arduino 5v. source cannot support relay draining current;
- your resistor is touching transistor case (this will not disable pc, but the project will not work). Transistor case is equal to collector;
- another thing I didn't thought;
And there's one more thing I didn't saw before. Is this the sketch you uploaded to make arduino works with this project?
http://www.flickr.com/photos/21664172@N07/2175459890/
If yes, It doesn't does what you're thinking. It's the button example sketch. It works with pin13 as output, an pin10 as input. And I understood your project uses pin 10 as output, right?
Make the changes I listed, disconnect USB, disconnect arduino pin10 from resistor, and put Arduino 5v. directly on resistor. The relay must work, and light goes on.
If it doesn't try changing the transistor, and try this again.
If the additional hardware works, you must think about the sketch you want to write or use.
The sketch you're using should work, but you have to change the "wire from pin10 to resistor " for "wire from pin13 to resistor".
And add a button. One terminal from pin10 to button, and other from 5v. to button. You must connect a 10k resistor from pin10 to gnd too.
Or more easy: just to test if arduino is turning on relay, upload blink example sketch, and put a wire from pin13 to resistor. The relay will turn on and turn off each second.
If nothing more important and expensive burned out before, this should work.