Electrical – Sine wave shows up on oscilloscope but keeps moving

arduinooscilloscopesine

I'm fairly new to electronics and new to using an oscilloscope. I followed a youtube video to setup a sine wave using an Arduino Uno and a capacitor to detect on my Tektronix 2235.

https://www.youtube.com/watch?v=ojkUaCSFM30

However, the scope seems to constantly "move" through the sine wave like a bouncing ball instead of just displaying it like on a graph. When just doing a simple digital 5V generation using the Arduino and no capacitor, it just shows a stable graph.

https://drive.google.com/file/d/1ZjEv1hedKXllJgSrIjcxXV_FHNsyUWqc/view?usp=sharing

Is this based upon the rate of change of the voltage or something?

Here's the code I'm using:


int f = 2; //signal freq
float fs = 500.0; //sample freq
int sig[500]; //store signal
float t;  //time value


void setup() {
  // put your setup code here, to run once:
  pinMode(10, OUTPUT);

  for (int i =0; i<500; i++) {
    t = (float) i / fs;

    sig[i] = (int) (127.0 * (sin(2*3.14*f*t) + 1.0) );  //127 is 1/2 of 255, the max voltage value
  }

}

void loop() {
  for (int i = 0; i<500; i++) {
    analogWrite(10, sig[i]);
    delay(2);  //sampling interval
  }

}

The scope is set to 1V / div and 10 microseconds.

Best Answer

You are using a very low sweep time, and generating a very slow signal from your Arduino.

The code claims it is generating a 2 hertz signal. That is, 2 cycles of the sine wave in one second.

If your scope were set to 10 microseconds per division like you say, then on your 10 division wide oscilloscope display you would only see 1/10000 of a second. You would only see a short section of the wave on screen, and it would look like a straight line.

Since you can see approximately 2 full cycles of the wave on the display, your time base is set to something like 0.1 seconds per division.

This explains why the trace "looks like a bouncing ball."

The Tektronix 2235 is an analog oscilloscope with a cathode ray tube (CRT) for a display.

It has no memory or analog to digital converter to capture the signal and hold on it screen.

The vertical amplifier (volts per division amplifier) directly drives a pair of electrostatic plates in the tube, causing the electron beam to move up and down.

The time base circuit directly drives a pair of electrostatic plates in the tube causing the beam to move from left to right across the display.

It draws the signal on the light emitting phosphor inside the display with that beam of electrons.

At low speeds, you can see the beam as a dot making its way across the display.

At high sweep speeds, the beam repeats fast enough that it looks like a solid line.

At slow sweep speeds like you are using, you see the spot from the beam as it moves - the "bouncing ball."

You will not get a nice line on the display of your Tektronix 2235 for a 2Hz signal like the guy got in the video.

He is using a digital oscilloscope that captures the signal with an analog to digital converter, stores the measurements in memory, then displays them on an LCD like a picture on your PC monitor.

What you are seeing is normal and correct for an analog oscilloscope.


Do not crank up the brightness of the display to try and get a solid line at slow sweep speeds. You will damage the CRT. If the tube gets damaged, then your scope is shot - replacing the tube will cost as much as replacing the whole scope, if you can get a replacement tube at all.

You have it set very bright in your video. There is a reflection of the trace that goes across the face of the scope.

Turn the brightness down, now before using the scope for anything else.


If you really need to measure slow signals at low sweep speeds on an analog oscilloscope, then I recommend using this software together with a web camera in an enclosed mount as described here.

The software has a persistence mode that you can use to make slow signals more visible.