Wide pulse modulation. Pulse width modulation

Pulse width modulation consists in changing the width (duration) of the pulses following each other with a constant frequency. Pulse-width modulation (PWM) - approximation of the desired signal (multi-level or continuous) with a real binary (with two levels - on / off), so that on average, over a period of time, their values ​​are equal ... The main regulating factor is the relative pulse duration or duty cycle.

,

where T is the pulse repetition period. With one-way PWM, the reference voltage is a periodic sawtooth waveform. In this case, modulation is performed by changing the position of only one edge of the pulse. For bi-directional PWM, a triangular (preferably equilateral) reference voltage is required. Two-sided PWM has a higher speed than one-sided, so it is used more often. If the input signal is bipolar, then the polarity and average value of the output voltage should be reversed. In this case, two types of modulation are possible: bipolar PWM and unipolar PWM.

1. Statement of the assignment

In this term paper a pulse-width modulator with the following parameters is being developed:

Table 1. Contents of the task

2. Development of a functional diagram of the device

Let's consider the functional diagram and the principle of operation of the device.



Figure 1 - Functional diagram

The generator of rectangular pulses is required to generate pulses on the next block - CLAY.

Based on the assignment, we determine that "triangles" should be used as the reference voltage. At the output of CLAY we have triangular pulses, which are the very reference voltage supplied to the comparator.

Comparator device, the negative input of which is supplied with a reference signal in the form of triangles, and the positive input is a modulated continuous analog signal.

By assignment, the modulated signal is a sinusoid with a frequency of 200 Hz.

Also, according to the assignment, the amplitude of the output signals should be 10V. The required amplitude is provided by an electronic key.


3. Functional blocks

3.1 Square wave generator

Quartz generator - a generator of oscillations synthesized by a quartz resonator, which is part of the generator. Usually has a low power output.

External stress on a quartz plate causes its deformation. And it, in turn, leads to the appearance of charges on the quartz surface (piezoelectric effect). As a result, the mechanical vibrations of the quartz plate are accompanied by vibrations synchronous with them. electric charge on its surface and vice versa.

To ensure the connection of the resonator with the rest of the circuit elements, electrodes are applied directly to the quartz, or the quartz plate is placed between the capacitor plates.

We use the Pierce Generator. The circuit uses a minimum of components: one digital inverter, one resistor, two capacitors, and a quartz crystal that acts as a highly selective filter element.

A generator with an RC frequency-driving circuit, the principle of its operation is based on the process of charging and discharging capacitor C through a resistor R. Through this resistor, OOS is carried out in direct current, and through a capacitor-PIC in alternating current.

The second inverter in the generator circuit is designed to reduce the duration of the edges of the formed rectangular wave. This is necessary to reduce the effect of the subsequent circuit on the stability of the oscillation of the master oscillator, as well as for more reliable operation of the digital counters of the frequency divider.


Figure 2 - Block 1. Rectangular voltage generator

Frequency divider circuit to the value of the desired frequency. To implement the divider, a 561IE16 microcircuit is required.

3.2 Voltage ramp generator

This block is a delta voltage generator. Currently, generators with a low nonlinearity coefficient (ε<0,0) и слабым влиянием нагрузки на форму выходного напряжения создаются с использованием операционных усилителей.

In particular, generators based on an integrator controlled by an input voltage pulse are widespread. rectangular... The elements of the circuit are a power supply, a charging resistor R 6, a capacitor C3 and a discharge transistor VT1. The output voltage of the generator is the voltage across the capacitor, amplified by the operational amplifier. The op-amp is covered by negative (R 5 and R 9) and positive (resistor R 10) feedbacks.

Figure 3 - CLAY

The generator works as follows. At the moment when the field-effect transistor VT1 is closed, the capacitor C3 is charged through the resistors R10 and R7. As soon as we apply a pulse to VT1, the capacitor discharges this field-effect transistor.

3.3 Comparator

This block is a comparator, the essence of which is to compare two incoming signals and receive pulses of different durations at the output. A reference signal is applied to the negative input, i.e. "Triangular pulses", and on the positive - the modulated continuous analog signal itself. The pulse frequency corresponds to the frequency of the triangular pulses. That part of the period, which the input signal is higher than the reference, the output is one, below - zero.

Figure 4 - Comparator

3.4 Electronic key

To obtain pulses of the required amplitude at the output, we use the transistor VT2 and the element "NAND" DD5. Resistor R13 limits the current to the base input of the transistor. Resistor R15 is a load.

Figure 5 - Diagram of an electronic key

4. Calculated part and selection of circuit elements

4.1 Calculation of the pulse generator

