6
\$\begingroup\$

I've just purchased my first oscilloscope, a Siglent SDS1202X-E, and am experiencing an issue with a square wave signal generated from an Elegoo Uno R3 board. I've calibrated the probes, and I'm quite confident that the issue isn't with the scope itself.

square wave on calibrated probes Figure 1: What I believe is a properly calibrated square wave.

part of the probe calibration process Figure 2: Part of the calibration process. Here's the video I followed. https://www.youtube.com/watch?v=0JnyLoD06rM

The Issue

When generating a square wave at 60Hz using the Arduino board, there's a significant amount of overshooting/undershooting and ringing. This issue is obsered regardless of the frequency of the square wave (I've tested it at 15Hz, 60Hz, 480Hz, and others).

While I understand some of this is expected, the level I'm seeing (3V off a 5V signal on both the rising and falling edge) seems excessive. This deviation remains consistent across all tested frequencies.

Here are some images of the waveform:

waveform at 60Hz zoomed out exhibiting ringing Figure 3: Waveform at 60Hz. The overshoot/ringing is brief, but substantial.

waveform at 60Hz up close with measurements of ringing Figure 4: Close-up of the waveform, showing the magnitude and duration of the overshoot/ringing.

Code Generating the Waveform

Heres the code I used to generate the square wave:

#define REFRESH_RATE 60

void setup() {
  pinMode(12, OUTPUT);
}

void loop() {
  unsigned long period = 1000000 / REFRESH_RATE; // total period for one cycle
  unsigned long halfPeriod = period / 2; // half period

  unsigned long start = micros();

  digitalWrite(12, HIGH);
  while (micros() - start < halfPeriod); // delay for half period while HIGH

  digitalWrite(12, LOW);
  while (micros() - start < period); // delay for remaining half period while LOW
}

This code sets the 12th pin as an output and generates a square wave signal with a refresh rate of 60Hz.

Troubleshooting Steps

So far, I've tried the following to resolve the issue.

  • Updated the oscilloscope's firmware.
  • Compensated the probes.
  • Calibrated the scope.
  • Set the probe to 10X on both the oscilloscope and the probe itself.
  • Used the ground spring that came with the probe.
    Edit
    • Initially used the included ground spring, connecting it directly to ground, and the probe tip directly to the Arduino pin contact. This approach improved the situation, yet it didn't fully resolve the issue. Any use of an intermediary wire, whether between the ground spring and the ground, or between the probe tip and the circuit contact, led to the problematic results described earlier.
    • Despite using the ground spring correctly the circuit still produced a significant overshoot/undershoot (regarding the setup) of 1V on a 5V 10Hz/60Hz/480Hz square wave signal. This shows that while the ground spring helped, it wasn't a complete solution.
  • Powered the microcontroller with a 9v battery.
  • Turned off all other nearby devices that may create electromagnetic interference.
  • Ensured the oscilloscope probe cable is straight and not coiled.
  • Bypassed the wires typically inserted into the microcontroller holes and connected the oscilloscopes probes directly to the contacts underneath.
  • Moved the oscilloscope probes closer and farther apart from each other.
  • Tried the same setup with a different board (Elegoo Mega 2560 R3).

Despite these steps, the problem persists. I would like to attribute this to cheap probes or similar issues. However, considering the clean square wave generated at 1KHz by the built-in generator and that I've tried connecting the oscilloscope probes directly into the Arduino contacts with no wire intermediaries, I'm at a loss as to the cause of this issue.

Question

Can anyone provide insight into why this overshooting/undershooting is happening, and suggest possible solutions to reduce it? Is this a common issue when generating square waves with Arduino boards, or could there be a specific issue with my setup?

Edit

current setup showing oscilloscope probes connection Figure 5: Current oscilloscope probe connection to Arduino

\$\endgroup\$
10
  • \$\begingroup\$ Do you know what transmission lines and terminations are? Is this overshoot even a problem? \$\endgroup\$
    – DKNguyen
    Jun 13, 2023 at 1:19
  • \$\begingroup\$ Cpine, Your last zoomed picture looks like something with a Q of about 5 or so. (20k:1 for inductance vs capacitance.) At a guess. Given the timing shown, I'd say about 350 nH and maybe 18 pF? \$\endgroup\$ Jun 13, 2023 at 1:55
  • \$\begingroup\$ What probe model that is and what are the probe specs, especially bandwidth? Where do you connect the probes and how? If there is significant distance between the MCU and probing point then the ringing might come from the PCB track already. The MCU likely has very low output impedance and fast slew rate, the PCB track is a wire with inductance and capacitance, and likely not impedance controlled. Did you probe directly from the MCU leg, with the probe ground spring, without the long crocodile clip? \$\endgroup\$
    – Justme
    Jun 13, 2023 at 6:51
  • 1
    \$\begingroup\$ Math Keeps Me Busy - Hi, the 12th pin on the Arduino board, which I'm using to generate the square wave, is only connected to the oscilloscope probe. I've added a picture at the end of the post to show exactly how I'm connecting the probe. Thanks! \$\endgroup\$
    – CPineapple
    Jun 13, 2023 at 23:22
  • 1
    \$\begingroup\$ This is a ground spring picture in case there's a misunderstanding \$\endgroup\$
    – bobflux
    Jan 2 at 23:37

2 Answers 2

1
\$\begingroup\$

I am almost certain that the reasons for those spikes are in the line inductance and not in the osciloscope/probe.

The fact that you measure a similar overshoot for different wave frequencies is expected as the spike is caused by the rising edge (which is indpendant of the frequency) and not the first base frequency.

I recommend you to place a capacitor to ground on the line. This should reduce the spike. Be aware that this will increase the rise-time.

As a general rule, you usually want the rise time to be as high as acceptable to avoid high frequencies creating spikes like you see here.

\$\endgroup\$
0
\$\begingroup\$

You mention measuring with a gound spring but I didn't see any pictures of that.

Figure 5 shows your probe coming in at the bottom of the board and the ground lead coming in from top of the board. When measuring signals in nanoseconds it is important to keep your connections short and closely spaced. You should definitely expect some parasitic inductance to interfere when measuring like in figure 5.

\$\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.