Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
university:courses:electronics:electronics-lab-pulse-width-modulation [03 May 2018 09:18] – modifications based on review Antoniu Miclausuniversity:courses:electronics:electronics-lab-pulse-width-modulation [27 Jan 2021 22:36] (current) – use wp> interwiki links Robin Getz
Line 3: Line 3:
 ===== Objective ===== ===== Objective =====
  
-In this laboratory we examine the pulse width modulation and its usage within a variety of applications.+In this laboratory we examine pulse width modulation and its usage within a variety of applications.
  
-Pulse Width Modulation (PWM) Signal is a method for generating an analog signal using a digital source. A PWM signal consists of two main components that define its behavior: a duty cycle and a frequency. +Pulse Width Modulation (PWM) is a method for encoding an analog signal into single digital bit. A PWM signal consists of two main components that define its behavior: a duty cycle and a frequency. 
  
 It is used in transmission of information by encoding a message into a pulsing signal, also for power control of electronic devices such as motors and as principal algorithm for photo-voltaic solar battery chargers. It is used in transmission of information by encoding a message into a pulsing signal, also for power control of electronic devices such as motors and as principal algorithm for photo-voltaic solar battery chargers.
Line 19: Line 19:
 The __frequency__ determines how fast the PWM completes a cycle, and therefore how fast it switches between high and low states. The __frequency__ determines how fast the PWM completes a cycle, and therefore how fast it switches between high and low states.
  
-By varying a digital signal off and on at a fast-enough rate, and with a certain duty cycle, the output will appear to behave like a constant voltage analog signal when providing power to devices.+By varying a digital signal off and on at a fast-enough rate, and with a certain duty cycle, the output will appear to behave like a constant voltage analog signal when providing power to devices that respond much slower than the PWM frequency, such as audio speakers, electric motors, and solenoid actuators.
  
 ===== Materials ===== ===== Materials =====
Line 29: Line 29:
 1 10kΩ potentiometer 1 10kΩ potentiometer
  
-===== Pulse Width Modulation - Principle of operation =====+===== Pulse Width Modulator - Principle of operation =====
  
 Pulse Width Modulation (PWM) is a technique to generate low frequency output signals from high frequency pulses. Rapidly switching the output voltage of an inverter leg between the upper and lower DC rail voltages, the low frequency output can be thought of as the average of voltage over a switching period. Pulse Width Modulation (PWM) is a technique to generate low frequency output signals from high frequency pulses. Rapidly switching the output voltage of an inverter leg between the upper and lower DC rail voltages, the low frequency output can be thought of as the average of voltage over a switching period.
 +
 +Besides that, there are also other several ways of generating pulse-width modulated signals, including analog techniques, sigma-delta modulation, and direct digital synthesis.
  
 One of the simplest methods of generating a PWM signal is to compare two control signals, a carrier signal and a modulation signal. This is known as carrier-based PWM. The carrier signal is a high frequency (switching frequency) triangular waveform. The modulation signal can be any shape. One of the simplest methods of generating a PWM signal is to compare two control signals, a carrier signal and a modulation signal. This is known as carrier-based PWM. The carrier signal is a high frequency (switching frequency) triangular waveform. The modulation signal can be any shape.
Line 39: Line 41:
 Consider the circuit in Figure 1. Consider the circuit in Figure 1.
  
-<WRAP centeralign> {{:university:courses:electronics:pwm_carrier-sch.png?500|}} </WRAP>+<WRAP centeralign> {{ :university:courses:electronics:pwm_carrier.png?400 |}} </WRAP>
  
 <WRAP centeralign> Figure 1. PWM Principle of operation </WRAP> <WRAP centeralign> Figure 1. PWM Principle of operation </WRAP>
Line 55: Line 57:
 ==== Procedure ==== ==== Procedure ====
  
-Use the first waveform generator as carrier signal providing a 4V amplitude, 2.5V offset, 1 kHz triangle wave excitation to the circuit. Use the second waveform generator as modulation signal with 3V amplitude, 2.5V offset, 50Hz sine wave.+Use the first waveform generator as the carrier signal providing a 4V amplitude peak-to-peak, 2.5V offset, 1 kHz triangle wave excitation to the circuit. Use the second waveform generator as the modulation signal with 3V amplitude peak-to-peak, 2.5V offset, 50Hz sine wave
 + 
 +Supply the op amp with +5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2 .
  
 In the figure there are presented the two signal generator channels containing the two input signals (orange - carrier signal, purple - modulation signal). In the figure there are presented the two signal generator channels containing the two input signals (orange - carrier signal, purple - modulation signal).
