Processor needs more Voltage problem

Thread Starter

dmoore210

Joined Sep 18, 2011
5
Ok so I am hooking up a processor to a circuit and the processor needs around 5 volts. My input that I am going to be giving it however is 24volt power supply.

I'm using a regulator to bring it down to 5 volts so that's not a problem. However the processor is going to control 10 leds through one output. All other outputs are used and it leaves this one to control 10 leds. Each led needs a voltage drop of 2.4 volts and around 20mA.

Problem is, when I turn the output high, it only supplies 5v. What can I do to make sure my led's are getting the full 24 volts from the power supply when the output of the channel goes high, and make sure we are getting 20mA per led. Thanks!
 

Thread Starter

dmoore210

Joined Sep 18, 2011
5
I actually dont need any resistors since the main supply is 24 volts, and 10 leds each using 2.4 volts would use up all the voltage perfectly.
The transistor worked perfectly. I just have my main line of led's going into C, my control line of 'on/off' into B, and ground into E and when control goes on, it allows current to flow into the ground.

However I am trying to have one more piece into this circuit and it's having a capacitor so the lights will come on instantly, but then fade away as the control goes low.

I don't know enough about capacitors to wire this correctly. I can get the capacitor to charge, but I can't figure out how to get it to discharge when the control line goes low without supplying all 24v constantly to both the capacitor and the leds.



The pic is the start of what I have, except when control goes low, it shuts down any current going through the led's. Any ideas?
 

SgtWookie

Joined Jul 17, 2007
22,230
If your LEDs really have a Vf of 2.4v @ 20mA current, then you're either going to have to use 9 LEDs in series, or settle for less current flow through them, as you will need to use a current limiting resistor in series with the LEDs.

You don't mention how well regulated the 24v is, but that will also have a bearing on how many you can use in series.
 

Thread Starter

dmoore210

Joined Sep 18, 2011
5
9 in series is fine. I am simply trying to use a processor to turn on 5 - 10 led's using a single channel, then after a specified time of a few seconds turn them off, however with a fade-out, and more than likely have a fade in as well at some point.

I wanted to manage the fade-out circuit first controlled by a processor. However the problem is being the processor can only deliver 5 volts where-as I need the full 24 volts from the main power supply.
 

SgtWookie

Joined Jul 17, 2007
22,230
I didn't see your post before I replied. Your Q2 does not have a base resistor; you really do need to use one. You'll need 2mA base current to saturate the transistor for 20mA collector current; your uC's Vcc is 5v, the Vbe of the transistor will be ~0.7v, so you'll need 4.3v/0.002A = 2150 Ohms resistance between the base and your uC's output pin. 2.1k or 2.2k would be fine.

Rather than trying to use another transistor with caps and resistors for timing, why don't you use PWM on Q2's base to make the LEDs dim/brighten? If your PWM frequency is ~200Hz or more, you won't see any flickering.
 

Thread Starter

dmoore210

Joined Sep 18, 2011
5
Thanks, good idea. I'm a student and have a basic understanding of the components so bare with me!
So you are saying use the pwm in the processor. Im not sure how I would use an external pwm controlled by the processor since the output lines are constant on/off.
The pwm from the processor would still only output a Max of 5 volts at the base, so would I need all the LEDs in parallel? Could we get enough current for 10 or so LEDs?
 

SgtWookie

Joined Jul 17, 2007
22,230
You apply a 0v to 5v PWM signal to the base of the transistor.
The base frequency for the PWM signal should be >= 200Hz.
You still have your 9 LEDs in series with a 120 Ohm current limiting resistor being powered by 24v.

If you wish, you can have more strings of 9 LEDs in series with a 120 Ohm resistor - if they still have a Vf of 2.4v @ 20mA. If they have different specifications, the current limitin gresistor will need adjustment. Also, the base resistor will need to be decreased to compensate for the additional collector current.
 

Thread Starter

dmoore210

Joined Sep 18, 2011
5
Right, I understand. However here is my concern --
If I don't use the pwm from the processor and I use the output lines from the processor I can only turn the output HIGH or LOW which means there's no variable resistance for the 555 timer. I'm looking for a circuit somewhere that will achieve what I want, just not finding it.

In a nutshell what I'm trying to achieve eventually is my processor will control three or four outputs. Each output will have 9 led's in series. Each output will dim/brighten led's at different intervals at different times.

I've made the code already but it just simply turns each string of led's on/off independently and doesn't dim or brighten them. That's why I'm looking at capacitors, or PWM's to help.
 

SgtWookie

Joined Jul 17, 2007
22,230
You don't have to use the uC's built-in PWM module; you can toggle the I/O pins in a software loop.

I don't know why you'd be fiddling around with 555 timers if you have a microcontroller.

You need to update your program code to include a software PWM loop. Adding on external hardware will not only add expense and bulk, but will limit your flexibility, and decrease your reliability.
 
Top