The figure above is a schematic diagram of a Pulse Width Modulation (PWM) signal driving an LED with an handheld oscilloscope and voltmeter monitoring the LED’s voltage. In this post and the next we will look at how the pulsed voltage resembles a DC voltage to a load, and use an Excel spreadsheet, every engineer’s best friend, to think like the voltmeter for calculating a DC voltage from the PWM signal.
Quickly summarizing what we covered in Part 1, an Arduino microcontroller is controlling the LED brightness through one of the controller’s PWM outputs. The video shows us three things occurring simultaneously:
- The LED brightens and dims
- The control signal’s pulse with changing with LED brightness
- The voltmeter displays an average voltage for the LED and PWM output
A Cautionary Note About This (or any) Circuit
There’s a resistor shown in the schematic and while its exact value is unimportant, having that resistor in the circuit is critical. If you are experienced with electronics and know enough about loads, currents and voltages to understand why the series resistor is important to the operation of the circuit, then you may want to skip ahead.
Over Current: The resistor limits the flow current through the circuit. Since PWM driver in the Arduino microcontroller can’t source much current, it’s possibly to have an overcurrent condition that puts the PWM circuit into current limit. That’s the best case. The worst case scenario would be that the PWM driver doesn’t have a current limit failsafe and tries to source all the current it can into the LED until it burns itself up in a small, smelly, black puff of smoke.
Over Voltage: Without the resistor between the LED and the return, the entire voltage developed by the PWM would drop across the LED. The Arduino microcontroller’s PWM goes between 0 and 4.5 V. Like other electronic components, LEDs have maximum voltage ratings that should be followed for safe operation. Applying too high a voltage across the terminals of the LED, even if the current is smaller, can burn out the little diode junction inside because it can’t dissipate the power
Study the trees to understand the forest
To understand the DC equivalent voltage of a series of pulses, you first need to understand a few things about the pulses themselves. I’ve inserted two iMSO-104 screenshots taken with the equipment setup depicted in the preceding pictures. The active measurements are Maximum voltage, Frequency, Period, and Pulse Width. I’ll briefly describe these measurements and then show how these characteristics of the PWM signal affect the equivalent DC voltage. There’s a measurement missing from the display in order to make a point. Oscium’s iMSO-104 software can calculate the equivalent DC voltage from these pulses but for the purposes of this blog series, I’m doing that with a voltmeter. In the next part of this series l give an example of how to calculate the equivalent DC voltage yourself.
- Maximum voltage: Notice that in both screenshots the maximum voltage is 4.60 V. The Arduino microcontroller is a 0 to 5 volt system and can output up to 5 volts. There’s some circuitry between the 5 volt source and the PWM output that eats up 0.4 V, by inspection. The “missing” 0.4 V is called headroom – the difference between the supply rail and the maximum output voltage.
- Frequency and Period: In both screenshots the calculated frequency is roughly 500 Hz. This frequency is characteristic of the Arduino microcontroller I used. I’m not familiar enough with the microcontroller yet to know if this parameter is user defined and set by default to 500 Hz, or if it’s implemented in the hardware. The frequency and period are reciprocal time units: 500 Hz is equivalent to 2.0 milliseconds.
A quick side note about the displayed frequency (and period). Why is the measured frequency different in the two figures? I’m not sure why but it’s really not important to this discussion. Without getting into heavy analysis of clock stability and jitter, and guessing at measurement uncertainty, there’s not much else to say. After all, the difference between the two readings is only a couple of Hertz and that’s not bad.
- Pulse Width: The maximum voltage and the frequency are fixed values; only the pulse width can be varied. It’s the pulse width that establishes the equivalent DC voltage. When the pulse width is at a maximum so is the equivalent DC voltage. Figure 5 shows the PWM where the pulse is on most of the time. Figure 4 shows the pulse being off most of the time and therefore has an equivalent DC voltage much closer to 0 volts.
Keep Reading For More On Pulse Width Modulation (PWM)
In Part 1 you were introduced to the LED dimming circuit driven by an Arduino microcontroller. In this post, Part 2, you got to peek behind the curtain at the circuit schematic and the setup block diagram, and see how iMSO-104 captures the PWM signal. In the next post of this series, we'll take you through an example of calculating DC equivalent voltage from data exported data from iMSO. After reading the next post you’ll be capable of using this technique to perform your own analysis of signals you collect from your own experimenting. For an even deeper look at what’s going, come back next week and to learn about PWM Voltage Part 3.
Oscium's handheld oscilloscope is now available with universal platform support! So, if you're interested in using the scope on iOS, Android, PC or Mac, Oscium supports you. Please go to iMSO-204x for more information.