Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using an astable multivibrator as a PWM controller.

Techmaster31415

New Member
Hi guys, could you please help me with some doubts about PWM control? How can an astable multivibrator be adapted or used to generate PWM signals? What modifications are needed to control the duty cycle of the output waveform? Without affecting the frequency? I have been reading about the free-running frequency of an astable multivibrator and trying to implement the PWM control using a basic astable multivibrator as shown in the article Free Running Frequency of Astable Multivibrator. It's been clear how to calculate the frequency of an astable multivibrator. But what still I'm not sure about is the duty cycle control. I mean if I change the value of any one timing resistor it will change the duty cycle. But it will also change the frequency. Also won't be able to get 0-100% duty cycle control. Please help. Thank you.
 
A fixed f triangle into a variable threshold comparator gives you 0 to 100% using the Vpp range.


If you want or need 0.1% to 99.9% PWM , that's a little harder.

So all you need is a Triangle Generator and a comparator
 
Learn to use GPT

How can an astable multivibrator be adapted or used to generate PWM signals?

An astable multivibrator can be adapted to generate Pulse Width Modulation (PWM) signals by incorporating a method to control the duty cycle of its output waveform. Here’s how you can do it:

Basic Astable Multivibrator Overview​

An astable multivibrator is an oscillator circuit that generates a continuous square wave without requiring any external triggering. It typically consists of two transistors, two capacitors, and a few resistors. The frequency and duty cycle of the output waveform are determined by the values of these components.

Generating PWM Signals​

To generate PWM signals, you need to vary the duty cycle while keeping the frequency constant. This can be achieved by modifying the charging and discharging times of the capacitors in the multivibrator circuit. Here are some methods to achieve this:

  • 1. Using a 555 Timer IC in Astable Mode​

  • A common and practical approach is to use a 555 timer IC in astable mode. The 555 timer can be configured to generate a PWM signal by adjusting the duty cycle. Here’s how you can set it up:

  • Basic Configuration:
    • Connect the 555 timer in astable mode with two resistors (R1 and R2) and a capacitor (C) as per the standard configuration.
  • Control Voltage (Pin 5):
    • The duty cycle can be modulated by applying a control voltage to pin 5 (Control Voltage) of the 555 timer. By varying this voltage, the threshold and trigger levels of the internal comparators change, thereby adjusting the duty cycle.
  • Circuit Diagram:
    +Vcc
    |
    .-.
    | |
    | | R1
    | |
    '-'
    |
    Pin 7 -----o-----o-------- Pin 8 (Vcc)
    | |
    | |
    .-. | Pin 5
    | | o-------| Control Voltage
    | | R2| |
    | | | |
    '-' | |
    | | |
    Pin 2 -----o----o-------| Pin 6
    |
    --- C
    ---
    |
    GND

    By adjusting the control voltage at pin 5, you can modulate the duty cycle of the PWM output at pin 3. This setup is simple and effective for generating PWM signals with a variable duty cycle.

    Summary​

    To adapt an astable multivibrator for PWM generation, using a 555 timer IC in astable mode with a control voltage applied to the control pin (pin 5) is a straightforward and flexible approach. This allows for easy adjustment of the duty cycle while maintaining a constant frequency.

  • Alternatively, you can use op-amps and comparators to create a PWM signal by modulating the reference voltage, offering a more customizable solution.


 
Simple V (pot or voltage) control to vary duty cycle w/o affecting frequency :

1717006462368.png


1717007565468.png


Top screenshots is mBlock tool to program the Attiny85. Uses internal A/D to read a pins
V and use that value for the PWM duty cycle value.

A much more sophisticated approach :



Regards, Dana.
 
In some applications it isn't necessary to keep the frequency constant, or make duty cycle variation linear with respect to some control input. This can lead to simpler circuits.
 
Learn to use GPT

How can an astable multivibrator be adapted or used to generate PWM signals?

An astable multivibrator can be adapted to generate Pulse Width Modulation (PWM) signals by incorporating a method to control the duty cycle of its output waveform. Here’s how you can do it:

Basic Astable Multivibrator Overview​

An astable multivibrator is an oscillator circuit that generates a continuous square wave without requiring any external triggering. It typically consists of two transistors, two capacitors, and a few resistors. The frequency and duty cycle of the output waveform are determined by the values of these components.

Generating PWM Signals​

