LED Driver with a Square Wave

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
Hello,

i am a electronics student and i need to built an light emittor where a array of LEDs have to flick with a certain frequency and have a "constant" current of max200mA, to drive the leds im using an opamp and a transistor as a current regulator, and to provide the square signal im using a 555 circuit as shown in figure below.

circuit_Pedro Vilas-Boas.png
http://postimg.org/image/p8c9qfdkx/full/

In Pspice simulator everything works as expected, however, i ve tried this circuit in pratic and the 555 oscilator works good but the signal that is in the '-' input of the opamp is not even a square wave similar to the one that entered the '+' input of the opamp, which causes the leds to emitt light but not with the square wave expected. The opamp used is an LM741.

Any idea why this is not working?
 

dl324

Joined Mar 30, 2015
16,845
This is the homework forum. You must post your analysis of the problem. Many people will know the answer, but it won't simply be given to you...

Look up the specs for the opamp being used and study anything that might effect output voltage swing. Why are you using an opamp?

Since you are just starting electronics, I'll offer a critique of your schematic. Avoid unnecessary wire jogs, minimize white space, position the power source such that it doesn't obscure circuit intent. Draw the timer so the intent is clearer. If you don't understand, say so and I'll give you an example.
 

JoeJester

Joined Apr 26, 2005
4,390
Questions:

What is the required design frequency of the oscillator?
What is the duty cycle of that oscillator?
How many LEDs are in the array?
What current do you expect to flow in each LED?
 

crutschow

Joined Mar 14, 2008
34,282
An op amp constant current circuit is generally overkill for controlling LED current and the frequency response of your op amp limits the rise and fall time of the current.
You just need one or two transistors for the constant current.
If you Google constant current circuit or current limit circuit you will find some to chose from.
 

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
This is the homework forum. You must post your analysis of the problem. Many people will know the answer, but it won't simply be given to you...

Look up the specs for the opamp being used and study anything that might effect output voltage swing. Why are you using an opamp?

Since you are just starting electronics, I'll offer a critique of your schematic. Avoid unnecessary wire jogs, minimize white space, position the power source such that it doesn't obscure circuit intent. Draw the timer so the intent is clearer. If you don't understand, say so and I'll give you an example.
I am using an opamp because the Hfe of the transistor can variate which causes changing in collector current. I think this way the collector current will be constant because the opamp will give the necessary current that the transistor's base asks.
I checked the opamp specs and i chose this one because it fufills my needs it has slew rate 0.3 V/uS and 0.5uS of rise time. It s rail to rail so i think it shouldnt have problem in the output swing.
Pratical circuit has timer with clear intent and power source is as close as possible.

My analysis to the problem is that im doing something wrong and i cant figure what :p
 
Last edited:

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
Questions:

What is the required design frequency of the oscillator?
What is the duty cycle of that oscillator?
How many LEDs are in the array?
What current do you expect to flow in each LED?


frequency can be anything in order of KHz with 50% duty cycle.
I have 4 Cree XP-C Leds in series that with 200mA cause 3.5V each to fall.
 
Last edited:

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
An op amp constant current circuit is generally overkill for controlling LED current and the frequency response of your op amp limits the rise and fall time of the current.
You just need one or two transistors for the constant current.
If you Google constant current circuit or current limit circuit you will find some to chose from.

I understand the opamp can cause some problems with time but from specs of opamp this really shouldnt be a problem i think. And isnt it "dangerous" to connect the timer output directly do base of transistor? I think some small variation in Hfe can cause the collector current to change.
 

dl324

Joined Mar 30, 2015
16,845
I am using an opamp because the Hfe of the transistor can variate which causes changing in collector current.
The beta of a 2N2222 will not vary much at a relatively constant current and the bipolar 555 timer (LM555) can source/sink 200mA so base drive shouldn't be a limiter.
I think this way the collector current will be constant because the opamp will give the necessary current that the transistor's base asks.
I checked the opamp specs and i chose this one because it fufills my needs it has slew rate 0.3 V/uS and 0.5uS of rise time.
I don't know how you're getting a rise time of 0.5uS; 0.3V/uS means about 5uS rise/fall times.
It s rail to rail so i think it shouldnt have problem in the output swing.
A 741 is not rail to rail. That notion was virtually nonexistent when the 741 was designed.
Pratical circuit has timer with clear intent and power source is as close as possible.
As clear as this?
schExamp.jpg
I substituted an LM358 so the compensation terminals don't obscure the intent. I added an LED to show that this is indeed an LED driver. I took the liberty of connecting the 555 in a more typical astable configuration.