Figure 6 shows a generator consisting of an active element, an inverter, and a passive element, a quartz resonator.

Figure 6 - Crystal oscillator

Any odd number of inverters can be installed instead of one inverter.

Figure 7 - Equivalent equivalent circuit

The equivalent circuit of a quartz resonator is shown in Figure 7.

The Pierce generator is one of the most popular schemes. It is the basis of almost all single-valve generators. Quartz behaves like a large inductance since it is connected in parallel. The role of the load on the output of the resonator is played by the capacitors C1 and C2. Capacitors C1 and C2 act as the load capacitance of the quartz resonator.

As a resonator, we select a quartz resonator: KX-49, the nominal frequency of which is 2.4576 MHz. Table 2 shows the parameters of the quartz resonator.

Table 2 KX-49 Parameters

C L R 1 C 0 F
30pF 200 Ohm 7pF 2.4576 MHz

Resistor R1 is designed to automatically start the generator when the power is turned on. The same element determines the gain of the inverter, and the greater this gain, the more rectangular oscillations will be formed at its output, and this, in turn, will lead to a decrease in the current consumed by the quartz generator. Let's choose the value of the resistor R1 equal to 1MΩ.

Resistor R2 increases the impedance of the circuit in order to increase the phase shift together with capacitor C2. This is necessary in order for the generator to work at the desired, and not at a higher frequency. The resistor also isolates the inverter output from the resonator circuit and thus maintains a rectangular pulse shape. The resistor value should be approximately equal to the load impedance Z L, which can be calculated using the formula given:




Pulses with a frequency of f = 2.4576 MHz are fed to the IE16 counter, from the Q7 output of the counter we receive pulses with a frequency of f / 256 = 9.6 kHz.

4.2 Calculation of a voltage ramp generator

The circuit in Figure 5 is selected as the ramp voltage generator.

The GLIN under consideration is made on the basis of a voltage integrator (DD2, RC-circuit, power supply U1) controlled by a square-wave generator and power supply U1. When the transistor is off, an uncontrolled (initial) drain current flows through it. When the transistor is open, the current through the transistor must be determined by the value of the load resistance and the supply voltage.

When the linearly varying voltage Uc (t) at the output of the integrator reaches the trigger voltage, a control signal is applied, under which the key transistor VT1 opens, discharging the capacitor. Then the process is repeated with a period:

We set the frequency to 9.6 kHz.

It is advisable to choose the minimum voltage Ucm in order to exclude the influence of the spread in the parameters of the resistors used on the nonlinearity coefficient of the generated voltage.

The maximum voltage across the capacitor is related to the duration of the dependence


t

Choose U1 = 5V, U2 = 0V, then Ucm = 5V.

We choose R 6 = R 5 = 10 kΩ, then C 3 = 96nF.

Based on the following, we find R9.

Uout = 10 V, then: R 9 = Ucmax * R 6 / Uout = 5 * 10000 / 10≈ 2 kΩ, we take the closest one at face value

R 9 = R 10 = 2 kΩ

140UD7 is selected as OU DD3. Power supply ± 10V.

4.3 Comparator selection

521CA3 is used as a comparator DD4 to ensure stable PWM operation.

Technical characteristics of the analog comparator 521CA3

Analog LM111 Input current no more than 100 nA Gain not less than 200000 Load current up to 50 mA Power supply +5 ... + 30 or ± 3 ... ± 15 V

Areas of use

Zero crossing detectors Surge detectors Pulse width modulators Precision rectifiers Analog to digital converters

Resistor R12 in combination with diodes D1 and D2 limits the input swing. Thanks to the diodes, we limit the input voltage swing to values ​​of -12.6 V to +12.6 V, the condition is that the negative input voltage should not reach the breakdown voltage (for example, for a diode of the type KD510A this value is - 50 V).

Table 3 Parameters of the selected transistor

Name U arr. ,IN I pr. Max, A I arr. max, μA F d max, kHz
KD510A 50 0.2 5 200000

4.4 Electronic key calculation

The following scheme is selected as the key:

Figure 9 - Diagram of an electronic key

Rn = 0.5 to Ohm, Uout = 10V.

Ik = Uout / Rn = 10/500 = 50mA

According to the reference book, we are looking for a transistor that will withstand a given collector current (0.05A). The KT315A transistor holds a constant current up to 0.1 A.

From the reference book - h21e, for KT315A

We consider the base current Ib = Ik / h21e = 0.05 / 30≈ 1.67 mA, the base must be supplied with a current of at least 167 μA.

R14 is the matching resistance between the comparator DD3 and the transistor VT2. Let's choose R16 = 200 ohms.

