Help designing a cheap LED dimmer

Thread Starter

-live wire-

Joined Dec 22, 2017
959
What are these components going to be mounted on?
I will solder them in mid-air. Perf-boards, PCBs, etc are overrated.:cool:;)

I actually will just prototype on a breadboard and then figure out the best thing to do from there. I have some spare perfboards that I may use. I may actually have the finished thing be on a mini breadboard because the breadboards have adhesive on the back. This also saves me time soldering.
 

WBahn

Joined Mar 31, 2012
29,979
And you want to use that for a permanent lighting system in your home? You are going to trust those connections to work properly for years?

And how much do these mini-breadboards cost?

Does your time not have any value at all?
 

Thread Starter

-live wire-

Joined Dec 22, 2017
959
It's not just about penny pinching. It's also about learning how to design a circuit, and implement it. The mini-breadboards were very cheap, and mid-air soldering may not be to terrible here. I could then secure it with hot-glue.
 
I will go with the schematic crutshow posted. I went on mouser, found suitable parts, and they totaled at 96 cents per board. That's how I know.
You could replace the 40106 with a 555 and avoid the issues of operating schmitt trigger inverters in parallel. Operating normal (non schmitt) inverters in parallel is one thing but the schmitt trigger means that there will very likely be periods at every transition where the outputs are fighting each other. If my CAD programme hadn't decided to be a difficult !@#$ I'd draw up the circuit but since that is not a simple option... the circuit is very similar to the 40106 circuit from Crutshow with the 555 pins 2 and 6 connected together at the top of the timing cap along with the wiper of the pot. Each outer leg of the pot is connected to pin 3 via a signal diode (in opposite directions as per the Crutshow circuit) and pin 3 can drive the MOSFET gate directly (via a gate resistor a bit bigger than usual maybe, around 1k depending on the MOSFET). Pin 7 of the 555 is unused, pin 5 could have a small cap to ground, maybe 10nF but not strictly necessary and pins 4 and 8 connected together and to Vcc, pin 1 is ground. If somebody with CAD tool access had a moment to decode my description and make it into a circuit.... :) that would be great.

The IRFZ44 is a very high current device for the application. Very much a sledge hammer for a walnut ;) but if that's what's on hand... The only actual problem here with over spec'ing the mosfet is that the input capacitance of the mosfet is quite significant so a 555 output could have trouble driving it at any significant frequency.

On the topic of frequency, why so high? An analogue PWM like this could operate at 100Hz or even less without any human perceptible flicker at all. A lower frequency also lowers switching losses and for these types of analogue PWM circuits helps achieve the full adjustment range right to the extremes of 0% and 100%.
 

ebeowulf17

Joined Aug 12, 2014
3,307
You could replace the 40106 with a 555 and avoid the issues of operating schmitt trigger inverters in parallel. Operating normal (non schmitt) inverters in parallel is one thing but the schmitt trigger means that there will very likely be periods at every transition where the outputs are fighting each other. If my CAD programme hadn't decided to be a difficult !@#$ I'd draw up the circuit but since that is not a simple option... the circuit is very similar to the 40106 circuit from Crutshow with the 555 pins 2 and 6 connected together at the top of the timing cap along with the wiper of the pot. Each outer leg of the pot is connected to pin 3 via a signal diode (in opposite directions as per the Crutshow circuit) and pin 3 can drive the MOSFET gate directly (via a gate resistor a bit bigger than usual maybe, around 1k depending on the MOSFET). Pin 7 of the 555 is unused, pin 5 could have a small cap to ground, maybe 10nF but not strictly necessary and pins 4 and 8 connected together and to Vcc, pin 1 is ground. If somebody with CAD tool access had a moment to decode my description and make it into a circuit.... :) that would be great.

The IRFZ44 is a very high current device for the application. Very much a sledge hammer for a walnut ;) but if that's what's on hand... The only actual problem here with over spec'ing the mosfet is that the input capacitance of the mosfet is quite significant so a 555 output could have trouble driving it at any significant frequency.

