How to Use Pulse Width Modulation

How to Use Pulse Width Modulation

This tutorial shows you how to use Pulse Width Modulation and turning the Digital Output On & Off using an LED Light with an HMI+PLC combo, while displaying on the user-interface.

Software Required

Hardware Required

  • HMC4070A-M – Other HMC2000/HMC4000 models can also be used
  • HMC3-M1212P0200 V2 – Other HMC3 I/O modules with Analog Inputs can also be used
  • 24 VDC Power Supply (4010-0011)
  • 24 VDC LED Light – 2.2k Ω

HMI + PLC Combo

PWM Diagram

Pulse Width Modulation is a technique used to “simulate” analog signals by pulsing digital signals.

To simulate an analog signal the width of the digital pulse, or percentage of time the digital output is in the ON state, is changed and the frequency, the number of pulses in each period, will allow us to vary the amount of voltage fed to the load. Executing this process at a fast rate can simulate a smooth “analog” signal.

The above figure demonstrates the signal a PWM output produces. At a duty cycle of 50%, the digital output is set to high for half the period time and low to the other half. The average value of voltage fed to the load is then calculated to be half of the high voltage. The process of continuously varying the duty cycle is a way to create a modulating signal.

Wiring and Circuit Design

Digital Output LED Wiring

Power Supply:Red Wire – 24V to Power Supply
Black Wire 0V – Ground to Power Supply

Digital Output:
Red Wire Y0: 24V to LED
Black Wire 0V: Ground to LED

This wiring diagram can also be applied to any HMC3 I/O Modules with Digital Output capabilities.

User Interface

Sample Project

The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.

Download MAPware sample project

Resources & Documentation

HMC/MAPware-7000 Resources


See our Support Center for a complete list of Quick Start and Installation Guides

Scroll to Top