Line 63: Line 67:
 <WRAP centeralign> Figure 3. Input Signals </WRAP> <WRAP centeralign> Figure 3. Input Signals </WRAP>
  
-Supply the op amp to +5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2. +A plot of the output signal on channel 2 of the scope is presented in Figure 4.
- +
-A plot with the output signal on channel 2 of the scope is presented in Figure 4.+
  
 <WRAP centeralign> {{:university:courses:electronics:pwm-wav.png|}} </WRAP> <WRAP centeralign> {{:university:courses:electronics:pwm-wav.png|}} </WRAP>
Line 71: Line 73:
 <WRAP centeralign> Figure 4. PWM output </WRAP> <WRAP centeralign> Figure 4. PWM output </WRAP>
  
- If the peak of the modulation is less than the peak of the carrier signal, the output will follow the shape of the modulation signal. +If the instantaneous magnitude of the modulation signal is greater than the carrier signal at a point in time, the output will be high. If the modulation signal is lower than the carrier signal, the output will be low. 
-If instantaneous magnitude of the modulation signal is greater than the carried signal at a point in time, the output voltage should be connected to positive side of the supply (high state). If the carrier signal is greater than the modulation signal, the output should be connected to the negative side of the supply (low state).+ 
 +If the peak of the modulation is less than the peak of the carrier signal, the output will be a faithful PWM representation of the modulation signalEdit
  
 ===== Pulse Width Control using a DC modulation Voltage===== ===== Pulse Width Control using a DC modulation Voltage=====
Line 78: Line 81:
 ==== Background ==== ==== Background ====
  
-For this particular application we will use a simple operational amplifier in a switching mode configuration (see [[university:courses:electronics:electronics-lab-opamp-comparator|Activity: Op Amp as Comparator]] for further details) in order to emphasize the pulse width control of the output signal.+For this particular application we will use a simple operational amplifier in a switching mode configuration (see [[university:courses:electronics:electronics-lab-opamp-comparator|Activity: Op Amp as Comparator]] for further details) to demonstrate pulse-width modulation of a DC voltage.
  
 Consider the circuit in Figure 5. Consider the circuit in Figure 5.
  
-<WRAP centeralign> {{:university:courses:electronics:pwm_ref_voltage-sch.png?500|}} </WRAP>+<WRAP centeralign> {{ :university:courses:electronics:pwm_dc_modulation1_ltspice.png?400 |}} </WRAP>
  
 <WRAP centeralign> Figure 5. Pulse Width Control using a DC modulation Voltage </WRAP> <WRAP centeralign> Figure 5. Pulse Width Control using a DC modulation Voltage </WRAP>
  
 The circuit works as a simple comparator where the negative input of the operational amplifier is connected to the  The circuit works as a simple comparator where the negative input of the operational amplifier is connected to the 
-input waveform, while the positive input acts as a threshold voltage which establishes when the transitions between high voltage output and low voltage output occur. The potentiometer acts as a voltage divider for the input reference voltage, adjusting the threshold voltage, and implicitly the duty cycle of the output signal.+carrier waveform, while the positive input acts as a threshold voltage which establishes when the transitions between high voltage output and low voltage output occur. The potentiometer acts as a voltage divider for the input reference voltage, adjusting the threshold voltage, and implicitly the duty cycle of the output signal.
  
 ==== Hardware Setup ==== ==== Hardware Setup ====
Line 100: Line 103:
 ==== Procedure ==== ==== Procedure ====
  
-Use the first waveform generator as source Vin to provide a 5V amplitude, 1 kHz triangle wave excitation to the circuit. Use the second waveform generator as constant voltage source with 5V amplitude.+Use the first waveform generator as source Vin to provide a 5V amplitude peak-to-peak, 1 kHz triangle wave excitation to the circuit. Use the second waveform generator as constant voltage source with 5V amplitude peak-to-peak.
 Supply the op amp to +5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2. Supply the op amp to +5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2.
  
