4
\$\begingroup\$

I am new to electronics and now I wanted to try to use an oscilloscope to measure a PWM output signal.

I made a simple circuit with a Raspberry Pi Pico microcontroller and connected an LED on a breadboard with a resistor to a GPIO. I wrote some code to use PWM on this GPIO and got the result that I expected, the LED is lit up, but not fully. The frequency I tried to use is 40kHz.

Then I connected my oscilloscope for the first time. It is a GW Instek GDS-1054B. I only use a single channel probe for this task. The only adjustments I made on the oscilloscope is to adjust the vertical scale and the horizontal scale while running.

I expected to see a clear square wave and hopyfully some interesting data about time and frequency, but instead, even when in a stopped mode, I get multiple quite blurry square wave lines. This is the best result I could get when using the scale adjustments. What am I missing? Is this the best it gets? There are almost no useful numbers in the picture. I see a frequency data point, but it seem to change when I change the scale. When I scale out, it seem to be about ~49kHz and when I scale in, it gives me a number around ~2.x kHz - not what I expected to see.

oscilloscope

\$\endgroup\$
12
  • 3
    \$\begingroup\$ How did you configure triggering to the measured signal? Have you tried pushing some sort of "auto" button, or referring to manual how to set up triggering to see what you want? \$\endgroup\$
    – Justme
    Commented Mar 15, 2023 at 20:55
  • 3
    \$\begingroup\$ If you did not configure triggering, what did you expect to see, instead of just multiple blurry lines of incoherent square waves? What did you try to do to see stable signals, correctly triggered to rising or falling edge of your choise to a voltage level of your choise? \$\endgroup\$
    – Justme
    Commented Mar 15, 2023 at 21:12
  • 3
    \$\begingroup\$ Oscilloscope 101: setting the trigger. \$\endgroup\$
    – winny
    Commented Mar 15, 2023 at 21:20
  • 1
    \$\begingroup\$ Did you connect the scope ground? It appears that your signal is drifting vertically, possibly due to line/mains 50/60 Hz noise. \$\endgroup\$
    – Mattman944
    Commented Mar 15, 2023 at 21:55
  • 1
    \$\begingroup\$ @Mattman944 nope, perhaps that is what I need. \$\endgroup\$
    – Jonas
    Commented Mar 15, 2023 at 23:14

3 Answers 3

9
\$\begingroup\$

Your trace looks like there's no common ground between the scope and the circuit under test, the Raspberry Pi. I suspect this because the output doesn't have clear 0 or 3.3V levels, possibly indicative of capacitive coupling between disparate grounds.

Make sure your Raspberry Pi's ground and the oscillosope's ground are connected together. You can use the ground clip on the probe to connect to 0V on the Raspberry Pi:

enter image description here

Remember that the 'scope is measuring the difference between two potentials, and so you have to give it two potentials, one which we call "zero volts", or ground, and the other being some signal that varies in potential relative to that zero point.

However, be careful. Once you have connected grounds together, you can't then connect the ground clip on another probe to a different node in the circuit under test, because those inputs all share the same ground, which is connected to mains Earth. There are serious hazards to avoid.

For scope safety tips, watch the video entitled "how not to blow up your oscilloscope", by the legendary Dave Jones, from the EEVBlog.

\$\endgroup\$
8
\$\begingroup\$

It should be no trouble at all to capture a PWM signal with an oscilloscope.

Here's a picture of a PWM signal from one of my own projects:

enter image description here

The oscilloscope that was made with is nearly sixty years old. Your more modern scope should be able to do at least that well.

I expect the problem lies in the triggering. To get a clean capture, you need for the oscilloscope to start the measurement cycle at the same point in the repeating signal.

According to the GW1000 series user's guide (for your scope,) the trigger controls are on the lower right corner (marked 6 in the picture.)

enter image description here

  • Make sure the ground clip of the scope probe is connected to the ground of your test circuit.
  • Make sure the channel you are using is set to DC coupling.
  • Set the trigger input to the channel you are using.
  • Set to "edge trigger."
\$\endgroup\$
5
  • \$\begingroup\$ Ok, so I cannot use a continuous probe for this? \$\endgroup\$
    – Jonas
    Commented Mar 15, 2023 at 21:08
  • \$\begingroup\$ What is a "continuous probe?" Just connect a standard scope probe to the PWM output and connect the ground clip to the LED circuit ground. \$\endgroup\$
    – JRE
    Commented Mar 15, 2023 at 21:19
  • 2
    \$\begingroup\$ @Jonas You can have it continuously trigger - if that's what you're asking. But you cannot have it free-running. Because the wave is repeating, and the oscilloscope is measuring the wave over and over, you need the measurements to line up every time, or else it will look like a mess on the screen because you will see all the waves in different places. \$\endgroup\$ Commented Mar 15, 2023 at 21:20
  • \$\begingroup\$ @Jonas On an old-style analog scope you could adjust the horizontal scale, so a certain number of waves would fit on the screen before it started again from the left, and then it would line up because it was a whole number of waves (not restarting halfway through a wave). Many digital scopes do not have continuously adjustable horizontal scale, so the only way to make them line up is with the trigger. \$\endgroup\$ Commented Mar 15, 2023 at 21:21
  • 1
    \$\begingroup\$ @Jonas You could also use single-shot mode, so only one screenful of waves is captured and there is no need to make all the screenfuls of waves line up on the screen because there is only one. \$\endgroup\$ Commented Mar 15, 2023 at 21:22
3
\$\begingroup\$

What you normally see when someone posts an image of an oscilloscope signal is that signal which has been captured by a "trigger", as others have pointed out.

What a trigger setting does is tells the scope what to capture, and at that moment in time is centered on your scope screen. If the signal is a repeating pattern, it looks stable on the screen.

There are many types of trigger settings. The most common, and which would work here, is on the "rising edge" of the signal. So let's say your signal is going between 0 and 1 volt and you expect a square wave. You could set your trigger function to trigger at 0.5 volts. So you hook everything up, and whatever you're measuring is turned off, and 0 volts (ground). Nothing happens on your screen because the 0.5 threshold has not yet been reach, so no "trigger" has happened. You turn your Pico on and the signal starts to generate. Your scope will identify the first time the signal goes over 0.5V in the upward direction (e.g. from below 0.5V to >=0.5V). At that moment the scope will capture the signal and display it.

If your trigger setting is a "Single" then your scope will be in the "stopped" state, and nothing else will change. If your trigger setting is "Normal", the signal will capture and update every time the 0.5V threshold is met. If your PWM width doesn't change, you may not notice that your scope keeps redrawing the screen. If your PWM width does change, and you're set to "Normal" mode, the screen will update and you'll see the signal width change on your screen.

There are other settings on your scope which will tell it how to persist that display. For instance, usually you'd have the display completely redraw the next time the riding edge was triggered. But you could also have it where it shows all the traces it captured for the last 3 seconds, for example.

Look up "oscilloscope triggering" on YouTube and there's a million videos on the different types of triggers and if you search for your own scope model, maybe even exact instructions so you can find it in your menus.

Here's a great video series for Scopes 101 learning: https://www.youtube.com/watch?v=j2vch6wAddc

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.