Transistor trouble - controlling LEDs running on 9v using 3v pins

Hi guys! Full disclosure: the board I'm working with is not technically an arduino board, but it's a similar that I program with the Arduino IDE. I didn't know where else to ask and everyone here is just so clever I figured someone would be able to help (flattery will get you everywhere :wink: !)

So here's where I'm at:
Eventually, what I want is to have a few strings of a few LEDs, with each string switched on and off by a pin on my Adafruit feather board. The board has 3.3v logic, with 600mA peak current output, so I can't run many LEDs off of it directly. I figured I needed some transistors, so I could use the output of a pin to control LED strings powered by another power source.

I got some Pn2222 transistors and made a test circuit to try switching just one string of LEDs first. But I can't seem to get it to work!

I've tried using different pins, and using different values of resistors at the transistors base, but no matter what, whether the pin is high or low, the LEDs never light. Can someone point me in the right direction? I've attached a picture of my circuit - let me know if anything is unclear.

Thanks!

Cannot see your LED(s), looks like a ball of grey wire. Please state what color and how many leds you're trying to drive. You are also missing a resistor between the feather and the base of the transistor. This can destroy either feather output or the entire board so stop now and fix that.

Here's a good reference: https://www.gammon.com.au/motors ad scroll down to the title "BJT transistor driver".

Also need to mention there is a possibility that your transistor pinout is not the usual EBC (as you have it connected) but rather CBE. Have a look at this wiki article:

I've attached a picture of my circuit

Not very helpful a schematic would be good.
You don't seem to have a base resistor, you need one, this might have damaged the Arduino pin already?

Have you set the pin you are using to be an output?

Have you connected the grey wire from the LED to ground instead of the transistor? If it does not light up maybe the LED is the wrong way round?

avr_fred:
Cannot see your LED(s), looks like a ball of grey wire. Please state what color and how many leds you're trying to drive. You are also missing a resistor between the feather and the base of the transistor. This can destroy either feather output or the entire board so stop now and fix that.

Here's a good reference: Gammon Forum : Electronics : Microprocessors : Driving motors, lights, etc. from an Arduino output pin ad scroll down to the title "BJT transistor driver".

Thanks for the advice! I didn't realise I could do so much damage without a base resistor! Should I just be chucking a couple of hundred ohms at it or do I need to calculate the value in more detail?

The LEDs are white, there's three of them and they look like 3mm to me (not totally certain, they were grab bag components)

Thanks again!

avr_fred:
Also need to mention there is a possibility that your transistor pinout is not the usual EBC (as you have it connected) but rather CBE. Have a look at this wiki article:

2N2222 - Wikipedia

From the datasheet on the website I bought the transistors from, it seems to be EBC

Grumpy_Mike:
Not very helpful a schematic would be good.
You don't seem to have a base resistor, you need one, this might have damaged the Arduino pin already?

Have you set the pin you are using to be an output?

Have you connected the grey wire from the LED to ground instead of the transistor? If it does not light up maybe the LED is the wrong way round?

Yeah, definitely going to add a base resistor now! When I get in I'll try and check the board still works... oops!

Yup, I have set the pin to be an output. Sure of that. And the grey wire from the LED definitely goes to the transistor. I'm confident about the orientation of the LEDs, too – I checked them with a resistor and battery before I assembled this circuit, and I put tape on one end to make sure I didn't forget which way round they are!

3 LEDs wired together? Serial or parallel?

outsider:
3 LEDs wired together? Serial or parallel?

In series (sorry, should have said!)

Did you 'check' them individually, or all three in series with the 9v battery? if not the latter, do that now, without the 2222 in place.

123Splat:
Did you 'check' them individually, or all three in series with the 9v battery? if not the latter, do that now, without the 2222 in place.

Thank you everyone for your patience and help but I've figured out the problem! The power rails on the bread board I'm using are arranged in two halves rather than being connected along the entire length of the board... Embarrassing!

Have got a base resistor now though so that's something!

Hi,

minihannah:
Thank you everyone for your patience and help but I've figured out the problem! The power rails on the bread board I'm using are arranged in two halves rather than being connected along the entire length of the board... Embarrassing!

Have got a base resistor now though so that's something!


Tom.. :slight_smile:

minihannah:
Thank you everyone for your patience and help but I've figured out the problem! The power rails on the bread board I'm using are arranged in two halves rather than being connected along the entire length of the board...

That is why in reply #3 I said:-

Have you connected the grey wire from the LED to ground instead of the transistor

That test would have told you.

Hi there,

did you get it work in the end?
I am also using a Feather M0 and trying to connect it to a Motor 3-6V by using the same circuit as you do. When wiring GND and the pin to my Arduino it works perfectly. When wiring it to the Feather M0 there is no response, the controller starts and works, but apparently the signal doesn't go through.

Guessing it is because of the transistor? Does someone have an idea?

Thanks in advance (:

Is it wired like this? Where is the motor power coming from?
https://www.fairchildsemi.com/datasheets/PN/PN2222A.pdf
NPNMot-2.png2N2222.png

Thanks for the reply!
The motor's power is coming from a 9V battery, I am as well using the PN2222A transistor. Instead of the 330 Ohm base resistor I am using 220 Ohm (does that make a difference?).

Attached you find a picture of my wiring (sorry that it's only a photograph as well, I hope it is clear enough). The red and white wire on the left are connected to my motor 3-6VDC.
All black wires are GND, the orange wires are connected to the pin and red is the power.

I am using the following board:

Try it with a better battery e.g. 6 x AA batteries. Those small rectangular PP3 9V batteries are o.k. for the LEDs that this thread was originally about but are usually far too weak to successfully power any motors.

Steve