user26301: I have connected digital pin 2 of arduino to the circuit as shown:

The problem is that the LED is not turning on normally its only turning on when I touch anything on collector side of circuit. What seems to be the reason? Seems like grounding problem as its turning off when I don't touch my legs to ground.

Thank you in advance.

user16085: Sounds like you have guessed it: although it's very hard to say from those photos, it doesn't look like you have the circuit grounded.
Connect a ground from the Arduino to the black wire from the battery.

26301: <p>I have connected digital pin 2 of arduino to the circuit as shown:
<a href="https://i.stack.imgur.com/SbENc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SbENc.jpg" alt="pin 2 to 1kOhm resistor to base of 2N222 transistor. Emitter to -ve of 9v battery. Collector to -ve of LED, +ve of LED to 330Ohm resistor, resistor to +9v"></a>
The problem is that the LED is not turning on normally its only turning on when I touch anything on collector side of circuit. What seems to be the reason? Seems like grounding problem as its turning off when I don't touch my legs to ground.
<a href="https://i.stack.imgur.com/DL3Fw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DL3Fw.jpg" alt="turns on when I touch it"></a></p>

<p>Thank you in advance.</p>
 16085: <p>Sounds like you have guessed it: although it's very hard to say from those photos, it doesn't look like you have the circuit grounded.</p>

<p>Connect a ground from the Arduino to the black wire from the battery.</p>
