# Oscilloscope Measures PWM Voltage Pt. 3

## PWM_Analysis.png

The figure above contains a series of charts showing the equivalent DC voltage from a Pulse Width Modulation (PWM) signal over a period of time. There are subcharts showing the measured PWM signal at points in time indicated in the main chart’s saw tooth shaped waveform. I created these charts from data collected using iMSO-104 and exported into Microsoft Excel. After reading through this post, Part Three in this series, you will hopefully understand how a digital-ish signal from a microcontroller can be used to provide DC voltage for driving the circuits in your design. I’ll also go over the process for importing iMSO captured data into Excel for further analysis.

## Summaries from Parts 1 and 2

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:

1. The LED brightens and dims
2. The control signal’s pulse with changing with LED brightness
3. The voltmeter displays an average voltage for the LED and PWM output

Part 2: The block diagram of the setup and schematic of the LED dimming circuit. Part 2 also has iMSO screenshots of minimum and maximum PWM states with analysis of the signal’s characteristics: Frequency, Maximum voltage, and Pulse Width

## Basic PWM Measurement Setup

Dimming an LED is a simple exercise for the Arduino microcontroller. The PWM output from the board brightens and dims the LED according the the PWM signal’s pulse width. The longer pulse width equates to a higher equivalent DC voltage and therefore, a brighter LED. You can skip back to Part 1 of this series to see a short video clip of the LED, oscilloscope, and DMM reacting to the Arduino’s changing PWM signal.

## Data Logging Functionality on iPad Oscilloscope

Importing the data into Excel looks like the annotated table shown in the figure below. I used Excel’s data import function, treating iMSO’s output file as a .csv and text file, to populate one worksheet with the raw, comma delimited data. Next, I added some header rows and columns for displaying the bin numbers and the elapsed time.

## Voltage data collected in “bins”

iMSO uses 240 bins to measure the analog waveform displayed on the oscilloscope screen at any given time. The data bins form the columns of the table in the worksheet. The rows of the worksheet represent the time lapse data collection. Each time data is collected and stored in memory it adds another row to the worksheet. I’ve used the third column in the table (time) to illustrate that iMSO collected a screen full of data every 600 milliseconds.

## Calculating Equivalent DC Voltage At Points In Time

The second column in the table is the equivalent DC voltage at a specific moment in time. The value in these cells is the calculated average voltage across the 240 cells in the row. Since each row corresponds to a specific time capture, the average value of the measured data in the bins is the equivalent voltage for that specific moment in time. I’ve highlighted a couple of cells in this column. The reddish cell is the absolute minimum average voltage found using Excel’s built-in MIN and MAX functions. The yellow/amber colored cells are the approximate midpoint between the minimum and maximum voltages.

## iMSO Captures Analog & Digital Data

iMSO simultaneously collects data for the one analog channel and the four digital channels. Even when there are no digital traces active, like in this case, iMSO is still recording data for the four digital leads, but enters a default hex value instead of live data. This fact is something to keep in mind when you are analyzing your data in Excel because only the first 240 bins contain analog trace data.

Close inspection of the plotted data shows minor data excursions from nearby data points. Some of these instances are circled in green illustration. You may wonder what these blips correspond to regarding the actual measured pulse.

Digital oscilloscopes measure a waveform using analog-to-digital converters, where the incoming analog voltage is digitized and quantized into discrete voltage increments. The minimum voltage increment size is directly related to the number of bits and ADC uses to digitize the analog waveform. ADCs with more bits will have finer measurement resolution than an ADC with fewer bits.

The following tables contain useful selection parameters for choosing an ADC for your own design. I’ve included the following information for each of the eight ADCs included in my analysis:

• Per unit cost (quoted for a purchase quantity of 1000; they can be bought individually for higher prices)
• Number of bits
• Minim resolution as Least Significant Bit - percentage of the full scale value
• Minimum resolution voltage applied to four full scale voltages (1.5, 3.3, 5.0, and 10.0)