Adjusting the brightness of LEDs. Adjusting the brightness of LEDs Description of the brightness control PWM

LEDs are used in almost all technology around us. True, sometimes it becomes necessary to adjust their brightness (for example, in flashlights or monitors). The easiest way out in this situation seems to be to change the amount of current passed through the LED. But that's not true. The LED is a fairly sensitive component. Constantly changing the amount of current can significantly shorten its life, or even break it. It is also necessary to take into account that you cannot use a limiting resistor, since excess energy will accumulate in it. This is unacceptable when using batteries. Another problem with this approach is that the color of the light will change.

There are two options:

  • PWM regulation
  • Analog

These methods control the current flowing through the LED, but there are certain differences between them.
Analog control changes the level of current that passes through the LEDs. And PWM regulates the frequency of current supply.

PWM regulation

A way out of this situation may be to use pulse width modulation (PWM). With this system, the LEDs receive the necessary current, and the brightness is adjusted by supplying power from high frequency. That is, the frequency of the feeding period changes the brightness of the LEDs.
The undoubted advantage of the PWM system is maintaining the productivity of the LED. The efficiency will be about 90%.

Types of PWM regulation

  • Two-wire. Often used in car lighting systems. The converter's power supply must have a circuit that generates a PWM signal at the DC output.
  • Shunt device. To make the on/off period of the converter use a shunt component that provides a path for the output current other than the LED.

Pulse parameters for PWM

The pulse repetition rate does not change, so there are no requirements for it in determining the brightness of the light. In this case, only the width, or time, of the positive pulse changes.

Pulse frequency

Even taking into account the fact that there are no special complaints about the frequency, there are limit values. They are determined by the sensitivity of the human eye to flickering. For example, in a movie, frames must flash at 24 frames per second for our eyes to perceive it as one moving image.
In order for flickering light to be perceived as uniform light, the frequency must be at least 200 Hz. There are no restrictions on the upper indicators, but there is no way lower.

How does a PWM regulator work?

A transistor key stage is used to directly control the LEDs. Typically, they use transistors that can accumulate large amounts of power.
This is necessary when using LED strips or high-power LEDs.
For small quantities or low power, the use of bipolar transistors is sufficient. You can also connect LEDs directly to microcircuits.

PWM generators

In a PWM system, a microcontroller or a circuit consisting of low-integration circuits can be used as a master oscillator.
It is also possible to create a regulator from microcircuits that are designed for switching power supplies, or K561 logic chips, or NE565 integrated timer.
Craftsmen even use an operational amplifier for these purposes. To do this, a generator is assembled on it, which can be adjusted.
One of the most used circuits is based on the 555 timer. It is essentially a regular square wave generator. The frequency is regulated by capacitor C1. at the output the capacitor must have a high voltage (this is the same with the connection to the positive power supply). And it charges when there is a low voltage at the output. This moment gives rise to pulses of different widths.
Another popular circuit is PWM based on the UC3843 chip. in this case, the switching circuit has been changed towards simplification. In order to control the pulse width, a control voltage of positive polarity is used. In this case, the output produces the desired PWM pulse signal.
The regulating voltage acts on the output as follows: as it decreases, the width increases.

Why PWM?

  • The main advantage of this system is its ease. The usage patterns are very simple and easy to implement.
  • The PWM control system provides a very wide range of brightness adjustment. If we talk about monitors, it is possible to use CCFL backlight, but in this case the brightness can only be reduced by half, since CCFL backlight is very demanding on the amount of current and voltage.
  • Using PWM you can keep the current at a constant level, which means the LEDs will not be damaged and Colorful temperature will not change.

Disadvantages of using PWM

  • Over time, image flicker can become quite noticeable, especially at low brightness or with eye movement.
  • Under constant bright light (such as sunlight), the image may become blurry.

This article describes how to assemble a simple but effective LED brightness control based on PWM brightness control () of LEDs.

LEDs (light emitting diodes) are very sensitive components. If the supply current or voltage exceeds the permissible value, it can lead to their failure or significantly reduce their service life.