To generate PWM signals, you need to vary the duty cycle while keeping the frequency constant. This can be achieved by modifying the charging and discharging times of the capacitors in the multivibrator circuit. Here are some methods to achieve this:

  • 1. Using a 555 Timer IC in Astable Mode​

  • A common and practical approach is to use a 555 timer IC in astable mode. The 555 timer can be configured to generate a PWM signal by adjusting the duty cycle. Here’s how you can set it up:

  • Basic Configuration:
    • Connect the 555 timer in astable mode with two resistors (R1 and R2) and a capacitor (C) as per the standard configuration.
  • Control Voltage (Pin 5):
    • The duty cycle can be modulated by applying a control voltage to pin 5 (Control Voltage) of the 555 timer. By varying this voltage, the threshold and trigger levels of the internal comparators change, thereby adjusting the duty cycle.
  • Circuit Diagram:
    +Vcc
    |
    .-.
    | |
    | | R1
    | |
    '-'
    |
    Pin 7 -----o-----o-------- Pin 8 (Vcc)
    | |
    | |
    .-. | Pin 5
    | | o-------| Control Voltage
    | | R2| |
    | | | |
    '-' | |
    | | |
    Pin 2 -----o----o-------| Pin 6
    |
    --- C
    ---
    |
    GND

    By adjusting the control voltage at pin 5, you can modulate the duty cycle of the PWM output at pin 3. This setup is simple and effective for generating PWM signals with a variable duty cycle.

    Summary​

    To adapt an astable multivibrator for PWM generation, using a 555 timer IC in astable mode with a control voltage applied to the control pin (pin 5) is a straightforward and flexible approach. This allows for easy adjustment of the duty cycle while maintaining a constant frequency.

  • Alternatively, you can use op-amps and comparators to create a PWM signal by modulating the reference voltage, offering a more customizable solution.

Hi, thanks for the response. Are you sure to trust chatgpt? As far as I know, using the control pin will also change the frequency, which was the exact problem we are trying to avoid.
 
Simple V (pot or voltage) control to vary duty cycle w/o affecting frequency :

View attachment 145992

View attachment 145993

Top screenshots is mBlock tool to program the Attiny85. Uses internal A/D to read a pins
V and use that value for the PWM duty cycle value.

A much more sophisticated approach :



Regards, Dana.
Hi, Thanks for the reply. And your solutions will work perfectly. But I was hoping to go with a simple solution using a 555 timer, rather than using an MCU.
 
Hi, thanks for the response. Are you sure to trust chatgpt? As far as I know, using the control pin will also change the frequency, which was the exact problem we are trying to avoid.
Sorry for that. GPT used the pot control frequency 1shot
Yes there is a dual-diode pot controlled PWM version.
Do you want 0 to 100% or 0.1 % to 99.9%?
or 1% to 99% or 5% to 95% ??

I suggest this IC for analog tuned fixed f PWM
1717076245096.png

If you want a digital tuned PWM, there are better IC's

1717075794385.png

1717075860286.png
 
Last edited:
A better alternative maybe, was my original idea, namely a CMOS Triangle generator and comparator.

Compensates for error in single supply, change feedback cap to choose f 1nF*10k = 10 us = 1/4f

The 4 factor is due to the feedback divider from Tri Out to the T junction = 1/2 and the ramp is for a half cycle thus the RC product = 1/4 of the time for a full cycle.

1717078502126.png


My Web Simulation: https://tinyurl.com/236rqjpe

The voltage control Vpwm, is inverted to duty-cycle above, so you can swap the inputs for Vpwm to make it non-inverted then the pulse corresponds to the triangle negative peak near 0V. The Cap across Vdd/2 then becomes a soft-start say if you wanted this for a DC-DC converter using the drive current or feedback voltage instead of Vpwm.
 
Last edited:
Here's a conventional way of using a 555 with a pot to vary duty cycle while keeping frequency constant.
1717082574277.png
 
The LTC6993 is a neat, but rather expensive chip (~U$5).

Alec's 555 circuit will get you close to 0% to 100%, but if you need fully 0% to 100%, below is the LTspice sim of an example circuit using an LM339 or LM393 comparator IC with voltage control of the PWM duty-cycle (the voltage can be generated by a pot if desired).
The left comparator generates a quasi (exponential) constant-frequency sawtooth, and the right comparator triggers when the input voltage equals the sawtooth voltage to generate the PWM signal.
Note that the duty-cycle (green trace) goes from fully off (0%) on the left to fully on (100%) on the right.

1717089613868.png
 

Latest threads

New Articles From Microcontroller Tips

Back
Top