I have connected digital pin 2 of arduino to the circuit as shown: 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 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. turns on when I touch it
Thank you in advance.
-
if that's an npn, it's (probably) backwards. you also need to common the ground with the MCUdandavis– dandavis2017年03月11日 11:40:27 +00:00Commented Mar 11, 2017 at 11:40
-
Hint: Use wires intended for breadboards. The battery wires lack pins.Mikael Patel– Mikael Patel2017年03月11日 12:50:39 +00:00Commented Mar 11, 2017 at 12:50
1 Answer 1
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.
-
Yes, you are right its working now. Thank you very much :D.Teja Allani– Teja Allani2017年03月12日 08:00:38 +00:00Commented Mar 12, 2017 at 8:00
-
Sorry for the photos, I uploaded this from my phone and I put connections in image descriptions, but they are not visible in the post.Teja Allani– Teja Allani2017年03月12日 08:04:09 +00:00Commented Mar 12, 2017 at 8:04