On the topic of frequency, why so high? An analogue PWM like this could operate at 100Hz or even less without any human perceptible flicker at all. A lower frequency also lowers switching losses and for these types of analogue PWM circuits helps achieve the full adjustment range right to the extremes of 0% and 100%.
All of the paralleled inputs are being driven by the output of the first trigger (not the RC circuit,) so the transitions should be pretty fast. Do you think shoot through between parallel outputs is significant during the brief time it takes a Schmitt trigger to respond to the near-instantaneous step change from another trigger's output? (That's a real question - I'm not trying to be snarky or combative, I really don't know, but my intuition would've told me it was fine.)
 

crutschow

Joined Mar 14, 2008
34,285
Do you think shoot through between parallel outputs is significant during the brief time it takes a Schmitt trigger to respond to the near-instantaneous step change from another trigger's output?
My feeling is that the Schmitt trigger points are sufficiently matched on a single chip that any shoot-through should not be a problem, certainly not enough to damage the chip in any way.

One thing I didn't show that's needed is a 0.1μF ceramic decoupling cap from the Vdd to common at each CD4106 package.

And PE is right about the PWM frequency. It doesn't need to be that high.
Here's the simulation with a PWM frequency of about 200Hz.

upload_2018-6-22_12-46-22.png

And here's a 555 PWM circuit similar to the one PE described, if you prefer that:

upload_2018-6-22_15-41-28.png
 
Last edited:
My feeling is that the Schmitt trigger points are sufficiently matched on a single chip that any shoot-through should not be a problem, certainly not enough to damage the chip in any way.

One thing I didn't show that's needed is a 0.1μF ceramic decoupling cap from the Vdd to common at each CD4106 package.

And PE is right about the PWM frequency. It doesn't need to be that high.
Here's the simulation with a PWM frequency of about 200Hz.

View attachment 154930

And here's a 555 PWM circuit similar to the one PE described, if you prefer that:

View attachment 154942
Thank you for drawing that up. I envy those with functional CAD tools! ;)
One question though: you have used pin 7 to discharge which I very rarely ever do with a 555. I usually connect the timing resistor to pin 3 which is why I suggested a gate resistor of 1k to isolate the gate capacitance from the timing function (the gate capacitance would otherwise stop pin 3 from changing state as quickly as it might and thereby change the timing, but the resistor will limit the gate current so that pin 3 is free to change state, 2nd order effects notwithstanding).
This is not to say your circuit will not work because it most definitely will work just fine I am sure. At the extreme ends, ie approaching 0% or 100% duty cycle it may work better because it won't have the timing cap slowing down the output transitions.
 
All of the paralleled inputs are being driven by the output of the first trigger (not the RC circuit,) so the transitions should be pretty fast. Do you think shoot through between parallel outputs is significant during the brief time it takes a Schmitt trigger to respond to the near-instantaneous step change from another trigger's output? (That's a real question - I'm not trying to be snarky or combative, I really don't know, but my intuition would've told me it was fine.)
In a non schmitt inverter you basically have an inverting amplifier. class AB with a strong emphasis on A. This is why it is generally not good practice to apply voltages in steady state that are not above Vih or below Vil and some 4000 series mos data sheets will even quote maximum transition times because they don't like the shoot through conduction of the class A buffers.

Taking all that as said, to run amplifiers in parallel (non schmitt) there is some room for variance between the inverters as there is a linear transition range. With schmitt inverters though that advantage is lost and the outputs will drive hard into contention. The 40106 can drive around 20mA into a short at 12V and the power dissipation limit for the output devices is 100mW per transistor or 500mW for the device in totality. 20mA times 12V is 240mW in a single output transistor. I know it is a very short period and being mos they are fairly forgiving of these things but to put together a design you already know violates the data sheet right from the start seems just bad practice to me. My day to day work is commercial so my designs have to work when thousands of them are produced and they have to be reliable to avoid warranty and reputation issues so I have a sensitivity to anything that is or seems to be a bad practice.

