On / Off / Flashing LED circuit help

Jony130

Joined Feb 17, 2009
5,598
I think I have the answer. As the emitter of the transistor is raised from zero to 1.5 volts, the voltage from collector to emitter becomes less. If you're using a blue or white LED, that is going to eat up about 3.2V to 3.4 V. What's left for the transistor? About 0.2 volts collector to emitter. That puts the transistor in the range where its DC gain approaches zero. Then it becomes a (base) current hog, like takao said.
Are you sure ?? How large will be this base current ?? Are you suggesting that the LED will burn?
For this circuit
http://forum.allaboutcircuits.com/attachments/5v-fader-png.77472/
Base current cannot be larger than
Ib_max = (Vcc - 2Vd - Vbe )/Re = 32mA But what about the LED current?
 

#12

Joined Nov 30, 2010
18,224
Are you sure ?? How large will be this base current ?? Are you suggesting that the LED will burn?
For this circuit
http://forum.allaboutcircuits.com/attachments/5v-fader-png.77472/
Base current cannot be larger than
Ib_max = (Vcc - 2Vd - Vbe )/Re = 32mA But what about the LED current?
Of course I'm not sure. That's why I said, "I think". According to my math, a 5 volt source trying to charge a capacitor above 3.3 volts with a 4k resistor will supply about 425 ua. Probably less because the 555 chip will not deliver the entire 5 volts to pin 3. If the transistor is trying to pass 15 ma, it must have at least a DC gain of 35. If the LED has used up 3.2 volts and the emitter resistor has used up 1.5 volts, the transistor only has 0.3 volts from collector to emitter. If I remember correctly, bipolar transistors get way down on the gain curve when they only have a few tenths of a volt on their collector.

And, no, I am not suggesting the LED will get too hot. It's current is limited by the 100 ohm resistor in the emitter circuit. I am suggesting it will use up too much of the 5 volts available. You might expect a gain of 150 to 400 when the BC337 has even one volt to work with, but when you starve the collector down to a few tenths, the gain has to suffer.
 

Attachments

Jony130

Joined Feb 17, 2009
5,598
But what will happen if we increase the base voltage above 4V ? For simplicity you can connect base directly to 4V voltage source and VF = 3.2V and Re = 100Ω; Vcc = 5V.
What is the collector current?
What is the emitter current?
What is the base current?
 

#12

Joined Nov 30, 2010
18,224
I don't know how you're using Vf in this case. V at the emitter? I'll try that.

If you give the base 4 volts at low impedance, the 100 ohm resistor will have about 3.2 volts across it and pass about 32 ma. That's Ib + Ic. The collector current and the base current depend on the gain of the transistor at the Vce it has to work with. Usually, the collector carries almost all of the emitter current.
 

Attachments

Jony130

Joined Feb 17, 2009
5,598
Ah sorry Vf = LED forward voltage drop. But ok.
This circuit has inserting properties. If we give the base 4 volts the emitter voltage will be equal around 4V - 0.7V = 3.3V and Ie = 33mA,
The voltage across the LED is equal to 5V - 3.3V = 1.7V. So the LED is off, and no current will flow through it and this means that Ic = 0A.
Since Ic is 0A no transistor "action" occurs. So for this circuit I_LED_max ≈ (5V - 3.2V - 0.2V))/100Ω ≈ 16mA.
But Ib_max = Ie_max = (5V - 0.7V)/100Ω = 43mA
 

takao21203

Joined Apr 28, 2012
3,702
I think I have the answer. As the emitter of the transistor is raised from zero to 1.5 volts, the voltage from collector to emitter becomes less. If you're using a blue or white LED, that is going to eat up about 3.2V to 3.4 V. What's left for the transistor? About 0.2 volts collector to emitter. That puts the transistor in the range where its DC gain approaches zero. Then it becomes a (base) current hog, like takao said.

Short out the LED and see if the oscillator starts running again.
I found that even if the CE voltage is almost zero, there can be regular DC gain. If you use a resistor to prevent the base sourcing current.

I made a tester, with two joule thiefs to provide some 3.5 volts, and DIL switches to probe the CBE configuration, as well regulation potentiometers for base potential and current.

Where the PNP was configured to connect to VCC and with a LED / small resistor to ground,
the NPN in reverse (connecting to GND, LED to Vcc).

I measured the CE voltage an in some cases, almost zero, base current very small (there are two potentiometers on the board).

When I tested larger power transistor, the LED wouldnt turn on at low base currents.

Both base potential, and available current are important. To some degree it breaks down over the limiting resistance, to some degree it depends on the hFE, the CE current and potential, and whats most important the make of the transistor chip. There are plenty different kinds.

A LED is a relatively small load, a few mA, maybe 10mA. The transistor will behave differently at larger or very small currents. But if it is grounded (for NPN), I think the base would hog additional current, no matter how much current flows into the collector. The CE current doesnt increase because its low voltage, and the LED "cant" have larger current flowing through it, but current through the base is increasing especically if you have no resistor at all.
 

