PWM generator with voltage controlled duty cycle. Pulse width modulation (PWM). PWM master generators

I needed to make a speed controller for the propeller. To blow away the smoke from the soldering iron and ventilate the face. Well, just for fun, pack everything into a minimum price. The easiest way low power engine DC, of course, to regulate with a variable resistor, but to find a reduction for such a small value, and even the required power, it takes a lot of effort, and it will obviously not cost ten rubles. Therefore, our choice is PWM + MOSFET.

I took the key IRF630. Why this one MOSFET? Yes, I just got about ten of them from somewhere. So I use it, so I can install something smaller and low-power. Because the current here is unlikely to be more than an ampere, but IRF630 capable of pulling through itself under 9A. But it will be possible to make a whole cascade of fans by connecting them to one fan - enough power :)

Now it's time to think about what we will do PWM. The thought immediately suggests itself - a microcontroller. Take some Tiny12 and do it on it. I threw this thought away instantly.

  1. I feel bad about spending such a valuable and expensive part on some kind of fan. I'll find a more interesting task for the microcontroller
  2. Writing more software for this is doubly frustrating.
  3. The supply voltage there is 12 volts, lowering it to power the MK to 5 volts is generally lazy
  4. IRF630 will not open from 5 volts, so you would also have to install a transistor here so that it supplies a high potential to the field gate. Fuck it.
What remains is the analog circuit. Well, that’s not bad either. It doesn’t require any adjustment, we’re not making a high-precision device. The details are also minimal. You just need to figure out what to do.

Op amps can be discarded outright. The fact is that for general-purpose op-amps, already after 8-10 kHz, as a rule, output voltage limit it begins to collapse sharply, and we need to jerk the fieldman. Moreover, at a supersonic frequency, so as not to squeak.


Op-amps without such a drawback cost so much that with this money you can buy a dozen of the coolest microcontrollers. Into the furnace!

Comparators remain; they do not have the ability of an op-amp to smoothly change the output voltage; they can only compare two voltages and close the output transistor based on the results of the comparison, but they do it quickly and without blocking the characteristics. I rummaged through the bottom of the barrel and couldn’t find any comparators. Ambush! More precisely it was LM339, but it was in a large case, and my religion does not allow me to solder a microcircuit for more than 8 legs for such a simple task. It was also a shame to drag myself to the storehouse. What to do?

And then I remembered such a wonderful thing as analog timer - NE555. It is a kind of generator where you can use a combination of resistors and a capacitor to set the frequency, as well as the duration of the pulse and pause. How many different craps have been made on this timer over its more than thirty-year history... Until now, this microcircuit, despite its venerable age, is printed in millions of copies and is available in almost every warehouse for a price of a few rubles. For example, in our country it costs about 5 rubles. I rummaged through the bottom of the barrel and found a couple of pieces. ABOUT! Let's stir things up right now.


How does this work
If you don’t delve deeply into the structure of the 555 timer, it’s not difficult. Roughly speaking, the timer monitors the voltage on capacitor C1, which it removes from the output THR(THRESHOLD - threshold). As soon as it reaches the maximum (the condenser is charged), the internal transistor opens. Which closes the output DIS(DISCHARGE - discharge) to ground. At the same time, at the exit OUT a logical zero appears. The capacitor begins to discharge through DIS and when the voltage on it becomes zero (full discharge), the system will switch to the opposite state - at output 1, the transistor is closed. The capacitor begins to charge again and everything repeats again.
The charge of capacitor C1 follows the path: “ R4->upper shoulder R1 ->D2", and the discharge along the way: D1 -> lower arm R1 -> DIS. When we turn the variable resistor R1, we change the ratio of the resistances of the upper and lower arms. Which, accordingly, changes the ratio of the pulse length to the pause.
The frequency is set mainly by capacitor C1 and also depends slightly on the value of resistance R1.
Resistor R3 provides a pull-up of the output to high level- so there is an open collector output. Which is not able to independently set a high level.