R out = R 15 = 500 Ohm on request, from the row we choose 510 Ohm. at the output it is necessary to obtain 10 V, then we calculate the value of the resistor R 14

(U pit -U out) / R 14 = U out / R 15,

from where R 14 = 2R 15/10 = 102 Ohm, from the standard series we choose the nominal 100 Ohm. Power dissipation 10W * 1.25mA≈0.0125W

Table 4. Parameters of the selected transistor KT315A


5. Simulation of the circuit

Output signal from the triangular pulse generator:

Output signal from the square-wave generator:



Simulated signal:



Modulation process:






Output signal period:



Smallest pulse duration:



The duration should be equal to 5.12 μs. The graph shows that it is 5.56 µs.

Longest pulse duration:



The pulse duration should be 97.37μs. The graph shows that it is equal to 97.74 μs.

Conclusion

In this course work, a schematic diagram was developed and a calculation of the Pulse Width Modulator circuit was performed. A sinusoid with a frequency of 200 Hz is fed to the input of the PWM device, at the output we have a converted PWM signal, the amplitude of which is 10 V. The range of variation of the relative duration of the output pulses of this PWM is - 0.05 ÷ 0.95. The developed pulse-width modulator is quite simple. The circuit was simulated using the CircuitMaker package.

List of used literature

1. Altshuller G.B., Elfimov N.N., Shakulin V.G. Quartz Resonators: A Reference Guide. M.: Radio and communication, 1984.-232s., Ill.

2. Horwitz P., Hill W. The art of circuitry: Per. from English - Ed. sixth. M .: Mir, 2001.

3. Lecture course on ECiMS (teacher Andreev IB).

4. Digital CMOS microcircuits, reference book, ON Partala. - St. Petersburg: Science and Technology, 2001. - 400 pages with ill.

5. L. Labutin, Quartz Resonators. - Radio, 1975, No. 3.

6. Generators of rectangular pulses on CMOS microcircuits. V. Strizhov, Circuitry, 2000, No. 2, p. 28