Avoiding bad practices in a forum seems a good idea to me as it avoids disappointment for newbies which may be discouraging and generally because it avoids bad practices. This isn't to say my opinion on this topic is absolute. I have what I believe is sound technical reasoning but will always listen to other sound technical reasoning and change my opinion based on that if it makes more sense or shows my reasoning to be wrong. Any reasoning that relies on the argument "always done it this way" will not work. Too many times the people that say that are just unaware of the havoc they wreak in production environments. o_O:)
 
And you want to use that for a permanent lighting system in your home? You are going to trust those connections to work properly for years?

And how much do these mini-breadboards cost?

Does your time not have any value at all?
The man wants to have a go, he wants to learn (admittedly he may be learning his idea for building these is not a great idea, or maybe it is), he may learn more about logistics and practicalities than electronics but those are also important factors in this field.

Those that respond to an OP are not really in a position to judge these things in my opinion, all we can do is offer the advice as sought for the benefit of the OP and other watchers of the thread. Berating an OP will just discourage others from asking a question for fear of being humiliated. I encourage this OP to do as he sees fit and to freely reply with his results without fear and as you have (not so tactfully) pointed out, there may be a lesson less about electronics and more about building stuff for him and others to learn from. All learning is good. Forums are about learning. Forums should be a place of sharing knowledge and encouragement for those who boldly go....

Just my personal philosophy on these things. Please ignore if it perturbs your equanimity. :)
 

WBahn

Joined Mar 31, 2012
29,979
It's not berating -- it's asking questions that are worth consideration that may not have been considered. For instance, the primary (not sole) stated motivation was cost savings -- to the point that saving $10 was stated as being worthwhile because it is money that could be spent elsewhere. So why is it berating to ask questions that let the TS better consider whether they are likely to even save that $10? Or that might let them better consider the durability of their approach for the stated purpose?

Or to stop and think about the possibility that there are conflicting motivations at play? It's fine to do something yourself for the purpose of saving money even if there is no joy or learning to be found in it. It's fine to do something for yourself for the purpose of learning something even if it is going to cost you more time and money than just buying a solution off the shelf. But if you state as your motivations a strong desire to save money and also to learn something, then isn't it worth considering whether, in this case, those might be mutually exclusive goals and thus some thought should be given as to how important achieving both are before proceeding. It's fine if the answer to the question is that it's okay if only the learning happens even if it ends up costing far more, but wouldn't it be a shame to blindly proceed and, only upon looking back, discover that the extra cost would have been better spent learning things another way?
 
Last edited:

ebeowulf17

Joined Aug 12, 2014
3,307
In a non schmitt inverter you basically have an inverting amplifier. class AB with a strong emphasis on A. This is why it is generally not good practice to apply voltages in steady state that are not above Vih or below Vil and some 4000 series mos data sheets will even quote maximum transition times because they don't like the shoot through conduction of the class A buffers.

Taking all that as said, to run amplifiers in parallel (non schmitt) there is some room for variance between the inverters as there is a linear transition range. With schmitt inverters though that advantage is lost and the outputs will drive hard into contention. The 40106 can drive around 20mA into a short at 12V and the power dissipation limit for the output devices is 100mW per transistor or 500mW for the device in totality. 20mA times 12V is 240mW in a single output transistor. I know it is a very short period and being mos they are fairly forgiving of these things but to put together a design you already know violates the data sheet right from the start seems just bad practice to me. My day to day work is commercial so my designs have to work when thousands of them are produced and they have to be reliable to avoid warranty and reputation issues so I have a sensitivity to anything that is or seems to be a bad practice.

Avoiding bad practices in a forum seems a good idea to me as it avoids disappointment for newbies which may be discouraging and generally because it avoids bad practices. This isn't to say my opinion on this topic is absolute. I have what I believe is sound technical reasoning but will always listen to other sound technical reasoning and change my opinion based on that if it makes more sense or shows my reasoning to be wrong. Any reasoning that relies on the argument "always done it this way" will not work. Too many times the people that say that are just unaware of the havoc they wreak in production environments. o_O:)
Thanks for sharing your thought process. Like I said, I'm definitely in no position to argue one way or another on this issue - I just wanted to learn more from you and Crutschow and hear both perspectives. Interesting points raised on both sides, so thanks to you both!
 