Typically, the current is limited using a resistor connected in series to the LED, or by a circuit current regulator (). Increasing the current to the LED increases its glow intensity, and decreasing the current reduces it. One way to regulate the brightness of the glow is to use a variable resistor () to dynamically change the brightness.

But this only applies to a single LED, since even in one batch there may be diodes with different luminescence intensity and this will affect the uneven glow of a group of LEDs.

Pulse width modulation. A much more effective method is to regulate the brightness of the glow by using (PWM). With PWM, groups of LEDs are supplied with the recommended current, and at the same time it becomes possible to dim the brightness by supplying power at a high frequency. Changing the period causes a change in brightness.

The duty cycle can be represented as the ratio of the time of turning on and off the power supplied to the LED. Let’s say, if we consider a cycle of one second and the LED will last 0.1 seconds when it’s off, and 0.9 seconds when it’s on, then it turns out that the glow will be about 90% of the nominal value.

Description of PWM brightness control

The simplest way to achieve this high-frequency switching is with an IC, one of the most common and most versatile ICs ever created. The PWM controller circuit shown below is designed for use as a dimmer to power LEDs (12 volts) or a speed controller for a 12 volt DC motor.

In this circuit, the resistance of the resistors to the LEDs must be selected to provide a forward current of 25 mA. As a result, the total current of the three lines of LEDs will be 75mA. The transistor must be designed for a current of at least 75 mA, but it is better to take it with a reserve.

This dimmer circuit adjusts from 5% to 95%, but by using germanium diodes instead, the range can be extended from 1% to 99% of the nominal value.

There are a large number of different circuit solutions, but in our case we will analyze several PWM options LED brightness control() on the PIC microcontroller.

PIC10F320/322 is an ideal option for designing various dimmers. At the same time, we obtain a fairly sophisticated device with the lowest cost and minimal time spent on construction. Let's look at several dimmer options.

First option. A basic LED brightness control in which the brightness of the LEDs is changed by rotating the variable knob, while the brightness changes from 0 to 100%

The brightness of the LEDs is set by removing the potential from the variable resistor R1. This variable voltage goes to the RA0 input, which functions as an analog input and is connected to the AN2 input of the microcontroller ADC. The PWM pin RA1 controls the power switch on transistor V1.

It is possible to choose an arbitrary power transistor with a logical control level, that is, these are those transistors that, when receiving 1...2 volts to the gate, completely open their channel.

For example, with the IRF7805 transistor it is possible to control a current of up to 13 amperes while meeting the necessary requirements, and under any other conditions up to 5 amperes are guaranteed. Connector CON1 is needed only for in-circuit programming of the microcontroller; for the same purpose, resistances R2 and R5 are also needed, that is, if the microcontroller is programmed, then all these radio elements may not be installed.

Resistance R4 and BAV70 serve to protect against overvoltage and improper connection of the power supply. Capacitors C1 and C2 are ceramic and serve to reduce impulse noise and for reliable operation of the LM75L05 stabilizer.

Second option. Here, the brightness of the LEDs is also controlled by a variable resistor, and switching on and off is done using buttons.

Third option. As you can see, there is no variable resistor in the circuit. In this version, the brightness of the LEDs is controlled exclusively by two buttons. The adjustment is stepwise, the brightness changes with each subsequent press.

Fourth option. Essentially the same as the third option, but when you hold down the button, the LED glow changes smoothly.

In some cases, for example, in flashlights or home lighting devices, it becomes necessary to adjust the brightness of the glow. It would seem that nothing could be simpler: just change the current through the LED, increasing or decreasing . But in this case, a significant part of the energy will be spent on the limiting resistor, which is completely unacceptable when powered independently from batteries or rechargeable batteries.

In addition, the color of the LEDs will change: for example, the white color will have a slightly greenish tint when the current drops below the nominal (for most LEDs 20mA). In some cases, such a change in color is completely unnecessary. Imagine these LEDs illuminating a TV screen or computer monitor.

In these cases it applies PWM - regulation (pulse width). Its meaning is that it periodically lights up and goes out. In this case, the current remains nominal throughout the flash, so the glow spectrum is not distorted. If the LED is white, then green shades will not appear.

