Optimizing a circuit

Thread Starter

jonmol

Joined Mar 27, 2021
5
Hi,

Just finished doing my first proper schematic(*) and I'm worried that it's a bloated over engineered lump of components. What I'm trying to do is having 3 LEDs, powered by 2-3 AA batteries fade in and out. I've added a 4th LED which will be on when all 3 are off, I realize that could be solved by an OR gate for instance but 4 LEDs are fine.

My Eagle CAD schematic looks like this:
1616858401161.png

My electronics knowledge is very rudimentary, and I wanted to try to design this from scratch as a way to learn about it. And I have indeed, but I'm also feeling that there are probably a thousand better ways of doings this. I was hoping someone where might take the time and explain some possible optimization and/or downright error spotted. The LEDs, caps and resistors aren't having a final value here as I'm still trying to figure out a good combination of the components to have the colours and fade in-out times I want.

I have this lot on a bread board so it's at least working with a Lab PSU without anything catching fire or exploding.

Three questions I have already now (apart from "Any obvious ways of improving this?"):
  • The fading I'm doing is with 2 resistors and one cap. Is there a way around that? Because that means that when the LED is driven from the battery, it has to pass two resistors in series, to make sure it also have one when being driven by the cap. Is there a way around that? (trying to have the LEDs as bright as possible)
  • Coming from sofware my OCD hits me with the 4 exactly (they won't be exactly the same once I've decided the colours as they'll need different resistors and caps for similar brightness and fading times), is there a reasonable way to "reuse" those circuits?
  • As I'm using 3 bits from a counter is the pattern obviously 001, 010, 011 and so on, if I'd want to have a more custom pattern, what should I look into? I'm trying to avoid micro controllers if possible

Thanks in advance, and hope that I'm detailed enough without going overboard with unnecessary details, pretty hard knowing exactly what's relevant when there's a fair amount of fumbling in the dark going on.

(*)I think it's proper, doesn't necessarily mean that's really the case
 

AnalogKid

Joined Aug 1, 2013
9,168
Gold star for having reference designators.

1. Why are counter outputs Q4-Q7 tied to its Reset input? a) You cannot short two outputs together; under some conditions, one of them will be trying to go high while another is trying to go low, putting a soft short across the power supply. It is ok to let unused outputs float. b) Since it is an up counter, after Q4 resets the counter it never will get to Q5-Q7.

2. Starting with 3 V, you lose 0.6 V through a transistor and the LED needs around 2 V to light, leaving very little headroom for the current limiting resistor and the fade components. Changing to 3 batteries will make a big difference.

3. Also, consider re-arranging the transistors. You have them as emitter followers, pulling the LEDs up from GND. If you change them to saturated switches by connecting the emitters to GND and pulling the LEDs "down" form the 3 V rail, there will be less power loss in the transistors.

4. Another option is to stay with the emitter follower LED drivers, but move the R-C timing network to the transistor base. Since the base current will be a small percentage of the emitter (LED) current, it should take a smaller capacitor for the same timing.

ak
 
Last edited:

Thread Starter

jonmol

Joined Mar 27, 2021
5
Gold star for having reference designators.
Heh, thanks :)

1. Why are counter outputs Q4-Q7 tied to its Reset input? a) You cannot short two outputs together; under some conditions, one of them will be trying to go high while another is trying to go low, putting a soft short across the power supply. It is ok to let unused outputs float. b) Since it is an up counter, after Q4 resets the counter it never will get to Q5-Q7.
That's me and Eagle CAD, I was connecting Q4 to reset and as I didn't go out one square did it connect all of them. So it's not intended, and I figured it didn't matter much as like you say Q5 will never go high (but it makes no sense having it there so removing)

2. Starting with 3 V, you lose 0.6 V through a transistor and the LED needs around 2 V to light, leaving very little headroom for the current limiting resistor and the fade components. Changing to 3 batteries will make a big difference.
Solid advice, thanks!