takao21203

Joined Apr 28, 2012
3,702
I made a PIC programmer, which can set the MCLR to H, L, to Vpp, or let it float.

All with NPN/PNP transistors!

When it floats, the green high efficiency LED has a little bit of a faint glow. Maybe some micro Amps.
How much base current would that need? 10 nA? Its hard to isolate that, so with modern good transistors, you get a little glow.
 

Attachments

Thread Starter

aac52

Joined Dec 16, 2014
28
Wow, so there has been quite a lot of discussion since I last checked, not all of it I understand!

I think I have the answer. As the emitter of the transistor is raised from zero to 1.5 volts, the voltage from collector to emitter becomes less. If you're using a blue or white LED, that is going to eat up about 3.2V to 3.4 V. What's left for the transistor? About 0.2 volts collector to emitter. That puts the transistor in the range where its DC gain approaches zero. Then it becomes a (base) current hog, like takao said.

Short out the LED and see if the oscillator starts running again.
I have tried this just now, and shorting out the LED does indeed let the oscillator start running again, and increasing the resistor to 10k for example worked as expected (except the LED does not work of course).

I noticed there are various other things for me to try, but as yet I haven't tried them since I hadn't actually checked this thread as I was waiting to post back here once my parts had arrived. I will go back through the recent posts and carry out the advised tests soon.

As it happens I have been trying to create the full circuit I need, rather than just the fader in my absence.

At the moment, with the simulated components a 3k resistor works fine, and gives what I think is the desired fade rate.

So, back to my original brief.

I have two circuit inputs, A, and B, these are GPIO pins from a Raspberry Pi (3.3v). The Raspberry Pi is powered from 5v, so I also have this voltage available to power my circuit.

When A = 0, B = 0, the LED wants to be off. Ideally in this case the whole circuit wants to be consuming as little power as possible.

When A = 1, B = 0, the LED wants to be fading in and out.

When A = 0/1, B = 1, the LED wants to be on.

What I have come up with is the following circuit, and as far as I can tell through simulating it, it works.



Am I going along the right track here, or can improvements be made? Have I done anything naughty that is bad practice?
 

#12

Joined Nov 30, 2010
18,224
Wow. That's pretty good.
The only thing missing is a couple of capacitors across the timer from Vcc to Gnd. A 10 uf of any sort and a 0.1 uf ceramic.

Consider this variation. If I remember correctly, you wanted: If A, then B is enabled and
if B then "on all the time".
 

Attachments

Thread Starter

aac52

Joined Dec 16, 2014
28
Well I can't take too much credit, I have been given quite a large shove in the right direction thanks to the helpful posts in this thread :)

I think though it may need a little bit more work. Q2 is not doing what I thought I was attempting to do. I thought that I had connected it so that when A was high it was giving 5v to the reset pin through Q2, but actually it is giving ~3v from the GPIO pin which I guess in this case should actually be fine, the current draw is very, very low. To be honest I think I just got lucky with that bit, I'll have to decide if adding another transistor is worth it to then control power to the whole 555 timer, rather than just the reset pin.

I don't think your alterations would work, remember that A and B are GPIO pins on the Pi, controlled via code, so output will be either 0v or 3.3v. In my diagram I have illustrated this using VDD for the 3.3v source, and a switch, I guess I should have explained that a little better since the diagram doesn't truly represent the real-world case. Also because of my error with transistor Q2, VCC would only get 3v rather than 5v, so the 555 timer wouldn't have a high enough voltage to work properly. I think I may have to add another transistor to get it to work how I thought it was actually working.

I also don't think my requirements were explained well enough, I knew what I wanted in my head, but they are perhaps not as stringent as I have written them here. For example, B does not have to be enabled by A, it just happened that in the initial discussion this seemed to be a reasonably simple circuit.

The only constraints are as per my previous post, #68. However to clarify a little further, I don't believe the situation of A = 0, B = 1 will occur, so this case does not really matter, hence the LED could probably be flashing, off, or on, it is irrelevant for the real-world purpose, so there is some freedom in terms of a circuit. As it happens the way my current circuit is designed, the LED will be on if B is 1, regardless of the state of A.

Could you please explain the purpose of the capacitors a bit more? And where exactly do they go? Do I need the 10uF between pin 5 (con) and GND, then 0.1uF straight between VCC and GND?

I've also got a bit carried away with all these transistors and had a go at another circuit, but I think I may start another thread for that.
 

#12

Joined Nov 30, 2010
18,224
I don't think your alterations would work, remember that A and B are GPIO pins on the Pi
Darn, missed again. :mad:

(That's my standard reply for, "You caught me making a mistake".)

Extra filtering from the Vcc pin on the chip to the ground pin on the chip (or as close as you can get) = 10 uf in parallel with 0.1 uf ceramic.
The 555 chip has a nasty current blip when it switches. These capacitors supply that current so the blip doesn't travel through the circuit and cause other parts to glitch.

Edit: So much slang. It might not translate well into other languages. Sorry, atferrari
 
Last edited:

Thread Starter

aac52

Joined Dec 16, 2014
28
Well we all make mistakes. But the good thing is I noticed it, so it must mean I have some understanding of what is going on in the circuit ;)

I see, thank you for explaining. Guess I'll need to place another order as I didn't get any of those, but I'll hold off just in case I make any other alterations and need other things too.
 

#12

Joined Nov 30, 2010
18,224
Well we all make mistakes. But the good thing is I noticed it, so it must mean I have some understanding of what is going on in the circuit ;)
And I have a, "standard reply" which means I have some understanding of how often I need to use it. :rolleyes:
 

Thread Starter

aac52

Joined Dec 16, 2014
28
So I went ahead and made the flashing LED circuit in post #39 (without the two capacitors that were mentioned since I don't have these yet), but the circuit doesn't quite function as intended. I added a third diode to see if it would make any difference, but it didn't.

Unfortunately I don't have access to an oscilloscope so I can't tell exactly what is happening, but perhaps it is obvious to someone?

I took a short video on my phone.


You can see that the LED is fading in and out, but there is what I would call a stutter when it transitions from fading out, to in. It would appear that when the LED is at the lowest brightness it has a short burst of being bright again, before it starts fading in from nearly nothing. Also note that the LED never fully turns off, is there a simple way to solve that?

And yes, I know, the circuit is extremely untidy.
 

Thread Starter

aac52

Joined Dec 16, 2014
28
Kind of ironic, but I found part of the issue...

The capacitor I omitted seems to be important, for the reasons mention by #12 - I temporarily put a 47uF cap between Vcc and GND and the stutter stopped.

Do you really think that C1 being 470uF is the cause of the LED not turning off? I put it that large since anything lower meant the fade time was really low since the resistor could not be very large instead, due to the reasons that were discussed in the past couple pages.
 

cmartinez

Joined Jan 17, 2007
8,787
Kind of ironic, but I found part of the issue...

The capacitor I omitted seems to be important, for the reasons mention by #12 - I temporarily put a 47uF cap between Vcc and GND and the stutter stopped.

Do you really think that C1 being 470uF is the cause of the LED not turning off? I put it that large since anything lower meant the fade time was really low since the resistor could not be very large instead, due to the reasons that were discussed in the past couple pages.
To be honest, I don't know for sure... what I do know if that if C1 doesn't discharge completely then Q1 won't turn off completely either, I'm doing a wild guess here, but why don't you try to place a resistor in parallel with C1? Say one with a value of 100K, or more, for starts?
EDIT: Another thing to try is to place a biasing resistor between Q1's gate and ground, say of 100K too?
 

Thread Starter

aac52

Joined Dec 16, 2014
28
To be honest, I don't know for sure... what I do know if that if C1 doesn't discharge completely then Q1 won't turn off completely either, I'm doing a wild guess here, but why don't you try to place a resistor in parallel with C1? Say one with a value of 100K, or more, for starts?
EDIT: Another thing to try is to place a biasing resistor between Q1's gate and ground, say of 100K too?
No worries, I appreciate your suggestions.

I have adding the resistors, I have tried both together, and each individually, but unfortunately the LED still doesn't quite turn off.

I also tried swapping C1 for a 47uF one, it still did not turn off.

From my observations, it seems the LED is on very brightly for a lot longer than it is dim for. So, it will stay what appears to be full brightness for a second or two, then quickly fades out (but not fully off), then quickly fades in again. Increasing R1 makes the fading slower, but also makes the LED stay fully lit for longer. This to me suggests that the wave does not reach a low enough voltage for the LED to turn off fully, I guess the 1/3 voltage range using a 5v source just isn't enough for this circuit to work optimally.
 

cmartinez

Joined Jan 17, 2007
8,787
No worries, I appreciate your suggestions.

I have adding the resistors, I have tried both together, and each individually, but unfortunately the LED still doesn't quite turn off.

I also tried swapping C1 for a 47uF one, it still did not turn off.

From my observations, it seems the LED is on very brightly for a lot longer than it is dim for. So, it will stay what appears to be full brightness for a second or two, then quickly fades out (but not fully off), then quickly fades in again. Increasing R1 makes the fading slower, but also makes the LED stay fully lit for longer. This to me suggests that the wave does not reach a low enough voltage for the LED to turn off fully, I guess the 1/3 voltage range using a 5v source just isn't enough for this circuit to work optimally.
If I remember correctly, some 555's are designed for voltages greater than 6V, and most circuits I've seen run on 9V... could that be a clue?
 
Top