In addition, with this method of power regulation, energy losses are minimal, the efficiency of circuits with PWM control is very high, reaching more than 90 percent.

The principle of PWM control is quite simple, and is shown in Figure 1. The different ratio of the time of the lit and extinguished state is perceived by the eye as: like in a movie - separately shown frames are perceived as a moving image. Here everything depends on the frequency of projection, which will be discussed a little later.

Figure 1. Principle of PWM regulation

The figure shows diagrams of the signals at the output of the PWM control device (or master oscillator). Zero and one are designated: a logical one (high level) causes the LED to glow, a logical zero (low level) causes it to go out.

Although everything can be the other way around, since everything depends on the circuit design of the output switch - the LED can be turned on at a low level and turned off at a high level. In this case, physically a logical one will have a low voltage level, and a logical zero will have a high voltage level.

In other words, a logical one causes the activation of some event or process (in our case, the illumination of an LED), and a logical zero should disable this process. That is, the high level at the output of a digital microcircuit is not always a LOGICAL unit, it all depends on how the specific circuit is built. This is just for information. But for now we will assume that the key is controlled at a high level, and it simply cannot be any other way.

Frequency and width of control pulses

It should be noted that the pulse repetition period (or frequency) remains unchanged. But, in general, the pulse frequency does not affect the brightness of the glow, therefore, it does not affect the frequency stability special requirements not presented. Only the duration (WIDTH), in this case, of the positive pulse changes, due to which the entire mechanism of pulse width modulation works.

The duration of control pulses in Figure 1 is expressed in %%. This is the so-called “fill factor” or, in English terminology, DUTY CYCLE. It is expressed as the ratio of the duration of the control pulse to the pulse repetition period.

In Russian terminology it is usually used “duty factor” - the ratio of the repetition period to the pulse time A. Thus, if the fill factor is 50%, then the duty cycle will be equal to 2. There is no fundamental difference here, therefore, you can use any of these values, whichever is more convenient and understandable for you.

Here, of course, we could give formulas for calculating duty cycle and DUTY CYCLE, but in order not to complicate the presentation, we will do without formulas. As a last resort, Ohm's law. There’s nothing you can do about it: “If you don’t know Ohm’s law, stay at home!” If anyone is interested in these formulas, they can always be found on the Internet.

PWM frequency for dimmer

As was said just above, there are no special requirements for the stability of the PWM pulse frequency: well, it “floats” a little, but that’s okay. By the way, PWM regulators have similar frequency instability, which is quite large, which does not interfere with their use in many designs. In this case, it is only important that this frequency does not fall below a certain value.

What should the frequency be, and how unstable can it be? Do not forget that we're talking about about dimmers. In film technology there is a term “critical flicker frequency”. This is the frequency at which individual pictures shown one after another are perceived as a moving image. For the human eye, this frequency is 48Hz.

It is for this reason that the shooting frequency on film was 24 frames/sec (the television standard is 25 frames/sec). To increase this frequency to a critical one, film projectors use a two-bladed shutter (shutter) that twice overlaps each displayed frame.

In amateur narrow-film 8mm projectors, the projection frequency was 16 frames/sec, so the shutter had as many as three blades. The same goals in television are served by the fact that the image is shown in half-frames: first even, and then odd lines of the image. The result is a flicker frequency of 50Hz.

LED operation in PWM mode consists of individual flashes of adjustable duration. In order for these flashes to be perceived by the eye as a continuous glow, their frequency must be no less than the critical one. You can go as high as you like, but you can't go lower. This factor should be taken into account when creating PWM regulators for lamps.

By the way, just like interesting fact: Scientists have somehow determined that the critical frequency for a bee's eye is 800Hz. Therefore, the bee will see the movie on the screen as a sequence of individual images. In order for her to see a moving image, the projection frequency will need to be increased to eight hundred half-frames per second!

To control the LED itself, it is used. Recently, the most widely used for this purpose are those that allow switching significant power (the use of conventional bipolar transistors for these purposes is considered simply indecent).

Such a need (a powerful MOSFET - transistor) arises with a large number of LEDs, for example, with, which will be discussed a little later. If the power is low - when using one or two LEDs, you can use low-power switches, and if possible, connect the LEDs directly to the outputs of the microcircuits.

