Universal PWM Driver Schematic Circuit Diagram
PWM drivers are used in analyzing, testing, installing and powering all kinds of electronic and electrical devices. We have published a few designs in Elektor over the years: here we present a ‘deluxe’ version suitable for a very wide range of applications. As usual, the software for the project (source code and hex file) can be downloaded for free from the accompanying pages on the Elektor website , and ready-programmed microcontrollers are also available. Additionally, the authors’ Eagle design files for the printed circuit board are available for download.
The main user control, used for adjusting almost all the settings, is an Alps incremental rotary encoder. This is accompanied by a mode switch used to select the operating mode from among ‘off’, ‘PWM’ and ‘full power’: a three-position center-off switch is suitable. The two controls are connected via headers (K2 and J1). The current settings of the circuit are shown on a standard LCD panel with two rows of sixteen characters, which is connected to the PCB via a standard connector.
At the heart of the circuit is a PIC16F628 microcontroller (a PIC16F628A may also be used). An output stage consisting of two power FETs wired in parallel, along with heavy-duty flyback diodes, allows the circuit to drive DC motors at up to 30 V and rated currents of up to 10 A directly and comfortably. The circuitry is capable of working at even higher currents, but then careful attention must be paid to the cross-sectional area of the conductors: tin the current-carrying circuit board tracks, or add wires in parallel with them.
The motor drive application was foremost in the authors’ minds when designing the circuit. A useful feature in this application is the ‘boost function’, which helps DC motors to start up reliably. The output is switched on at full power for the configured boost time, regardless of the PWM duty cycle setting in force.
For reasons of safety, when the circuit is powered up the output will remain off until the mode switch is set to ‘off’ and then to one of the ‘on’ settings. This means, for example, that a connected motor will not suddenly start up when the electricity supply is restored after a power cut.
In normal operation, the display shows the current PWM frequency and the duty cycle (as a percentage). The duty cycle can be adjusted using the incremental encoder.
The basic settings can be configured in the set-up menu. This menu is reached by setting the mode switch to ‘off’ and pressing in the incremental encoder for a few seconds. The menu includes the following options: Boost: on / off Boost time: 1 second / 2 seconds / 5 seconds PWM frequency: 1 kHz / 2 kHz / 5 kHz PWM step: 1 % / 2 % / 5 % / 10 %
Choosing ‘exit’ leaves the set-up menu.
The ‘PWM step’ parameter determines the amount by which the duty cycle increases or decreases in PWM mode for each step of the rotary encoder.
The settings are stored in the EEPROM of the PIC16F628 and so are not lost when power is removed.
The authors’ prototype of this circuit has given sterling service, outputting a clean and stable drive waveform even at a frequency of 5 kHz. www.elektor.com/090856