Notice how I drew the timing components in a line so it's easy to follow the charge and discharge paths. I understand that you're probably using the stock 555 timer from your simulator. The stock one from my schematic editor is poor and I modified it to convey intent more clearly.
My analysis to the problem is that im doing something wrong and i cant figure what :p
I cringe when I see people just starting out in electronics depending so heavily on simulators. I liken it to giving a calculator to a first grader who doesn't yet know the concepts of basic arithmetic and expecting that they will understand them anyway.

Why are you using diodes to limit the input to the opamp? At the frequency you're switching the LED, does it really matter if the LED is being driven by a more perfect square wave?
 
Last edited:

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
Why are you using diodes to limit the input to the opamp? Could that be causing the non-square wave output you're seeing? At the frequency you're switching the LED, does it really matter if the LED is being driven by a more perfect square wave?
im limiting because i dont want to have a square wave with a lot of amplitude. 1.4V will limit the current in transistor's emitter to 140mA.

At this frequency it doesnt matter that the square wave is not perfect of course but the signal emitted by the LEDs will later be received by a photodetector that is checking the frequency. (this is part of a big project).
 
Last edited:

dl324

Joined Mar 30, 2015
16,845
im limiting because i dont want to a square wave with a lot of amplitude. 1.4V will limit the current in transistor's emitter to 140mA.
Can you think of a better way that would allow the current to be adjusted?
At this frequency it doesnt matter that the square wave is not perfect of course but the signal emitted by the LEDs will later be received by a photodetector that is checking the frequency. (this is part of a big project).
What did you mean by the square waves on the opamp inputs were different?
 

Thread Starter

Pedro Vilas-Boas

Joined Oct 27, 2015
14
Can you think of a better way that would allow the current to be adjusted?
Im going to check.

What did you mean by the square waves on the opamp inputs were different?
Tomorrow i will post a photo of it. Im afraid to describe it with words, a digital osciloscope can get the frequency with no problems. But im afraid the receiver im using wont as it s a photodiode based circuit connected to a PIC32. Anyway i would like to see more of a square wave than whatever is giving now.
 

ian field

Joined Oct 27, 2012
6,536
An op amp constant current circuit is generally overkill for controlling LED current and the frequency response of your op amp limits the rise and fall time of the current.
You just need one or two transistors for the constant current.
If you Google constant current circuit or current limit circuit you will find some to chose from.
Its a perfectly valid way of going about it - and much clearer for a novice to see what's going on.

I'd use more series diodes for a higher Vref and use a MOSFET to shunt them rather than rely on the 555 Vout-low to cut the op-amp off.

That of course means that anything other than 50:50 mark space ratio in the 555 has to be thought of in reciprocal terms.
 

MikeML

Joined Oct 2, 2009
5,444
Here is another way to make a pulsed constant-current LED driver.

I'm assuming that the pulser is the 555. Do not operate the 555 on more than 15V; that is getting close to its rated VccMax. It's output pin will swing from~1V to ~14V, see red trace.

Q1, M1, R1 and R3 constitute a constant-current LED driver. Current through the LEDs is Vbe(Q1)/R1 = 0.67/3.3, or about 0.2A, see yellow trace I(D4), which is in units of mA.

The addition of Q2 gates the CC driver on/off. See V(g), orange trace.

The power dissipation in M1 is a modest ~0.5W, which doesn't require much heatsinking... See green trace, which is in units of Watts.

135.gif

This simulation shows what you can expect for an upper limit of pulsing frequency using this circuit. Note that the turn-on time is dominated by how long it takes to charge the gate capacitance of M1 through R3. Turn-off is much faster. Good enough to pulse at ~200KHz....
 
Top