It's not berating -- it's asking questions that are worth consideration that may not have been considered. For instance, the primary (not sole) stated motivation was cost savings -- to the point that saving $10 was stated as being worthwhile because it is money that could be spent elsewhere. So why is it berating to ask questions that let the TS better consider whether they are likely to even save that $10? Or that might let them better consider the durability of their approach for the stated purpose?

Or to stop and think about the possibility that there are conflicting motivations at play? It's fine to do something yourself for the purpose of saving money even if there is no joy or learning to be found in it. It's fine to do something for yourself for the purpose of learning something even if it is going to cost you more time and money than just buying a solution off the shelf. But if you state as your motivations a strong desire to save money and also to learn something, then isn't it worth considering whether, in this case, those might be mutually exclusive goals and thus some thought should be given as to how important achieving both are before proceeding. It's fine if the answer to the question is that it's okay if only the learning happens even if it ends up costing far more, but wouldn't it be a shame to blindly proceed and, only upon looking back, discover that the extra cost would have been better spent learning things another way?
Any way you look at it, it is learning and who am I to say $10 is not significant to the OP? To make a statement once is not berating, I agree, but to repeat the statement multiple times as has been done, and to then rephrase the statement as a rhetorical question that implies incredulity I am sorry to say, is in fact bullying especially when the question is posed by a moderator. That is just my opinion on this topic and how it seems to me.
 

WBahn

Joined Mar 31, 2012
29,979
Any way you look at it, it is learning and who am I to say $10 is not significant to the OP? To make a statement once is not berating, I agree, but to repeat the statement multiple times as has been done, and to then rephrase the statement as a rhetorical question that implies incredulity I am sorry to say, is in fact bullying especially when the question is posed by a moderator. That is just my opinion on this topic and how it seems to me.
You missed the point -- the TS indicated that $10 IS significant to them and they were clearly trying to take costs into account down to the penny-scale. That only makes it more relevant to point out things that should be considered that might result not only in them not saving anything, but actually costing them more than the alternative. If nothing else, does that not afford them the opportunity to learn how to better consider costs not taken into account so as to make a better decision (or at least a better-informed decision)?
 
You missed the point -- the TS indicated that $10 IS significant to them and they were clearly trying to take costs into account down to the penny-scale. That only makes it more relevant to point out things that should be considered that might result not only in them not saving anything, but actually costing them more than the alternative. If nothing else, does that not afford them the opportunity to learn how to better consider costs not taken into account so as to make a better decision (or at least a better-informed decision)?
I don't think I did miss the point at all but rather think you have. Your reply to the OP was sarcastic to put it bluntly and you are labouring the point. the point was made, the OP responded and you replied in a sarcastic manner that was unhelpful and appears to me to be designed to humiliate especially given that your point had already been made. I quote:
"Does your time not have any value at all?"
Taken in the context of the thread and your own post, that, mr moderator, is not a nice reply. It is rude, judgemental, sarcastic and clearly designed to humiliate and all because you disagree with the OP's logic about DIY. Logic on a topic that does not need to be sensible in anybody else's reality other than the OP's. It is not a topic that adheres to universal logic nor technical argument and is essentially none of yours nor my business to make any comment on. You are defending the indefensible and refusing to accept responsibility for a disrespectful post you have made and now are wasting everybody's time with this ridiculous argument which is so far off topic as to be ridiculous in itself. Just own the post and apologize to the man and be done with it. Please. Are you man enough to do that?
 
Why does it needs to be so complicated, why not a simple P or Pi regulator?
Two good reasons not to dim LEDs by reducing steady state current:
1. the brightness of an LED is a function of current but one LED to the next the variation in brightness other than at the specified test current for the LED can be huge. So while they look the same at say 20mA (if that is their specified current) at 10mA some may be quite dim while others are still quite bright. The problem gets worse as the current is reduced. Since PWM has the LEDs on and at their specified current only all the LEDs will appear to be the same brightness one to the next irrespective of the brightness setting.
2. the power loss in a PWM controller is a small fraction of that lost in a current regulator for the same purpose.
 
Top