Let's build a fully analog PWM LED dimmer on four operational amplifiers and learn what PWM is used for and what it actually is.
As most of us already know, the brightness of the LED depends on the current flowing through it, while the voltage on the LED stays nearly the same when the current changes.
To set the current, in the simplest case with a constant supply voltage, one includes a resistor in series with the LED.
Then, the voltage of the power supply will be equal to the sum of the operating voltage of the LED, which can be considered constant, and the voltage drops across the resistor.
According to Ohm's law, the voltage drop across a resistor is its resistance times the current.
According to the Joule-Lenz law, the DC power equals the voltage times the current.
Suppose we have a powerful white LED with an operating voltage of 3 volts and an operating current of 1 ampere. And we power it from a source with a voltage of 4 volts.
In this case, at a current of 1 A, we have a 1-ohm resistor. It drops 1 volt and generates 1 watt of heat. This is quite high power; a high-power resistor would be needed.
The LED gets 3 watts out of a total power consumption of 4 watts. The efficiency of such a flashlight is 3/4 = 75%, not considering the energy lost to heat the LED or the internal resistance of the battery.
If one takes a 2-ohm resistor, the voltage drop across it will remain at 1 volt because 4 volts of power supply minus 3 volts for the LED equals 1 volt.
The current, in this case, will be 0.5 amperes, the power consumption of the LED will be 1.5 watts, and the losses on the resistor will be 0.5 watts.
The efficiency remains the same. It is equal to the ratio of the operating voltage of the LED to the supply voltage.
To adjust the LED current, one can use a potentiometer. But a variable resistor with a power rating of 1 watt is quite a rare thing. To change the brightness of the LED with a low-power potentiometer, we can use a transistor-based current source.
Let's hook up a high-power transistor into the circuit with a common collector called an emitter repeater. The voltage across the current-limiting shunt will equal the voltage across the base minus the Ube of the transistor.
The voltage Ube between the base and emitter can be considered a constant value. It can be in the range of 0.6 to 0.8 volts, and basically, it can be equated to the forward voltage drop across a silicon diode. After all, the two P-N junctions of the transistor are essentially diodes.
Considering the Ube of the transistor Q1 is equal to the forward drop on the diode D2 and equal to 0.65 volts, the voltage across the series-connected R2 and RV1 will be 4 minus 0.65 = 3.35 volts. The current, through their total resistance of 335 ohms, will equal 10 milliamperes.
Let's say that the current gain of our transistor is greater than 400. Then, at a collector current of 1A, the base current will be less than 2.5 milliamps. For the sake of simplicity, we'll neglect this current. However, it is a quarter of 10 mA current through potentiometer RV1 and limiting resistor R2.
Because we have compensated Ube by the drop across diode D2, the emitter follower works so that the voltage across shunt R1 will equal the voltage between anode D2 and brush RV1.
In the lowest position of RV1 in the diagram, the voltage across the shunt and, consequently, the emitter current of the transistor and the LED current will be zero.
In the top-most position, the voltage will be 3350 × 15 / (320 + 15) = 150 millivolts. In this case, the current through R1 with a resistance of 150 milliohms will equal 1 ampere. So, we got ourselves a smooth adjustment of the LED brightness with a low-power potentiometer and a powerful transistor.
The heat generation of RV1 will be 150 mV × 10 mA = 1.5 milliwatts.
If we consider the base current of the transistor equal to 2.5 mA, then R2 should have a voltage drop of 3.2 V at a current of 12.5 mA instead of 10 mA. This means the resistance of R2 should be 3200 / 12.5 = 256 ohms.
The scheme I have drawn up is good for illustration purposes rather than practical application. There is too much instability and dependence on the parameters of specific components.
There is a probability that the LED current will exceed its rating of 1 ampere and burn out. Or vice versa, the current and, therefore, the brightness will be too low. And we have not accounted for the fact that as the battery discharges, its voltage drops, especially under load.
In the past, electronic DIY devices and even mass-manufactured ones had to be tuned by hand-picking compatible components before packaging them for sale, just like this circuit. That's because electronic components were expensive, inaccurate, and unstable.
Today, components are much more advanced and affordable, and they can be used to create a circuit that is stable and doesn't require meddling.
To eliminate the need to consider the base-emitter voltage of the transistor, let's use an operational amplifier.
An ideal operational amplifier is described by two statements. First, its input impedance is huge, and virtually no current flows through its inputs.
Second, an operational amplifier will set the output voltage such that the voltages at the inverting and non-inverting inputs are equal. (Through a feedback loop from the output to the inverting input.)
Here, the operational amplifier is connected as a voltage follower. And it is not an emitter follower but a full-fledged follower. The voltage on the shunt R1 will go to the inverting input and is thus almost precisely (with a difference of no more than 3 millivolts, most often about 300 microvolts) equal to the voltage on the non-inverting input, which is set by the knob of the potentiometer RV1.
The precision voltage reference TL431 is used to stabilize the voltage on the potentiometer. The voltage at the cathode U2, and consequently at the divider R3 RV1, is 2.5 volts. Of this, the potentiometer gets 1/25 = 100 millivolts.
That means we can adjust the voltage at the 100 milliohm shunt R1 from 0 to 100 millivolts, and thus the current from 0 to 1 amp.
Congratulations! We have built an LED brightness regulator with a stabilized current that does not depend on the supply voltage, i.e., the battery charge percentage.
The efficiency of the transistor regulator is still the ratio of the LED operating voltage to the supply voltage. In this case, the same 75%, minus tiny losses to power auxiliary circuits.
At maximum operating current on the current limiting resistor (shunt), it dissipates just 0.1 watts of heat. In contrast, on the transistor (which is easy to equip with a heat sink), it dissipates the remaining 0.9 watts.
If only we had a current stabilizer with a pulse energy converter, as in the post about a boost LED driver, we could significantly increase the efficiency!
The pulse stabilizer's shunt resistance can be even more minor—tens or even single milliohms. The resistance of the MOSFET in an open state can be the same.
On the other hand, other energy losses characteristic of pulse converters are added, mainly for remagnetizing the core of the inductor coil and for the ESR of the output electrolytic capacitor. So we need a good coil and a good cap.
Pulse width modulation, which is also used in switching power supplies, does not regulate the current amplitude. Instead, it interrupts the current several hundred, thousand, or more times per second.
By interrupting the current, electrical charge and power are reduced compared to the always-on state. At the same time, the transistor is operating in key mode, so the voltage drops across, and the heat losses are minimal.
This is one of many advantages of PWM over linear control. The microcontroller needs a digital-to-analog converter (DAC) to output the control voltage. And it is much easier for the microcontroller to output the time intervals that define the on and off states and to generate pulses to turn on the transistor.
When adjusting the brightness of LEDs, PWM may have a disadvantage: flickering can be heavy on the eyes, cause fatigue, and, in industrial environments, even lead to fatal accidents.
This can happen due to the stroboscopic effect; rotating machinery parts may appear slower, stationary, or spinning in the opposite direction. Together with flicker fatigue, this can create a dangerous premise.
Therefore, the questions of the overall quality of LED lighting, its energy and cost efficiency, and the extension of the service life of LEDs remain open.
PWM is most often implemented on special analog IC controllers as well as on microcontrollers using digital counters and timers. And today, we will look closely at and test a classic circuit on three operational amplifiers (plus one buffer).
A relaxation oscillator, or multivibrator, is assembled on U1A and U1B. Its feature is that the timing capacitor C1 is included in the negative feedback loop of the operational amplifier U1B. Because of this, the voltage at the output of U1B varies linearly, and we have an almost perfect triangular waveform.
U1A is used as a comparator with hysteresis (a positive feedback loop through resistor R9). The voltage at the inverting input is always zero because it is connected to the circuit ground. (Note that the power supply is bipolar: +12 and -12 volts.) This is uncommon for real LED dimmers, but a board we have is for educational experiments.
When a positive voltage appears at the non-inverting input U1A, the comparator output switches to the high logic level state (plus supply minus the voltage drop across the chip's output transistors).
Conversely, when the voltage at the non-inverting input U1A becomes negative, the comparator switches to a low logic level state.
Resistor R8 and two counter-sequential Zener diodes, D1 and D2, form a simple parametric voltage-limiting stabilizer. It is +6 volts at the high level and -6 volts at the low level.
This is how rectangular pulses of a given amplitude with a frequency of 859 hertz and a duty cycle of exactly 50% are obtained because the circuit is symmetrical: the time-delay capacitor is charged and then discharged through the same circuit, and the absolute value of the positive voltage is equal to the absolute value of the negative voltage.
Accordingly, the triangular waveform is also wholly symmetrical. The oscilloscope shows a fill factor of 50%.
U2A is used simply as a voltage repeater buffer, and strictly speaking, it is optional because operational amplifiers have a high input impedance.
U2B is a PWM comparator. It will switch high when the instantaneous value of the triangular waveform voltage from U1B is lower than the voltage set by potentiometer RV1. In this way, the potentiometer adjusts the fill factor.
Note that when the duty cycle is low, the voltage at the output of U2B does not reach its maximum. This is because the edges of the pulses are not exactly vertical. The output voltage rises, and falls are not instant. An operational amplifier has a slew rate parameter, and the LM358 has a rather low one.
Next, a push-pull amplifier with three transistors is connected, and the signal from its output controls the stage on transistor Q4, which interrupts the LED current. In the video, we can see how it all works.
Thanks for your attention!
Hi! I'm Kevin! I am a very curious engineer :))
I'm the website founder and author of many posts.
I invite you to follow exciting experiments, research, and challenges.
Let's go on to new knowledge and adventures!