Line 109: Line 112:
 <WRAP centeralign> Figure 7. Pulse Width Control using a DC modulation Voltage - waveforms </WRAP> <WRAP centeralign> Figure 7. Pulse Width Control using a DC modulation Voltage - waveforms </WRAP>
  
-The output signal is a squared shaped determined by the two possible output valuesWe can notice that, by varying the potentiometer value, the duty cycle of the signal changes, while the frequency remains constant.+The output signal is a PWM representation of the input voltageNotice that, by varying the potentiometer value, the duty cycle of the signal changes, while the frequency remains constant.
  
-===== PWM with Astable Multivibrator=====+===== Fixed 50% PWM with Astable Multivibrator=====
  
 ==== Background ==== ==== Background ====
Line 117: Line 120:
 Consider the circuit in Figure 8. Consider the circuit in Figure 8.
  
-<WRAP centeralign> {{:university:courses:electronics:pwm_multivibr-sch.png?500|}} </WRAP>+<WRAP centeralign> {{ :university:courses:electronics:pwm_astable_multivibr.png?400 |}} </WRAP>
  
 <WRAP centeralign> Figure 8. PWM with Astable Multivibrator </WRAP> <WRAP centeralign> Figure 8. PWM with Astable Multivibrator </WRAP>
  
 The circuit shows an astable multivibrator using a single operational amplifier. The functionality is easy to understand while considering the functional principle of a Schmitt trigger (comparator circuit with hysteresis studied in [[university:courses:electronics:electronics-lab-opamp-comparator|Activity: Op Amp as Comparator]]): The circuit shows an astable multivibrator using a single operational amplifier. The functionality is easy to understand while considering the functional principle of a Schmitt trigger (comparator circuit with hysteresis studied in [[university:courses:electronics:electronics-lab-opamp-comparator|Activity: Op Amp as Comparator]]):
