ELEC 499 Design Project
Pulse-width Modulation AC Voltage Controller Project Report
Department of Electrical & Computer Engineering
University of Victoria
July 29, 2011
Tim Bodell (V00652813)
Scott Warren (V00241653)
Justin Saukarookoff (V00720894)
Brent Sutherland (V00224258)
Supervisor: Dr. A. Bhat
Table of Contents
The goal for this project was to implement an AC voltage controller. While the standard voltage switching circuit uses basic Triodes for Alternating Current (TRIAC) in a phase-control system, our voltage controller used power MOSFETs switched in a pulse-width modulation implementation. This new voltage controller could generate better power factor and transpose the line harmonics, allowing for improved power quality.
The voltage controller was designed to drive a 60 watt light bulb from a 120V, 60Hz source. The voltage across the load was switched using rectifier bridges controlled by power MOSFETs. The rectifier bridges were designed so they would conduct electricity only when the power MOSFET was switched "on", and would not conduct when the power MOSFET was "off". Two rectifier bridges were connected to the load - one in series and one in parallel. The implication was that the two power MOSFETS could never be "on" simultaneously or else there would be a short circuit in the voltage controller. The series-connected rectifier bridge controlled the power delivered to the load, while the parallel rectifier bridge allowed the load to operate in a "free-wheeling" mode during switching. This scheme allowed the voltage controller to switched according to a pulse-width modulation scheme, implemented using a microcontroller. A block diagram (Appendix C: Block Diagram) has been generated to illustrate the implementation of basic circuity to achieve our goal. The expected control signals and load voltages can be seen in Appendix D: Waveforms.
In addition to driving the load, the source voltage was also used to synchronize the switching control circuit. The source voltage was stepped-down, and a synchronizing signal was generated via a comparator. This signal was processed by the microcontroller software to ensure that no drifting occurred between the 60Hz power signal and the switching signal. With the synchronization signal, the microcontroller output two 1KHz pulse-width modulated square waves, one signal for each MOSFET. As discussed above, one MOSFET was in series with the load and the other was parallel to the load, therefore the control signals needed to complement each other. Additionally, the microcontroller could not source enough power to switch the MOSFETs, so a MOSFET driver IC was needed. Opto-Isolators were implemented to isolate the control circuit from the power circuit.
All of the hardware has been built on a prototype board and has been laid out into 5 basic parts/circuits:
3.1. The Synchronizing Circuit
3.2. The Control Circuit
3.3. The MOSFET Drivers
3.4. The Power Circuit
3.5. The Isolation Circuit.
A complete circuit schematic and hardware design can be found in appendix A
· 1 x 19:1 Transformer
· 1 x LM741
· 1 x 3.3K(ohm) Resistor
· 1 x 1K(ohm) Resistor
The synchronization circuit ensured that the PWM control signals remained synchronized with the 60Hz source voltage. This was necessary to ensure that there was no drift between the two control signals and the load voltage. A step-down transformer converted the 120V source voltage down to approximately 6V. The attenuated signal was connected to the positive input of an LM741 comparator which had been configured as a zero-crossing detector. The output of the comparator was a square wave with a rising or falling edge occurring at each zero-crossing. Since the comparator was implemented for synchronization with the input being the 60Hz source, the comparator output signal was dependant on the phase of the source voltage. The synchronizing signal from the comparator was sent to the microcontroller and used to control the PWM output. The full synchronizing circuit is depicted in Figure 1: Synchronizing Circuit Diagram.
Figure 1: Synchronizing Circuit Diagram
· 1 x Arduino microcontroller
· 1 x 7HC244 Logic Buffer
· 1 x 5K(ohm) Potentiometer
The PWM control signals were generated, synchronized and controlled by an Arduino Uno microcontroller. The Arduino Uno was configured to use six digital I/O pins and one analog input. The analog input was connected to an off-board potentiometer, and was used to modify the duty cycle of the PWM control signals. The control signals themselves were generated using two of the digital I/O pins. The PWM signals were connected to a buffer in order to limit the required current sourced by the microcontroller. The other digital I/O pins were used for level detection, synchronization and interrupt generation. For more details regarding the configuration of the Arduino Uno and the generation of the PWM signals, see Section 4: Software Description. The control circuit is shown in Figure 2: Control Circuit Diagram.
Figure 2: Control Cirucit Diagram
· 2 x UC3710n MOSFET drivers
· 4 x IN4754 Zener Diodes
· 1 x 10(ohm) Resistor
· 1 x 1K(ohm) Resistor
· 2 x 10pF Capacitor
In order to generate enough current to switch the MOSFETs, two MOSFET drivers were needed (one for each MOSFET). Also, since the source pin of each MOSFET was at two different locations in the circuit, and each required its own reference voltage, each MOSFET driver also needed to provide its own ground to ensure proper switching. Additionally, 16V zener diodes were connected between the gate and the source of the MOSFETs to protect against over-voltage. Figure 3: MOSFET Driver Circuit Diagram illustrates the setup of the MOSFET drivers.
Figure 3: MOSFET Driver Circuit Diagram
· 2 x 2N3796 MOSFETs
· 8 x UF5404 Diodes
· 1 x Load/60W Light Bulb
The high power circuit consisted of the power MOSFETs and diode bridge networks to ensure current would always flow from drain to source. Heat sinks were attached to the MOSFETs to dissipate the heat generate during MOSFETs switching. The series bridge network controlled the power delivered to the load, while the parallel bridge switched inversely to the series network to create a discharge path for a reactive load and/or an additional filter. The power circuitry can be seen in Figure 4: Power Circuit Diagram.
Figure 4: Power Circuit Diagram
· 1 x MCT62 Opto-Isolator
· 2 or 4 x 1K(ohm) Resistors
Opto-Isolators were needed to isolate the high voltage circuits from the control circuit. Opto-Isolators were found between the comparator and the microcontroller as well as between the microcontroller and the MOSFET drivers. Due to the isolation scheme, multiple DC power supplies were needed to generate multiple grounds/reference voltages. The isolation schema are shown in Figure 5: Isolation Circuit Diagram.
Figure 5: Isolation Circuit Diagram
The primary goal of the software for our project was to produce the variable duty cycle control signals that would ultimately be used to switch the power MOSFETs. The control signals output by the code were designed to be complimentary square waves, with a small delay during the state changes from low to high. This delay was approximately 100 nanoseconds, and ensured that there was never a switching state where both of the power MOSFETs would be switched on – an important consideration as that particular switching state would cause a short in the power circuit. The desired waveform is shown below, with an exaggerated switching delay to emphasize the timing considerations:
Figure 6: Control Signal Timing
The software to create these waveforms was written using a specialized version of C that was specifically designed to program with the Ardruino Uno microcontroller, and the full source code can be seen in Appendix B: Source Code Listing. The program itself has five primary sections:
4.1. variable declaration
4.2. the setup() subroutine
4.3. the loop() subroutine
4.4. the PWMreset() subroutine
4.5. the PWMgenerator() subroutine.
The variable declaration section of the code defines the intended functionality of the Arduino Uno I/O pins and initializes two integers used to monitor the voltage of the potentiometer controlling the duty cycle of the output waveforms.
Figure 7: Variable Delcaration
The setup() subroutine configured the digital I/O pins, defined the interrupt service routines (ISR) and configured the PWM control register. The digital I/O pins were configured using the PinMode() function, configuring each pin defined in the variable declarations as either INPUT or OUTPUT. The ISRs were configured using the attachInterrupt() function, indicating which interrupt was used, the name of the subroutine that served as the ISR and the edge detection method that was used (rising and/or falling edge detection). The PWM register was configured to operate using digital I/O pin 5, and to switch at a frequency of ~1 kHz.
Figure 8: The Setup() Subroutine
The loop() subroutine is required for every Arduino Uno software application. It runs continuously and sequentially as long the Arduino Uno is functioning. The purpose of the loop() subroutine in our project was to adjust the duty cycle of the PWM output according to the voltage applied across a potentiometer. The potentiometer was connected to one of the analog inputs (analog input pin A2) of the Arduino input. The analog input value was read using the analogRead() function which returned a value between 0 and 1023. Then, assuming that the value of the potentiometer had changed, the duty cycle of the PWM control signal was modified according to the value retrieved from the analog input. The PWM control signal is generated by calling the analogWrite() function and referencing digital I/O pin 5, as defined in the setup() subroutine. The duty cycle of the PWM output can be set by assigning an integer value between 0 and 255, providing 8 bits of resolution. To generate an appropriate duty cycle based on the potentiometer setting, the analog input value (ranging from 0 to 1023) was divided by 4. Furthermore, the PWM driver on the Arduino Uno board automatically restricts switching when the duty cycle is set to either 0% or 100%, providing a constant “low” or “high” setting as needed.
Figure 9: The Loop() Subroutine
The PWMreset() subroutine was an interrupt service routine (ISR) designed to reset the PWM control signal in order to maintain synchronization between the voltage source and the switching signals. This ISR was called as a result of a rising or falling edge from a zero-crossing detector connected to the voltage source. Each half-cycle of the voltage source would generate an interrupt, resetting the PWM control signal. The PWM control signal was reset by simply overwriting the value of the timer register used by the PWM system.
Figure 10: The PWMreset() Subroutine
The PWMgenerator() subroutine was an interrupt service routine (ISR) designed to create the variable duty-cycle PWM MOSFET driver signals that would be sent to the MOSFET driver IC’s. This ISR was called as a result of the rising or falling edges of the PWM control signal generated by the Arduino Uno PWM system. Each time the PWM control signal switched from “low” to “high”, or vice versa, the PWMgenerator() subroutine determined the current level of the PWM control signal, and set digital I/O pins 4 and 7 accordingly, effectively generating the MOSFET driver IC signals. In order to ensure that both the series MOSFET and the parallel MOSFET of the power circuit are not turned “on” at the same time, the “high” MOSFET driver IC signal was always set “low” before the “low” MOSFET driver IC signal was set “high”. Additionally, the amount of time require to modify the output level of the driver signals was ~100 nanoseconds, ensuring that there was sufficient time for both MOSFETs to assume an “off” state before one was switched back “on”.
Figure 11: The PWMgenerator() Subroutine
The configuration found in Appendix A: Hardware Schematic was connected in the Power Laboratory and the PWM AC Voltage Controller was tested. As can be seen in Appendix A: Hardware Schematic, a sinusoidal voltage was supplied to the power circuit via a Variac transformer. The micro-controller and all of the IC chips were powered by separate DC supplies. The oscilloscope was connected across the load so that the load voltage and current waveforms could be observed. A light bulb was used as the load of the circuit, which allowed the load characteristics of the circuit to also be observed through the brightness of the light bulb.
micro-controller was programmed to provide a gating signal to the two MOSFETs.
The MOSFET connected in series with the power supply received the gating signal
that was produced by the micro-controller and the MOSFET that was connected in
parallel across the load received the inverse of that gating signal. The
micro-controller was programmed to produce a gating signal that switched at a
frequency of 1 KHz. The duty cycle of the gating signal, defined as Ton/T,
could be controlled by the potentiometer in the circuit. By controlling the
duty cycle of the gating signal, combined with the input sinusoidal voltage,
the load characteristics of the circuit could be controlled. The oscilloscope
was used to observe and record the load characteristics of the circuit. Figure 12
found below displays what the load voltage and circuit waveforms look like for
a gating signal with the duty cycle set at 0%. Figures 13 and 14, seen below
respectively, show the load voltage and current waveforms for a gating signal
with a duty cycle of 25%. Figures 15 and 16 show the load voltage and current
waveforms for a duty cycle of 50% and Figures 17 and 18 display the load
characteristic waveforms for a gating signal with its duty cycle fixed at 100%.
Figure 12: Load Voltage and Current Waveform for a duty cycle of 0%
Figure 13: Load Voltage waveform for a duty cycle of 25%
Figure 14: Load Current waveform for duty cycle of 25%
Figure 15: Load Voltage waveform for a duty cycle of 50%
Figure 16: Load Current waveform for duty cycle of 50%
Figure 17: Load Voltage waveform for a duty cycle of 100%
Figure 18: Load Current waveform for duty cycle of 100%
As can be seen in the figures above, the load characteristics of the circuit have a proportional relationship to the duty cycle of the gating signal produced by the micro-controller. By controlling the duty cycle of the gating signal, the load characteristics of the circuit can be controlled.
The line voltage and current waveforms of the circuit were then observed and recorded using the oscilloscope. Figure 19 shown below displays the line voltage and current waveforms for the circuit with the duty cycle of the gating signal set at 0%. Figure 20 shows the line voltage and current waveforms with the duty cycle varied to 50% and Figure 21 shows the line characteristics for a gating signal with a duty cycle of 100%. As can be seen in Figures 19 through 21, both of the line voltage and line current waveforms appear in the same window. Throughout Figures 19 to 21, channel 1 of the oscilloscope displays the line voltage of the circuit and channel 2 shows the line current.
Figure 19: Line Voltage and Current waveforms for a duty cycle of 0%
Figure 20: Line Voltage and Current waveforms for duty cycle set at 50%
Figure 21: Line Voltage and Current waveforms for duty cycle of 100%
MOSFET-driven AC Voltage Controller that was designed has many benefits over
the traditional SCR-driven AC Voltage Controller. To start with, an SCR-driven
AC Voltage Controller cannot work with PWM, which was an important part of our
design. This is due to the fact that the SCR, when applying a gating signal to
turn it on, cannot turn itself off until it hits a zero crossing in the
sinusoidal signal. Once a gating signal is applied to it, it continues to stay
on and conduct, even when the gating signal is turned off, until it hits a
zero-crossing in the sinusoidal signal. A MOSFET, on the other hand, can be
completely controlled by the gating signal applied to it. When the gating
signal is applied to the MOSFET, it turns on and conducts, but when the gating
signal is no longer applied, the MOSFET turns off and no longer conducts.
Because the SCR cannot be completely controlled by the gating signal that is applied to it, it cannot work with PWM. As discussed above, once the gating signal is applied and the SCR is fired on, it continues to conduct until it reaches a zero-crossing in the sinusoidal signal. After the gating signal has been applied to turn it on, the application of the gating signal no longer matters, therefore the application of the SCR will not be affected by modulations in the pulse-width of the gating signal. The purpose in designing a MOSFET-driven PWM AC Voltage Controller is due to the fact that one can control the application of the MOSFET by modulating the pulse-width of the gating signal applied to it. By having control of the MOSFET through modulations in the pulse-width of its gating signal, one has a significant amount of control over their circuit as opposed to that given by a circuit consisting of SCRs.
For a gating signal with its duty cycle set at any value other than 0% or 100%, harmonics appear in the waveforms of the load voltage and current and also in the line voltage and current of the circuit. The harmonics in the waveforms of our PWM AC Voltage Controller can be seen in Figures 12 through 21, found above in the section titled ‘Waveform Analysis.’ The harmonics appear in the waveforms when the sinusoidal power signals are distorted. In a phase-control system, the sinusoid is distorted by chopping a portion of the signal off from the front of the waveform. By using a PWM switching method, the power signal experiences a closer approximation of the original signal, producing a power signal waveform with less distortion and, in turn, less harmonics than that of the waveform produced by a phase-control system. This can especially be observed for higher duty cycle values. Furthermore, the PWM signal can be reconstructed into an even better sinusoidal approximation by implementing an integrator into the switching system.
Another important part of the PWM AC Voltage Controller that was designed had to do with using two MOSFETs, one being connected in series with the power supply and the other in parallel with the load, opposed to using just one MOSFET in series with the supply. Adding a MOSFET in parallel with the load is essential for circuits consisting of reactive loads. Loads such as motors, magnets, and heaters are all reactive loads that, when having run for a while and then all of a sudden being turned off, need somewhere to discharge. The MOSFET connected in parallel across the load allows the reactive load to discharge when the circuit is turned off.
While the final result obtained was to our original specifications, the design of the circuit would benefit from some improvements. The most obvious improvement would be the addition of an integrator at the output. A simple inductor and capacitor filter would cut out the higher order harmonics left from the switching. If the switching frequency was made sufficiently high the output of the voltage controller would be a scaled version of the original AC signal. Once an AC output is obtained the controller could be used for more complicated loads than the resistive load that was tested. An inductive load could be applied at the output for uses such as motor control or heaters.
There was some jitter in the control signals for the MOSFETs. This could have been reduced by adding decoupling capacitors.
The opto-isolators we used were too slow. We purposely built-in a 100 nanosecond delay in the PWM square waves that controlled the MOSFETs. This delay ensure that there was never a short in the power circuit by having both MOSFETs turned on simultaneously. Unfortunately, the opto-isolators we used increased this switching time to approximately 10 microseconds because of their slow switching speed. Using faster opto-isolators would allow faster switching which would create a better AC output after filtering. A closely demodulated message signal would be vital for use with more complicated loads.