You can install any diodes, the conductors are approximately the same value, deviations within one order of magnitude do not particularly affect the quality of work. At 4.7 nanofarads set in C1, for example, the frequency drops to 18 kHz, but it is almost inaudible, apparently my hearing is no longer perfect :(

I dug into the bins, which itself calculates the operating parameters of the NE555 timer and assembled a circuit from there, for astable mode with a fill factor of less than 50%, and screwed in a variable resistor instead of R1 and R2, with which I changed the duty cycle of the output signal. You just need to pay attention to the fact that the DIS output (DISCHARGE) is via the internal timer key connected to ground, so it could not be connected directly to the potentiometer, because when twisting the regulator to its extreme position, this pin would land on Vcc. And when the transistor opens, there will be a natural short circuit and the timer with a beautiful zilch will emit magic smoke, on which, as you know, all electronics work. As soon as the smoke leaves the chip, it stops working. That's it. Therefore, we take and add another resistor for one kilo-ohm. It won’t make a difference in regulation, but it will protect against burnout.

No sooner said than done. I etched the board and soldered the components:

Everything is simple from below.
Here I am attaching a signet, in the native Sprint Layout -

And this is the voltage on the engine. Apparently small transition process. You need to place the conduit in parallel at half a microfarad and it will smooth it out.

As you can see, the frequency floats - this is understandable, since our operating frequency depends on the resistors and capacitor, and since they change, the frequency floats, but this does not matter. Throughout the entire control range, it never enters the audible range. And the entire structure cost 35 rubles, not counting the body. So - Profit!

A good definition of pulse width modulation (PWM) is in its name itself. This means modulating (changing) the pulse width (not the frequency). To better understand what is PWM, let's look at some highlights first.

Microcontrollers are intelligent digital components that operate on the basis of binary signals. The best representation of a binary signal is a square wave (a signal having a rectangular shape). The following diagram explains the basic terms associated with square wave.

In a PWM signal, time (period), and therefore frequency, is always a constant value. Only the on-time and off-time of the pulse (duty factor) change. Using this modulation method, we can obtain the voltage we need.

The only difference between a square wave and a PWM signal is that a square wave has equal and constant on and off times (50% duty cycle), while a PWM signal has a variable duty cycle.

A square wave can be considered as a special case of a PWM signal that has a 50% duty cycle (on period = off period).

Let's look at the example of using PWM

Let's say we have a supply voltage of 50 volts and we need to power some load that operates at 40 volts. In this case good way getting 40V from 50V is to use a so-called step-down chopper (chopper).

The PWM signal generated by the chopper is supplied to the power unit of the circuit (thyristor, field-effect transistor), which in turn controls the load. This PWM signal can be easily generated by a microcontroller having a timer.

Requirements for a PWM signal to obtain 40V from 50V using a thyristor: power supply for a time = 400 ms and turn off for a time = 100 ms (taking into account the PWM signal period equal to 500 ms).

In general terms, this can be easily explained as follows: basically, a thyristor acts as a switch. The load receives supply voltage from the source through a thyristor. When the thyristor is in the off state, the load is not connected to the source, and when the thyristor is in the on state, the load is connected to the source.

This process of turning the thyristor on and off is carried out using a PWM signal.

The ratio of the period of a PWM signal to its duration is called the duty cycle of the signal, and the inverse of the duty cycle is called the duty cycle.

If the duty cycle is 100, then in this case we have a constant signal.

Thus, the duty cycle (duty cycle) can be calculated using the following formula:

Using the above formulas, we can calculate the turn-on time of the thyristor to obtain the voltage we need.

By multiplying the duty cycle of the pulses by 100, we can represent this as a percentage. Thus, the percentage of pulse duty cycle is directly proportional to the voltage value from the original one. In the above example, if we want to get 40 volts from a 50 volt power supply, then this can be achieved by generating a signal with a duty cycle of 80%. Because 80% of 50 instead of 40.

To consolidate the material, let's solve the following problem:

  • Let's calculate the duration of switching on and off of a signal having a frequency of 50 Hz and a duty cycle of 60%.

The resulting PWM wave will look like this:

One of best examples An application of pulse width modulation is the use of PWM to adjust the speed of the motor or the brightness of the LED.

This technique of changing the pulse width to obtain the required duty cycle is called “pulse width modulation.”

When working with many different technologies, the question is often: how to manage the power that is available? What to do if it needs to be lowered or raised? The answer to these questions is a PWM regulator. What is he? Where is it used? And how to assemble such a device yourself?

What is pulse width modulation?

Without clarifying the meaning of this term, it makes no sense to continue. So, pulse-width modulation is a process of controlling the power that is supplied to the load, carried out by modifying the duty cycle of the pulses, which is done when constant frequency. There are several types of pulse width modulation:

1. Analog.

2. Digital.

3. Binary (two-level).

4. Trinity (three-level).

What is a PWM regulator?

Now that we know what pulse width modulation is, we can talk about the main topic of the article. A PWM regulator is used to regulate the supply voltage and to prevent powerful inertial loads in automobiles and motorcycles. This may sound complicated and is best explained with an example. Let's say you need to make the interior lighting lamps change their brightness not immediately, but gradually. The same applies to side lights, car headlights or fans. This desire can be realized by installing transistor regulator voltage (parametric or compensation). But with a large current, it will generate extremely high power and will require the installation of additional large radiators or an addition in the form of a system forced cooling using a small fan removed from computer device. As you can see, this path entails many consequences that will need to be overcome.

The real salvation from this situation was the PWM regulator, which operates on powerful field-effect power transistors. They can switch high currents (up to 160 Amps) with only 12-15V gate voltage. It should be noted that the resistance of an open transistor is quite low, and thanks to this, the level of power dissipation can be significantly reduced. To create your own PWM regulator, you will need a control circuit that can provide a voltage difference between the source and gate within the range of 12-15V. If this cannot be achieved, the channel resistance will greatly increase and the power dissipation will increase significantly. And this, in turn, can cause the transistor to overheat and fail.

A whole range of microcircuits are produced for PWM regulators that can withstand an increase in input voltage to a level of 25-30V, despite the fact that the power supply will be only 7-14V. This will allow the output transistor to be turned on in the circuit along with the common drain. This, in turn, is necessary to connect a load with a common minus. Examples include the following samples: L9610, L9611, U6080B ... U6084B. Most loads do not draw more than 10 amps of current, so they cannot cause voltage sags. And as a result, you can use simple circuits without modification in the form of an additional unit that will increase the voltage. And it is precisely these samples of PWM regulators that will be discussed in the article. They can be built on the basis of an asymmetrical or standby multivibrator. It’s worth talking about the PWM engine speed controller. More on this later.

Scheme No. 1

This PWM controller circuit was assembled using CMOS chip inverters. She is a generator rectangular pulses, which operates on 2 logical elements. Thanks to the diodes, the time constant of discharge and charge of the frequency-setting capacitor changes separately here. This allows you to change the duty cycle of the output pulses, and as a result, the value of the effective voltage that is present at the load. In this circuit, it is possible to use any inverting CMOS elements, as well as NOR and AND. Examples include K176PU2, K561LN1, K561LA7, K561LE5. You can use other types, but before that you will have to think carefully about how to correctly group their inputs so that they can perform the assigned functionality. The advantages of the scheme are the accessibility and simplicity of the elements. Disadvantages - difficulty (almost impossibility) of modification and imperfection regarding changing the output voltage range.

Scheme No. 2

Possesses best characteristics than the first sample, but more difficult to implement. Can regulate the effective load voltage in the range of 0-12V, to which it changes from an initial value of 8-12V. Maximum current depends on type field effect transistor and can reach significant values. Considering that the output voltage is proportional to the input control, this diagram can be used as part of a control system (to maintain temperature levels).

Reasons for the spread

What attracts car enthusiasts to a PWM controller? It should be noted that there is a desire to increase efficiency when constructing secondary electronic equipment. Thanks to this property, this technology can also be found in the manufacture of computer monitors, displays in phones, laptops, tablets and similar equipment, and not just in cars. It should also be noted that this technology is significantly inexpensive when used. Also, if you decide not to buy, but to assemble a PWM controller yourself, you can save money when improving your own car.

Conclusion

Well, you now know what a PWM power regulator is, how it works, and you can even assemble similar devices yourself. Therefore, if you want to experiment with the capabilities of your car, there is only one thing to say about this - do it. Moreover, you can not only use the diagrams presented here, but also significantly modify them if you have the appropriate knowledge and experience. But even if everything doesn’t work out the first time, you can gain a very valuable thing - experience. Who knows where it might come in handy next and how important its presence will be.

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. Constant change 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 powerful LEDs.
For small quantities or low power, using bipolar transistors. 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 for these purposes operational amplifier. 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 should have high voltage(this is the same with a connection to a 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 gives very wide range 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 the color temperature will not change.

Disadvantages of using PWM

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

The simplest generator of pulse-width signals.

The main purpose of the PWM Generator program is to generate pulse width modulation signals in real time. These tones are generated based on specified values ​​of frequency (in Hertz), duty cycle - the ratio of time between low and high states of the signal (in percent), and amplitude - the level of the digital signal (in dBFS). All of the above parameters can be instantly changed during operation. The maximum possible signal level generated is 0 dBFS, and the highest frequency is half the sampling frequency. A whole menu of output characteristics is provided to configure the sound generation to the optimal level of quality. There is the ability to change the number and size of internal data buffers, sampling frequency and quantization.

The software can be used to create control tones for various electrical and electromechanical devices. In particular, the resulting PWM signal taken from the output of the sound card personal computer and passed through a standard audio amplifier, it is used to control motors, fans, and lighting devices.

PWM Generator supports working with several sound cards, and you can select the one that will be used to output the desired signal (by default, the program works with the output device specified in the Windows Control Panel). It is worth noting that the working PWM signal can be saved as a WAV file and later listened to using standard software. And if you regularly use certain tones, the PWM signal generator makes it possible to save (and load) them as presets. Additionally, several presets come with the app.

PWM Generator supports the option of synchronizing all running instances of the program, allowing you to generate several tones at once. It should be noted that the software can run in the background, allowing users to switch attention to other applications. In addition, PWM Generator can be controlled using script commands, as well as through Windows Messaging systems.
The authors report that the faster the workstation, the higher the audio quality and responsiveness of the controls when playing tones.

The application in question was written by employees of the German company Esser Audio. This organization is engaged in the creation and distribution of software products (, etc.), intended mainly for testing and testing audio equipment. Programs from Esser Audio are distinguished by good functionality and an extremely simple interface.

The PWM Generator program is shareware, the trial version allows you to freely launch and test the application during the first thirty days. The cost of the program for countries outside the European Union is 14 euros, for those within the European Union - 16.66 euros (due to the addition of sales tax). A discount is provided when purchasing multiple licenses.

The application is distributed in English and German languages. Help file contains detailed description all software features, and an online help forum was created to provide additional support to users of the software package. There is no Russian version of PWM Generator yet.

The latest version of the software works on any computer with 32- or 64-bit operating system Microsoft Windows (9x, NT, 2000, 2003, XP, Vista, 7, 8) and sound card.

Program distribution: shareware 14 euros. There is a trial version (30 days)

If you find an error, please select a piece of text and press Ctrl+Enter.