Controlling power direction with transistors

Hi. I’m trying to build what I thought was a simple circuit, but it didn’t work the way I thought it would. I could use some advice please.
I want to use a digital output pin with two transistors to switch the power from one direction to another.
ie: I have two 10 led bar graphs. When the output pin is high, the power would flow to the green LED set. When the pin is low, power will stop going to green, and start going to red led set.

My attached schematic didn’t work though. I only have power going to green.
I’m guessing I need to add a resistor or two to help the transistors switch.
Don’t worry about resistors for the LED’s. They are irrelevant due to the constant current display driver chip I’m using to control the LED themselves. I just need this bit in order to get the power flowing to the correct set.

Thanks. I hope you understand what I’m asking.
Cheers

Put two base resistors.

Look up High side driver and low side driver. Your low side driver is OK, need to look at you High Side driver. May also need to look into and INVERTER like a 7404.

Hi. Thanks for the responses. I put a 4.7K resistor on each base (based on this webpage: http://www.sqlskills.com/blogs/paulselec/post/Arduino-figuring-out-transistors-and-associated-resistors.aspx) and now the circuit does behave like I want. :)

I've started to read up on the 7404 but I'm not understanding how this would help me yet. Reading high-side and low-side just makes me think I've got one of the transitors in the wrong place, but it has to go where it is. It can't go after the load because the MM5451 needs to be on that side of the load.

Cheers.

Both your transistors are wired HighSide - they are on the power side instead of the ground side.

It refers to how you drive a load. High side means your switch is between the plus power and the load; low side means the switch is between the load and negative power.

The NPN transistor is typically used as a low side driver - That way when the base is at 0NV the transistor is off, and when the Base is greater than 0.7V the transistor is on. In your application the voltage to turn on the transistor depends on the voltage across the LED and will be 0.7V above teh voltage that turns on the LED.

A PNP is typically used as a high side driver. When the base is at the supply voltage the transistor is turned off. When the base is 0.7V below the supply voltage the transistor will turn on.

If you wire your NPN as a low side driver, the PNP as a High Side driver, and a 1K resistor from the Arduino pin to the transistor bases, and a 10K resistor to ground I think you will have a better chance of success. That would drive teh bases to near 4.5V when the pin in on, and near 0V when the pin is off.

Thanks for the clarification. I’m still processing the numbers :slight_smile:

My circuit is attached. I’m using 4.7k resistors on the base of the transistors. I’m really not sure if those are correct. Or how best to calculate the necessary value. Since 0 to 10 leds could be on at any one time, I get confused as to the numbers I need to use to make the calculations with.

Cheers.

What is your intention, why not use two separate pins to switch green/red? Not enough pins?

Yup, not enough pins (by far). In total, my project uses over 170 leds spread over 7-seg displays, bar graphs, and individual lamps. :) What I'm doing now is creating Time and Speed delta displays. ie: if current time is better than benchmark time, show green lights, else if slower then show red lights. Plus, this method makes the code a bit more efficient and will ensure that there can't be a code bug that leaves both red and green on at the same time. So I'm making an effort to use the Arduino pins as sparingly as possible.

Here's a vid without these latest changes: http://www.youtube.com/watch?v=g0OXJUHKfak

Cheers.