-The input of the Schmitt trigger, which is identical to the inverting input of the operational amplifier, is connected to the output of the circuit via a resistor capacitor network. While the potential at the capacitor and so at the input of the Schmitt trigger is lower than the lower threshold, the output voltage equals the positive supply voltage of the circuit. Now the capacitor is charged via the resistor R<sub>3</sub>, until the upper threshold of the Schmitt trigger is reached. As a result, the output voltage of the operational amplifier tilts to the negative supply voltage. Now the capacitor is discharged via R<sub>3</sub>, until the voltage across those device reaches the lower threshold of the Schmitt trigger. The output voltage of the operational amplifier tilts to the positive supply voltage and the whole process starts again. Besides the lower number of required elements, an advantage of this multivibrator is the better quality of the output signal. Even at very low switching frequencies, the slew rate of the output signal is very high and there are almost no distortions.+The input of the Schmitt trigger, which is identical to the inverting input of the operational amplifier, is connected to the output of the circuit via a resistor-capacitor network. While the capacitor voltage (which is also the input of the Schmitt triggeris lower than the lower threshold, the output voltage equals the positive supply voltage of the circuit. Now the capacitor is charged via the resistor R<sub>3</sub>, until the upper threshold of the Schmitt trigger is reached. As a result, the output voltage of the operational amplifier is driven to the negative supply voltage. Now the capacitor is discharged via R<sub>3</sub>, until the voltage across those device reaches the lower threshold of the Schmitt trigger. The output voltage of the operational amplifier is driven to the positive supply voltage and the whole process starts again.  
 + 
 +The advantage of this circuit is that it does not require an M2K to generate a carrier (but the duty cycle is fixed at 50%.)
  
 ==== Hardware Setup ==== ==== Hardware Setup ====
Line 146: Line 151:
 ===== Extra Activity ===== ===== Extra Activity =====
  
-In the previous example we generated a 50% fixed duty cycle PWM using astable multivibrators. But how can we adjust the duty cycle? For this we will need to alter, slightly, the circuit.+In the previous example we generated a 50% fixed duty cycle PWM using astable multivibrators. But how can we adjust the duty cycle? For this we will need to alter the circuit slightly.
  
 Consider the circuit presented in Figure 11. Consider the circuit presented in Figure 11.
  
-<WRAP centeralign> {{:university:courses:electronics:pwm_dc_multivibr-sch.png?500|}} </WRAP>+<WRAP centeralign> {{ :university:courses:electronics:pwm_dc_multivibr.png?400 |}} </WRAP>
  
 <WRAP centeralign> Figure 11. Adjusting the duty cycle for PWM with Multivibrator</WRAP> <WRAP centeralign> Figure 11. Adjusting the duty cycle for PWM with Multivibrator</WRAP>
  
-The resistor R<sub>3</sub> in Figure 8 was replaced by a potentiometer and two diodes were inserted. Now the charging current of the capacitor is running through D<sub>1</sub>, while the discharging current is running through D<sub>2</sub>. Depending on the adjustment of the potentiometer VR<sub>1</sub>, the resistance of the charging current - running through the upper branch of the circuit - is different from those of the discharging current - running through the lower branch. +The resistor R<sub>3</sub> in Figure 8 was replaced by a potentiometer and two diodes were inserted. Now the charging current of the capacitor is running through D<sub>1</sub>, while the discharging current is running through D<sub>2</sub>. Depending on the adjustment of the potentiometer VR<sub>1</sub>, the resistance of the charging current - running through the upper branch of the circuit - is different from that of the discharging current - running through the lower branch. 
  
 ==== Hardware Setup ==== ==== Hardware Setup ====
Line 168: Line 173:
 Supply the circuit to +/-5V from the power supply. Configure the scope so that the output signal is displayed on channel 1 and the voltage on the capacitor (at the negative input of the op amp) is displayed on channel 2. Supply the circuit to +/-5V from the power supply. Configure the scope so that the output signal is displayed on channel 1 and the voltage on the capacitor (at the negative input of the op amp) is displayed on channel 2.
  
-Vary manually the potentiometer value and notice the duty cycle change. A plot example is presented in Figure 13.+Vary the potentiometer value and notice the duty cycle change. A plot example is presented in Figure 13.
  
 <WRAP centeralign> {{:university:courses:electronics:pwm_dc_multivibr-wav.png|}} </WRAP> <WRAP centeralign> {{:university:courses:electronics:pwm_dc_multivibr-wav.png|}} </WRAP>
Line 176: Line 181:
 In this example the duty cycle was set to around 25%. Whenever the duty cycle is altered, there is inevitably a slight variation in the switching frequency, because the two coupling networks at the inverting and non-inverting input are both connected to the output of the operational amplifier. In this example the duty cycle was set to around 25%. Whenever the duty cycle is altered, there is inevitably a slight variation in the switching frequency, because the two coupling networks at the inverting and non-inverting input are both connected to the output of the operational amplifier.
  
 +===== Going Further with the Lab =====
 +
 +All the activities in this laboratory are based on a simple op-amp (OP97) configured as comparator. The ADALP2000 Parts Kit contains also the comparator AD8561, designed for this single purpose. Therefore, the performance of the PWM circuits might be increased by using this part.
 +
 +Build the above discussed circuits using AD8561 from the Parts Kit and discuss any noticeable changes of the circuit behavior and the input/output signals. 
 +
 +<WRAP round download>
 +**Lab Resources:**
 +  * Fritzing files: [[downgit>education_tools/tree/master/m2k/fritzing/pwm_lab_bb | pwm_lab_bb]]
 +  * LTspice files: [[downgit>education_tools/tree/master/m2k/ltspice/pwm_lab_ltspice | pwm_lab_ltspice]]
 +</WRAP>
 ===== Further Reading ===== ===== Further Reading =====
  
 Some additional resources: Some additional resources:
-  * [[https://en.wikipedia.org/wiki/Pulse-width_modulation|Pulse-width modulation]]+  * [[wp>Pulse-width_modulation|Pulse-width modulation]]
   * [[university:courses:alm1k:alm-lab-pwm|Activity: Pulse Width Modulation]]   * [[university:courses:alm1k:alm-lab-pwm|Activity: Pulse Width Modulation]]
-  * [[http://www.analog.com/en/analog-dialogue/articles/how-to-control-fan-speed.html|Why and How to Control Fan Speed for Cooling Electronic Equipment]]+  * [[adi>en/analog-dialogue/articles/how-to-control-fan-speed.html|Why and How to Control Fan Speed for Cooling Electronic Equipment]]
  
 **Return to Lab Activity [[university:courses:electronics:labs|Table of Contents]]** **Return to Lab Activity [[university:courses:electronics:labs|Table of Contents]]**
  
university/courses/electronics/electronics-lab-pulse-width-modulation.txt · Last modified: 27 Jan 2021 22:36 by Robin Getz