Search
• Sajiv Shah

# Visualizing Digital PWM Using an Osciolloscope.

Digital PWM signals utilize square waves in a different fashion. In a set time interval, microcontrollers measure the length of a "high" wave and compare it to the overall length of the time interval to get a reading. A "high" signal is simply the signal representing the "1" or upper part of the square wave, and the "low" is the part of the wave equivalent to "0".

For example, if the time interval was 10ms, and the square wave started at (0,0) then almost immediately jumped up to (0.00001ms, 1), then stayed at that point until coming back down at (8ms, 0), we know that the data signal represented 8/10 of the bits.

Using an oscilloscope, we set the frame to move at the time frame of the encoder, meaning that we would basically be moving our eyes at the speed of the wave of the encoder and seeing what it is doing. We then connected an Arduino to the scope and turned the encoder, showing our varying results in the pulse width, as seen in the video below.

Encoders like this one use voltage to represent high's and low's over a PWM cable. For this specific encoder, the "low" was a voltage signal of about 0.4v, and the high was around 5v. Because microcontrollers can really only read voltage values, they use this to represent data.

In this video, it appears that the signal has the ability to just jump up to the high voltage instantaneously, but I became suspicious of this as I did not find it physically possible for a voltage to snap up from 0.4v to 4v, and I was curious to see if the scope could pickup on the quick change. With some frame adjusting and zooming, we were able to find the line showing the voltage rising up, overshooting a small amount, and then oscillating and consolidating around the standard "high" voltage.

See All