Home / news / Using edge count to decode an /

Using edge count to decode an encoder

All engineers know how to use their digital oscilloscope to automatically measure basic parameters such as peak-to-peak voltage, rise time, or frequency on waveforms with a few button presses. Some measurements are not as well known, but they can still come in handy. In a recent email, Julian Lana-Sarrate, an independent embedded designer, described a good method for confirming the operation of a rotary encoder using a rising edge-count measurement. He included the screen shot below.

The rising edge-count measurement is available on some newer scopes. I don’t automatically think of it as, “I’m working with my scope, even though it’s available on my everyday scope and it’s a simple concept.” To set it up, you specify one or two thresholds, and the scope counts the number of times the waveform passes through the threshold(s) in a rising direction. Some instruments also offer a falling edge-count measurement.

In this case, Julian needed to learn more about the pulse output of a rotary encoder. I’ll let him tell the story in his own words:

I could've tried to single sweep the scope, turn the motor one revolution, and then physically try to count the peaks (not very efficient or elegant), but the scope had a pulse-count measurement. I set up the test configuration, enabled the pulse count function, and chose the "positive peaks" count option. I then connected the scope's channel one to my encoder output, set up for "normal" triggering, and then spun the motor one revolution. After a few manual spins of the motor shaft, I found the right scale setting to display one full revolution of pulses on one screen (relative to the speed at which the motor was turned). I received a pulse count of 512.


It turns out this was exactly the count Julian was looking for, and he was able to confirm that the output configuration was as he had expected. Using the edge-count measurement was a quick way to check the output of Julian’s encoder. If you have other ideas for using edge counting on your scope, let me know or post up in the comments section.