3. Also, consider re-arranging the transistors. You have them as emitter followers, pulling the LEDs up from GND. If you change them to saturated switches by connecting the emitters to GND and pulling the LEDs "down" form the 3 V rail, there will be less power loss in the transistors.
Just to make sure I understand (still struggling with terms when it come to electronics): You mean that I'd put the same after the LED and cap? I'll try reading about it as I'm not sure I get it right.

4. Another option is to stay with the emitter follower LED drivers, but move the R-C timing network to the transistor base. Since the base current will be a small percentage of the emitter (LED) current, it should take a smaller capacitor for the same timing.
ak
Hmm, again a bit confused. Do you (or anyone else) have something I could read to understand point 3 and 4? My knowledge is very basic, especially when it comes to transistors which feels a bit like magic black boxes. I kind of see them as relays and anything beyond that is above me

Thanks for the hands on tips and very helpful attitude! I realize I'm one of a gazillion 555-LED-tinkerers out there
 

Thread Starter

jonmol

Joined Mar 27, 2021
5
I'm sure you'll get lots of excellent recommendations for circuit improvements but remember this from software.

Premature optimization is the root of all evil
https://wiki.c2.com/?PrematureOptimization
Haha, very true! But I've also seen people new to software doing something very basic in a super complicated way, just because they aren't aware some curcial of libraries or algorithms. I think I'm more in that category when it comes to electronics than the over tinkering perfectionist
 

DickCappels

Joined Aug 21, 2008
7,261
The 2N706 was a great transistor in its day, but it has low gain that might lead to problems with circuit performance. I recommend 2N2222 if you aren't married to the 2N706.
 

Ian0

Joined Aug 7, 2020
1,883
I don't think you'll notice the fade - 330 ohms and 4.7uF is a time constant of 1.5ms. How about a small MOSFET (BS170, for instance) then you can have a time constant on the gate with much higher value resistors.
 

Thread Starter

jonmol

Joined Mar 27, 2021
5
Been reading around a bit and made a couple of tweaks to the original schematic according to (my understanding of) the comments made:
1616933812715.png

Fixed the base connections to the transistors (now mosfets) as one was wrong.
Replaced the BJT transistors with 2n7000g mosfets
Moved the mosfets so S is connected GND rather than D being connected to Vcc
Changed to 3 AA batteries to have 4.5V to allow for a wider selection of LEDs

Like before the caps and the resistors in the fading parts are not the real values, I haven't yet selected the LEDs, so I don't know the forward voltage and thus not what resistors I need for the voltage drop.

Does this seem like a better solution? I'm thinking that there will be less energy waste by switching to mosfets and having them connected to ground.

I'm not sure I understood what you wrote @Ian0, are you suggesting that I somehow would move the cap to output to G of the mosfet and control the fading via the mosfet rather than directly from the cap?

Bonus question:
I was thinking about the parallel LED and cap for fading and both need a resistor. But with the way I've solved it when the LED2 is powered from Vcc is it going via R4+R5, and thus dropping more than I want, while then with no Vcc It'll only be R5 so I'd assume there will be a bit stronger light at first?

Assuming I have 4.5V and a red 2.0V 20mA LED I would want to have a 125 Ohm resistor. Would this schematic be more appropriate?
1616936246908.png

Assuming I'm understanding things correctly would the LED get 125 ohm both when being powered from Vcc and C7?
125 = ((75+125) * 333) / (75 + 125 + 333) and 125 = (125 * (333 + 75)) / (125 + 333 + 75)
 

ElectricSpidey

Joined Dec 2, 2017
1,564
The problem as I see it with this design is the LED will do nothing until the voltage across the cap reaches the LED's forward voltage and then is very likely to simply snap on rather than fade in. (very short fade up time)

If you want a really nice circuit, you should use Op-Amps set up in follower mode with a divider circuit on the input to keep the output just below the LED's forward voltage. And the LED on the output with a dropping resistor.

Then because of the Op-Amp's high input impedance you can use a much smaller cap for your RC network. (which is placed before the divider)

Follower circuits by default allow much better fade circuits.
 
Last edited:
Top