7. Zabrodin Yu.S., Industrial electronics: textbook for universities. - M .: Higher. School, 1982. - 496s., Ill.

  • 1.4. Thyristors
  • 1.4.1. The principle of operation of the thyristor
  • 1.4.2. Static current-voltage characteristics of the thyristor
  • 1.4.3. Thyristor dynamic characteristics
  • 1.4.4. Types of thyristors
  • 1.4.5. Lockable thyristors
  • 2. Electronic key management schemes
  • 2.1. General information about control schemes
  • 2.2. Control pulse generators
  • 2.3. Power transistor control drivers
  • 3. Passive components and coolers of power electronic devices
  • 3.1. Electromagnetic components
  • 3.1.1. Hysteresis
  • 3.1.2. Losses in the magnetic circuit
  • 3.1.3. Magnetic flux resistance
  • 3.1.4. Modern magnetic materials
  • 3.1.5. Losses in windings
  • 3.2. Power electronics capacitors
  • 3.2.1. Mku family capacitors
  • 3.2.2. Aluminum electrolytic capacitors
  • 3.2.3. Tantalum capacitors
  • 3.2.4. Film capacitors
  • 3.2.5. Ceramic capacitors
  • 3.3. Heat dissipation in power electronic devices
  • 3.3.1. Thermal modes of operation of power electronic switches
  • 3.3.2. Cooling of power electronic keys
  • 4. Principles of control of power electronic keys
  • 4.1. General information
  • 4.2. Phase control
  • 4.3. Pulse modulation
  • 4.4. Microprocessor control systems
  • 5. Converters and voltage regulators
  • 5.1. The main types of devices for converting technology. The main types of power electronics devices are symbolically depicted in Fig. 5.1.
  • 5.2. Three-phase rectifiers
  • 5.3. Equivalent polyphase circuits
  • 5.4. Controlled rectifiers
  • 5.5. Features of the semi-controlled rectifier
  • 5.6. Switching processes in rectifiers
  • 6. Switching converters and voltage regulators
  • 6.1. Switching voltage regulator
  • 6.1.1. Pulse regulator with pwm
  • 6.1.2. Pulse Key Regulator
  • 6.2. Choke based switching regulators
  • 6.2.2. Step-up converter
  • 6.2.3. Inverting converter
  • 6.3. Other types of converters
  • 7. Inverters of frequency converters
  • 7.1. General information
  • 7.2. Voltage inverters
  • 7.2.1. Standalone single phase inverters
  • 7.2.2. Single Phase Half Bridge Voltage Inverters
  • 7.3. Three-phase stand-alone inverters
  • 8. Pulse-width modulation in converters
  • 8.1. General information
  • 8.2. Traditional PWM Methods in Offline Inverters
  • 8.2.1. Voltage inverters
  • 8.2.2. Three Phase Voltage Inverter
  • 8.3. Current inverters
  • 8.4. Space vector modulation
  • 8.5. Modulation in AC and DC converters
  • 8.5.1. Inverting
  • 8.5.2. Straightening
  • 9. Converters with network switching
  • 10. Frequency converters
  • 10.1. Direct coupled transmitter
  • 10.2. Intermediate link converters
  • 10.3.1. Two-transformer circuit
  • 10.3.3. Cascade converter circuit
  • 11. Resonant transducers
  • 11.2. Resonant circuit converters
  • 11.2.1. Converters with series connection of resonant circuit elements and load
  • 11.2.2. Parallel load converters
  • 11.3. Inverters with parallel-series resonant circuit
  • 11.4. Class e converters
  • 11.5. Zero voltage switching inverters
  • 12. Standards for indicators of the quality of electrical energy
  • 12.1. General information
  • 12.2. Power factor and efficiency of rectifiers
  • 12.3. Improving the power factor of controlled rectifiers
  • 12.4. Power factor corrector
  • 13. AC voltage regulators
  • 13.1. Thyristor AC Voltage Regulators
  • 13.2. Transistor AC Voltage Regulators
  • Questions for self-control
  • 14. New methods of fluorescent lamp control
  • Questions for self-control
  • Conclusion
  • Bibliographic list
  • 620144, Yekaterinburg, Kuibysheva, 30
  • 8. Pulse-width modulation in converters

    8.1. General information

    The principles of pulse control and modulation are discussed in Ch. 4 using the example of the simplest DC regulator circuit. At the same time, definitions are given of the main types of pulse modulation used in the theory of linear pulse systems, which correspond to the practice of controlling pulse DC converters.

    However, pulse-width modulation of voltages or currents in AC converters has a slightly different definition in power electronics, taking into account the features of PWM when solving problems of converting electricity to AC. According to the definition of IEC 551-16-30, pulse width modulation is a pulse control in which the width or frequency of the pulses, or both, are modulated within the period of the fundamental frequency in order to create a specific waveform of the output voltage. In most cases, PWM is carried out in order to ensure sinusoidal voltage or current, that is, to reduce the level of higher harmonics relative to the fundamental (first) harmonic, and is called sinusoidal. There are the following main methods of ensuring sinusoidality: analog PWM and its modifications; selective (selective) suppression of higher harmonics; hysteresis or delta modulation;

    space vector modulation.

    The classic variant of the organization of analog sinusoidal PWM is to change the width of the pulses that form the output voltage (current) by comparing a voltage signal of a given shape, called a reference or reference, with a triangular voltage signal having a higher frequency and called a carrier signal. The reference signal is modulating and determines the required output voltage (current) waveform. There are many modifications of this method in which the baseband signals are represented by special functions other than a sinusoid. In the lecture notes, several basic schemes will be considered that explain these PWM methods.

    The method of selective suppression of higher harmonics is currently successfully implemented by means of microprocessor controllers based on software. Hysteresis modulation is based on the principle of relay "tracking" of a reference signal, for example a sinusoidal waveform. In its simplest technical implementation, this method combines the principles of PWM and PFM (Pulse Frequency Modulation). However, by means of special circuitry measures, it is possible to stabilize the modulation frequency or limit the range of its change.

    The space vector modulation method is based on converting a three-phase voltage system to a two-phase one and obtaining a generalized space vector. The magnitude of this vector is calculated at moments determined by the fundamental and modulating frequencies. It is considered very promising for controlling three-phase inverters, in particular when used in an electric drive. At the same time, it is very similar to traditional sinusoidal PWM.

    PWM-based control systems make it possible not only to provide a sinusoidal form of the averaged values ​​of the fundamental voltage or current harmonic, but also to control the values ​​of its amplitude, frequency and phase. Since in these cases fully controllable switches are used in the converter, it becomes possible to implement the operation of alternating (direct) current converters together with the alternating current network in all four quadrants in both rectification and inversion modes with any given value of the power factor of the fundamental harmonic cosφ in range from -1 to 1. Moreover, with an increase in the carrier frequency, the possibilities of reproducing the current and voltage of the given form at the output of the inverters expand. This allows active filters to be created to suppress higher harmonics.

    The main definitions used in the further presentation, we will consider using the example of the application of the first method in a single-phase semi-bridge circuit of a voltage inverter (Fig. 8.1, but). In this conditional schema, the keys S1 and S2 are represented by fully controllable switching elements, supplemented by diodes connected in series and in parallel with them. Series diodes reflect the unidirectional conductance of switches (for example, transistors or thyristors), while parallel diodes provide the conductance of reverse currents with an active-inductive load.

    Reference, modulating diagrams u M (θ) and carrier u H (θ) signals are shown in Fig. 8.1, b... Formation of key control impulses S 1 and S 2 is carried out according to the following principle. At u M (θ)> u H (θ) key S 1 is on, a S 2 switched off. At u M (θ)< u H (θ) the states of the keys are reversed: S 2 - enabled, a S 1 - disabled. Thus, a voltage is generated at the output of the inverter in the form of two polar pulses. In real circuits, to exclude the simultaneous conduction of keys S 1 and S 2, a certain delay should be provided between the moments of formation of signals to turn on these switches. Obviously, the pulse width depends on the ratio of signal amplitudes u M (θ) and u H (θ). The parameter characterizing this ratio is called the amplitude modulation index and is determined by the formula (8.1):

    , (8.1.)

    where U M m and U H m - maximum values ​​of the modulating signal u M (θ) and carrier signal u H (θ), respectively.



    Rice. 8.1. Single Phase Semi Bridge Voltage Inverter: but- scheme; b- voltage diagrams for pulse modulation

    Carrier frequency u H (θ) is equal to the switching frequency f H keys S 1 and S 2 and is usually much higher than the baseband frequency f M. Frequency ratio f H and f M is an important indicator of the efficiency of the modulation process and is called the frequency modulation index, which is determined by the formula (8.2):

    For small values M f signals u M (θ) and u H (θ) must be synchronized to avoid unwanted subharmonics. B as maximum value My, which determines the need for synchronization, is set M f = 21. It is obvious that with synchronized signals and the coefficient M f is constant.

    From the diagram in fig. 8.1 it can be seen that the amplitude of the first harmonic of the output voltage U am 1, taking into account (8.1), can be represented in the following form (8.3):

    (8.3)

    According to (8.3), for M a = 1 the amplitude of the first harmonic of the output voltage is equal to the height of the half-wave rectangle U d / 2. A typical dependence of the relative value of the first harmonic of the output voltage on the value of M a is shown in Fig. 8.2, which shows that the change M a from 0 to 1 linearly and depends on the amplitude U am 1. Limit value M a is determined by the principle of the considered type of modulation, according to which the maximum value U am 1 is limited by the height of the rectangular half-wave equal to U d / 2. With a further increase in the coefficient M a modulation leads to a nonlinear increase in the amplitude U am 1 to the maximum value determined by the formation of a rectangular voltage at the output of the inverter, which subsequently remains unchanged.

    Expansion of a rectangular function in a Fourier series gives the maximum value (8.4):

    (8.4)

    This value is limited by the value of the index M a, varying in the range from 0 to about 3. It is obvious that the function on the interval a-b values 1 to 3.2 is non-linear (Figure 8.2). The mode of operation in this area is called over-modulation.

    Meaning M f determined by the choice of the carrier frequency u H (θ) and significantly affects the technical characteristics of the converter. With an increase in frequency, switching losses in the power switches of converters increase, but at the same time, the spectral composition of the output voltage improves and the solution of the problem of filtering higher harmonics caused by the modulation process becomes simpler. An important factor in the choice of value f H in many cases is the need to ensure its value in the audio frequency range of more than 20 kHz. When choosing f H should also take into account the level of operating voltages of the converter, its power and other parameters.


    Rice. 8.2. Dependence of the relative value of the amplitude of the fundamental harmonic of the output voltage on the amplitude modulation index for a single-phase half-bridge circuit

    The general trend here is an increase in the values ​​of M f converters of low power and low voltage and vice versa. So the choice M f is a multi-criteria optimization problem.

    Pulse modulation with stochastic process... The use of PWM in converters is associated with the appearance of higher harmonics in modulated voltages and currents. In this case, in the spectral composition of these parameters, the most significant harmonics appear at frequencies that are multiples of the frequency modulation index M f and harmonics with decreasing amplitudes grouped around them at side frequencies. Higher harmonics can cause the following main problems:

      the occurrence of acoustic noise;

      deterioration of electromagnetic compatibility (EMC) with other electrical devices or systems.

    The main sources of acoustic noise are electromagnetic components (chokes and transformers), which are affected by current and voltage containing higher harmonics with frequencies in the audio range. It should be noted that noise can occur at certain frequencies where higher harmonics are at their maximum. Noise-causing factors, such as magnetostriction, complicate the resolution of the EMC problem. EMC problems can occur over a wide frequency range, depending on the criticality to the level of electromagnetic interference of electrical devices. Traditionally, design and technological solutions have been used to reduce the noise level, and passive filters have been used to ensure EMC.

    Methods associated with a change in the nature of the spectral composition of modulated voltages and currents are considered as a promising direction for solving these problems. The essence of these methods is to flatten the frequency spectrum and reduce the amplitude of pronounced harmonics due to their stochastic distribution in a wide frequency range. This technique is sometimes referred to as “smearing” the frequency spectrum. The concentration of interference energy is reduced at frequencies where harmonics can be greatest. The implementation of these methods is not associated with the impact on the components of the power section of the converters and in most cases is limited to software with a slight change in the control system.

    Let's briefly consider the principles of implementing these methods. PWM is based on a change in the duty cycle γ = t and / T n, where t and is the pulse duration; T n- the period of its formation. Usually these values, as well as the position of the pulse in the period interval T n are constant in steady state conditions. PWM results are defined as integral averaged values. In this case, the deterministic values ​​of t and and, including the position of the pulse, cause an unfavorable spectral composition of the modulated parameters. If these values ​​are given a random character while maintaining a given value of γ, then the processes become stochastic and the spectral composition of the modulated parameters changes. For example, such a random character can be given to the position of the impulse t and on the interval of the period T n or provide a stochastic change in the latter. For this purpose, a random number generator can be used acting on the master oscillator of the modulation frequency f n =1/T n... Similarly, you can change the position of the pulse in the interval T n with a mathematical expectation of zero. The averaged integral value γ must remain at the level set by the control system, as a result of which the alignment of the spectral composition of the higher harmonics in the modulated voltages and currents will be realized.

    Questions for self-control

    1. List the main PWM methods to provide sinusoidal current or voltage.

    2. What is the difference between unipolar voltage modulation and bipolar voltage modulation?

    3. List the main parameters of the PWM.

    4.What is the purpose of using PWM with stochastic processes?

    Dear microproger, we will talk with you to the utmost simple language:

    Imagine an electrical pulse A with a voltage amplitude from 0V to 5V, a length of 1 ms and a repetition period of 10 ms (i.e., within 1 ms, the voltage on the line through which the pulse A passes is 5V, then within 9ms it is 0V, and so repeats every 10 ms). Now let's imagine that we increase the duration pulse A up to 2ms (let it now be pulse B), and it repeats exactly the same every 10ms. A task pulse width changes And from 1 ms to pulse B 2 ms is PWM task.

    Generally speaking, the word "Modulation" means change oscillation parameters (frequency, amplitude, phase). Pulse width modulationchange in duty cycle pulses at a constant frequency. The duty cycle is the same as the length, i.e. in our example, this is a change in the pulse width from 1ms to 2ms.

    PWM regulator. Example

    PWM regulator

    PWM operation the regulator is clearly displayed in this picture-graph.

    We see three signals on the chart. Signals modulated by PWM ohm that generates and regulates the duty cycle impulses.

    The duty cycle on the chart above is 15%. That is, for one period equal to 100%, 15% of the time, a logical unit is issued (TTL voltage level + 3V or + 5V). 75% of the time, a logical zero is output (no voltage in the line - 0V).

    On the average graph, the duty cycle is 50% - 50% of the time, a logical 1 is issued, 50% is a logical 0.

    On the graph below, the duty cycle is 90%. 90% -1. 100.

    If you connect the LED to ours, then in the case of the first graph, the LED will glow dimly. With graph 2, the LED will glow brighter than with 1, but the LED itself will glow at 50% of its power. In the case of the 3rd graph, the brightness of the LED will be adjusted to 90%, close to the maximum.

    As you can see, using PWM it is very convenient to adjust the brightness of the LED, as well as the operation of the stepper motor.

    Practical value of PWM

    Once again I remembered our impulses A and B. They run along the wire to the consumer of electric current and represent an electric current with a certain voltage (Volts) and a certain strength (Amperes), which depends on the consumer. Consumers generally eat a fixed current (for example 300mA). That is, if pulse A or B lasted all 10ms and was not interrupted, then the current consumption for the consumer would be exactly 300mA. If we interrupt the current with a pulse duration, then the current consumption with an active pulse A will be 300mA * (1/10) = 30mA, with a pulse B 300mA * (2/10) = 60mA.

    PWM generators used in control tasks LED lamps... Everything is extremely simple: the more current we supply to the LED, the brighter it glows. The same with RGB LEDs - we apply to the red (R) pulse A (30mA), to the blue pulse B (60mA), to green 0 - we get dim purple light, which is obtained from less bright red and brighter blue colors.

    PWM is applied in problems of control of rotating motors - than more current we apply to the contacts of the engine, the faster it rotates. And if we have three motors, and in addition we have a bunch of ideas and a whole program for sequentially applying impulses of type A and B to their windings? Here you can put together a whole 3D printer!

    PWM controller

    For microproger understanding of the essence of the phrase “ PWM controller“, It is enough to understand general purpose the reference frequency and methods of issuing a sequence of logical zeros and ones on one leg of the microcircuit.

    Let's say we have a microcontroller or FPGA and all the same rotating engine, which at a constant current of 5V consumes 300mA and with this consumption rotates its axis 10 times per second. Now we have been asked to make it so that I press the button, and the engine makes 5 revolutions at a frequency of 1 revolution per second, then makes 2 more revolutions in 1 second and turns off.

    LCHM FM (PM) SCM AMn FMn KAM ChMn GMSK
    OFDM COFDM TCM AIM DM PCM ΣΔ PWM CHIM FIM FHSS DSSS CSS

    Graph illustrating the use of a three-level PWM for motor control, which is used in variable frequency asynchronous motor drives. The voltage from the PWM modulator applied to the machine winding is shown in blue (V). The magnetic flux in the stator of the machine is shown in red (B). Here, the magnetic flux has an approximately sinusoidal shape, due to the corresponding PWM law.

    Pulse width modulation(PWM, eng. pulse-width modulation (PWM)) is the process of controlling the power supplied to the load by changing the duty cycle of the pulses, at a constant frequency. Distinguish analog PWM and digital PWM, binary (two-level) PWM and ternary (three-level) PWM .

    Reasons for the spread of PWM

    The main reason for using PWM is the desire to increase efficiency in the construction of electronic equipment and in other nodes, for example, PWM is used to adjust the brightness of the backlight of LCD monitors and displays in phones, PDAs, etc.

    Thermal power dissipated on the key during PWM

    In PWM, it uses transistors as key elements (other semiconductor devices can also be used) not in a linear mode, but in a key mode, that is, the transistor is either open (off) or closed (in a state of saturation) all the time. In the first case, the transistor has almost infinite resistance, so the current in the circuit is very small, and although the entire supply voltage drops across the transistor, the power released on the transistor is practically zero. In the second case, the resistance of the transistor is extremely small, and, therefore, the voltage drop across it is close to zero - the power released is also small. In transient states (transition of a switch from a conducting state to a non-conducting state and vice versa), the power released in the switch is significant, but since the duration of the transition states is extremely short in relation to the modulation period, the average switching loss power turns out to be insignificant.

    1. R t r → ∞ ↔ P = U 2 R → 0 (\ displaystyle R_ (tr) \ rightarrow \ infty \ leftrightarrow P = ((\ frac ((U) ^ (2)) (R)) \ rightarrow 0))

    2. R t r → 0 ↔ P = I 2 R → 0 (\ displaystyle R_ (tr) \ rightarrow 0 \ leftrightarrow P = (I) ^ (2) R \ rightarrow 0)

    How PWM works

    Analog PWM

    Analog PWM is implemented using a comparator, one input of which is fed with a triangular or sawtooth periodic signal from an auxiliary generator, and the other with a modulating signal. At the output of the comparator, periodic rectangular pulses with variable width, the duty cycle of which changes according to the law of the modulating signal, and the frequency is equal to the frequency of the triangular or sawtooth signal and is usually constant.

    Analog PWM is used in low frequency amplifiers of class " D».

    Digital PWM

    In binary digital technology, the outputs of which can only take one of two values, the PWM approximation of the desired average output level is completely natural. The circuit is just as simple: a sawtooth signal is generated N-bit counter. Digital devices(CSIP) operate at a fixed frequency, usually much higher than the response of controlled installations ( oversampling). In the periods between clock pulse edges, the output of the CSIP remains stable, it is affected by either a low level or a high level, depending on the output of the digital comparator, which compares the value of the counter with the level of the approximated one. digital signal V(n). Exit for many clock cycles can be interpreted as a sequence of pulses with two possible values ​​0 and 1, replacing each other every clock T... The frequency of occurrence of single pulses is obtained proportional to the level of the approaching signal ~ V(n). The units following one after the other form the outline of one, wider impulse. The duration of the received pulses of variable width ~ V(n) are multiples of the clock period T, and the frequency is 1 / ( T*2 N). Low frequency means long, relatively T, periods of constancy of the signal of the same level, which gives a low uniformity of pulse distribution.

    The described digital generation circuit falls under the definition of one-bit (two-level) pulse-code modulation ( ICM). 1-bit PCM can be thought of in PWM terms as a train of 1 / T and width 0 or T... The available oversampling allows to achieve averaging in a shorter period of time. High quality is possessed by such a kind of one-bit PCM as pulse-density modulation ( pulse density modulation), which is also called pulse-frequency modulation.

    A continuous analog signal is recovered by arithmetic averaging of pulses over many periods using a simple filter low frequencies... Although this is usually not even required, since the electromechanical components of the drive have inductance, and the control object (OA) - inertia, the pulses from the PWM output are smoothed out and the OA, with a sufficient frequency of the PWM signal, behaves as when controlling a conventional analog signal.

    In digital PWM, the period is divided into parts that are filled with rectangular subpulses. The average value over the period depends on the number of rectangular pulses. Digital PWM - binary signal approximation (with two levels - incl/off) to a multilevel or continuous signal so that their average values ​​over a period of time t 2 -t 1 would be approximately equal.

    Formally, it can be written like this:

    ∫ t 1 t 2 x (t) dtt 2 - t 1 = ∑ i = 1 n A ∗ 4 T it 2 - t 1, (\ displaystyle (\ int _ (t1) ^ (t2) (x (t) \ , dt) \ over (t2-t1)) = (\ sum _ (i = 1) ^ (n) (A * (\ mathcal (4)) T_ (i)) \ over (t2-t1)),)

    where x(t) - input signal ranging from t 1 before t 2 and ∆ T i = t 2 - t 1 n (\ displaystyle (\ frac (t2-t1) (n)))- duration i -th PWM podpulse, each with an amplitude A. n is chosen in such a way that for the period the difference between the total areas (energies) of both quantities is less than the permissible one:

    ∫ t 1 t 2 x (t) d t - ∑ i = 1 n A ∗ 4 T i< E {\displaystyle \int _{t1}^{t2}{x(t)\,dt}-\sum _{i=1}^{n}{A*{\mathcal {4}}T_{i}} .

    The controlled "levels" are usually the power supply parameters of the power plant, for example, the voltage of the pulse converters / DC voltage regulators / or the speed of the electric motor. For impulse sources x Links

    You will need

    • Arduino;
    • Light-emitting diode;
    • resistor with a resistance of 200 ohms;
    • computer.

    1 General information about pulse width modulation

    Arduino digital pins can only output two values: logic 0 (LOW) and logic 1 (HIGH). That's why they are digital. But Arduino has "special" conclusions, which are indicated PWM... They are sometimes denoted with a wavy line "~" or circled or somehow distinguished from others. PWM stands for Pulse-width modulation or pulse width modulation, PWM.

    A pulse width modulated signal is a pulse signal of constant frequency but variable duty cycle(the ratio of the pulse duration and the period of its repetition). Due to the fact that most physical processes in nature have inertia, sharp voltage drops from 1 to 0 will be smoothed out, taking some average value. By setting the duty cycle, you can change the average voltage at the PWM output.

    If the duty cycle is 100%, then all the time at the digital output of the Arduino there will be a logic voltage of "1" or 5 volts. If you set the duty cycle to 50%, then half of the output time will be logic "1", and half - logic "0", and the average voltage will be 2.5 volts. And so on.



    In the program, the duty cycle is set not as a percentage, but as a number from 0 to 255. For example, the command analogWrite (10, 64) will tell the microcontroller to send a signal with a duty cycle of 25% to digital PWM output # 10.

    Arduino pins with pulse width modulation function operate at a frequency of about 500 Hz. This means that the pulse repetition period is about 2 milliseconds, which is measured by the green vertical strokes in the figure.

    It turns out that we can simulate an analog signal at the digital output! Interesting, right ?!

    How can we use PWM? There are a lot of applications! For example, control the brightness of an LED, motor speed, transistor current, sound from a piezo emitter, etc. ...

    2 Demonstration diagram pulse width modulation in arduino

    Let's take a look at the most basic example - controlling the brightness of an LED using PWM. Let's put together a classic scheme.



    3 Example sketch with PWM

    Let's open the "Fade" sketch from the examples: File Samples 01.Basics Fade.



    Let's change it a little and load it into the Arduino memory.

    Int ledPin = 3; // declare the pin that controls the LED int brightness = 0; // variable for setting the brightness int fadeAmount = 5; // step of changing the brightness void setup () ( pinMode (ledPin, OUTPUT); } void loop () ( analogWrite (ledPin, brightness); // set the brightness brightness on the ledPin output brightness + = fadeAmount; // change the brightness value / * when reaching the limits 0 or 255 change the direction of brightness change * / if (brightness == 0 || == 255) (fadeAmount = -fadeAmount; // change the step sign) delay (30); // delay for more visibility of the effect }

    4 LED brightness control using PWM and Arduino

    We turn on the power. The LED gradually increases in brightness, and then gradually decreases. We have simulated an analog signal at the digital output using pulse width modulation.