Anybody do much work with electronics, or have a decent understanding of NPN transistors? Bashing my head on what should be a simple circuit, and it's not behaving right.

Basically using an 2N2222 NPN transistor as a switch, base is connected to digital out pin on an Arduino at 3.3v and a 10k resistor. Collector is connected to 5v, a 330 ohm resistor, and an LED. And the emitter is connected to ground.


All the simulated testing works fine, meaning when I toggle off the 3.3v line, the transistor turns off, and the LED goes out. However, when I drop the same setup onto a circuit board, the LED comes on and stays on, even when the Arduino pin is LOW.

I even discovered with the Arduino out of the circuit, simply touching what would be the 3.3v line resulted in the LED lighting up, albeit rather dimly.

I'm sure I'm missing something stupid. Everything I've read says this should work.

· · Web · 1 · 0 · 0

After posting on Stack Exchange to help solve my dilemma, somebody nudged me in the right direction. I was using different grounds because the Arduino was being powered by the 5v from the USB. Once I connected the Arduino to the 5v rail and let it get it's power there, everything was happy.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!