Figure 2 shows the functional diagram of a PWM regulator. The diagram conventionally shows resistor R2 as a control element. By rotating its knob, you can change the duty cycle of the control pulses, and, consequently, the brightness of the LEDs, within the required limits.

Figure 2. Functional diagram of a PWM regulator

The figure shows three chains of LEDs connected in series with limiting resistors. Approximately the same connection is used in LED strips. The longer the strip, the more LEDs, the greater the current consumption.

It is in these cases that powerful ones will be required, the permissible drain current of which should be slightly greater than the current consumed by the tape. The last requirement is satisfied quite easily: for example, the IRL2505 transistor has a drain current of about 100A, a drain voltage of 55V, while its size and price are quite attractive for use in various designs.

PWM master generators

A microcontroller can be used as a master PWM generator (most often in industrial settings), or a circuit made on low-integration microcircuits. If you plan to make a small number of PWM regulators at home, and there is no experience in creating microcontroller devices, then it is better to make a regulator using what is currently at hand.

These can be logical chips of the K561 series, an integrated timer, as well as specialized chips designed for. In this role, you can even make it work by assembling an adjustable generator on it, but this, perhaps, is “for the love of art.” Therefore, only two circuits will be considered below: the most common one on the 555 timer, and on the UC3843 UPS controller.

Master oscillator circuit based on 555 timer

Figure 3. Master oscillator circuit

This circuit is a conventional square-wave generator, the frequency of which is set by capacitor C1. The capacitor is charged through the circuit “Output - R2 - RP1- C1 - common wire”. In this case, a high level voltage must be present at the output, which means that the output is connected to the positive pole of the power source.

The capacitor is discharged along the circuit “C1 - VD2 - R2 - Output - common wire” at a time when there is a low level voltage at the output - the output is connected to the common wire. It is this difference in the charge and discharge paths of the timing capacitor that ensures the receipt of pulses with an adjustable width.

It should be noted that diodes, even of the same type, have different parameters. In this case, their electrical capacitance plays a role, which changes under the influence of voltage on the diodes. Therefore, along with a change in the duty cycle of the output signal, its frequency also changes.

The main thing is that it does not become less than the critical frequency, which was mentioned just above. Otherwise, instead of a uniform glow with different brightness, individual flashes will be visible.

Approximately (again, the diodes are to blame), the frequency of the generator can be determined by the formula shown below.

PWM generator frequency on timer 555.

If you substitute the capacitance of the capacitor in farads and the resistance in Ohms into the formula, then the result should be in hertz Hz: there is no escape from the SI system! This assumes that the variable resistor RP1 slider is in the middle position (in the RP1/2 formula), which corresponds to a square wave output signal. In Figure 2, this is exactly the part where the pulse duration is 50%, which is equivalent to a signal with a duty cycle of 2.

Master PWM generator on UC3843 chip

Its diagram is shown in Figure 4.

Figure 4. Circuit of the PWM master oscillator on the UC3843 chip

The UC3843 chip is a PWM controller for switching power supplies and is used, for example, in ATX format computer sources. In this case, the typical scheme for its inclusion has been slightly changed towards simplification. To control the width of the output pulse, a control voltage of positive polarity is applied to the input of the circuit, and a pulse PWM signal is obtained at the output.

In the simplest case, the control voltage can be applied using a variable resistor with a resistance of 22...100KOhm. If necessary, the control voltage can be obtained, for example, from an analog light sensor made on a photoresistor: the darker it is outside the window, the brighter it is in the room.

The regulating voltage affects the PWM output in such a way that when it decreases, the width of the output pulse increases, which is not at all surprising. After all, the original purpose of the UC3843 microcircuit is to stabilize the voltage of the power supply: if the output voltage drops, and with it the regulating voltage, then measures must be taken (increase the output pulse width) to slightly increase the output voltage.

The regulating voltage in power supplies is generated, as a rule, using zener diodes. Most often this or similar ones.

With the component ratings indicated in the diagram, the frequency of the generator is about 1 KHz, and unlike the generator on the 555 timer, it does not “float” when the duty cycle of the output signal changes - concern for the constancy of the frequency of switching power supplies.

To regulate significant power, for example, an LED strip, a key stage on a MOSFET transistor should be connected to the output, as shown in Figure 2.

We could talk more about PWM regulators, but let’s stop there for now, and in the next article we’ll look at different ways to connect LEDs. After all, not all methods are equally good, there are some that should be avoided, and there are simply a lot of mistakes when connecting LEDs.

If you skip the details and explanations, the circuit for adjusting the brightness of the LEDs will appear in its simplest form. This control is different from the PWM method, which we will look at a little later.
So, an elementary regulator will include only four elements:

  • power unit;
  • stabilizer;
  • variable resistor;
  • directly the light bulb.

Both the resistor and the stabilizer can be purchased at any radio store. They are connected exactly as shown in the diagram. Differences may lie in the individual parameters of each element and in the method of connecting the stabilizer and resistor (with wires or soldering directly).

Having assembled such a circuit with your own hands in a few minutes, you can make sure that by changing the resistance, that is, by rotating the resistor knob, you will adjust the brightness of the lamp.

In an illustrative example, the battery is taken at 12 Volts, the resistor is 1 kOhm, and the stabilizer is used on the most common Lm317 microcircuit. The good thing about the circuit is that it helps us take our first steps in radio electronics. This is an analog way to control brightness. However, it is not suitable for devices that require finer adjustments.

The need for brightness controls

Now let’s look at the question in a little more detail, find out why brightness adjustment is needed, and how you can control the brightness of LEDs differently.

  • The most famous case where a dimmer for multiple LEDs is needed is in residential lighting. We are used to controlling the brightness of the light: making it softer in the evening, turning it on at full power while working, highlighting individual objects and areas of the room.
  • It is also necessary to adjust brightness in more complex devices, such as TV and laptop monitors. Car headlights and flashlights cannot do without it.
  • Adjusting the brightness allows us to save electricity when we are talking about powerful consumers.
  • Knowing the adjustment rules, you can create automatic or remote control of the light, which is very convenient.

In some devices, it is not possible to simply reduce the current value by increasing the resistance, since this may lead to a change in the white color to greenish. In addition, an increase in resistance leads to an undesirable increase in heat generation.

The way out of a seemingly difficult situation was PWM control (pulse width modulation). Current is supplied to the LED in pulses. Moreover, its value is either zero or nominal - the most optimal for glow. It turns out that the LED periodically lights up and then goes out. The longer the glow time, the brighter it seems to us that the lamp shines. The shorter the glow time, the dimmer the light bulb shines. This is the principle of PWM.

You can control bright LEDs and LED strips directly using powerful MOS transistors or, as they are also called, MOSFETs. If you need to control one or two low-power LED light bulbs, then ordinary bipolar transistors are used as keys or the LEDs are connected directly to the outputs of the microcircuit.

By rotating the rheostat knob R2, we will adjust the brightness of the LEDs. Presented here LED strips(3 pcs.), which were connected to one power source.

Knowing the theory, you can assemble a PWM device circuit yourself, without resorting to ready-made stabilizers and dimmers. For example, such as is offered on the Internet.

NE555 is a pulse generator in which all timing characteristics are stable. IRFZ44N is the same powerful transistor capable of driving high power loads. The capacitors set the pulse frequency, and the load is connected to the “output” terminals.

Since the LED has low inertia, that is, it lights up and goes out very quickly, the PWM control method is optimal for it.

Ready-to-use dimmers

The regulator, which is sold ready-made for LED lamps, are called a dimmer. The frequency of the pulses created by them is high enough so that we do not feel flickering. Thanks to the PWM controller, smooth adjustment is possible, allowing you to achieve maximum brightness or dimming of the lamp.

By installing such a dimmer into the wall, you can use it like a regular switch. For exceptional convenience, the LED brightness control can be controlled by a radio remote control.

The ability of lamps based on LEDs to change their brightness opens up great opportunities for holding light shows and creating beautiful street lighting. Yes and ordinary flashlight It becomes much more convenient to use if it is possible to regulate the intensity of its glow.