Arduino oscilloscope tutorial

I recently got a new digital storage oscilloscope and I was thinking about practicing using it on an arduino. I searched for arduino oscilloscope tutorials and all of the results are for making an oscilloscope with an arduino. Do any of you have any links to using an oscilloscope on an arduino? If not, maybe you can just give me some simple ideas? I'm in between projects right now but will be starting something new soon and just want something simple to practice on for now.

There's nothing special about using an oscilloscope to examine waveforms generated by an Arduino. Connect probe ground to Arduino ground, connect the probe tip to the pin with the signal to be measured.

First learn how to set up and use the oscilloscope in general, then you can also make use of it with the Arduino.

Just find a general guide for using an oscilloscope if you're unsure. No need to include "Arduino" in the search term, since an oscilloscope is a generic device.

Basically you just need to learn how to use the controls on the oscilloscope to set up for the frequency and amplitude being examined. Again, not Arduino specific, but dependent on the frequency etc.

You could Google "How to use an oscilloscope".

MrGibbage:
I recently got a new digital storage oscilloscope and I was thinking about practicing using it on an arduino. I searched for arduino oscilloscope tutorials and all of the results are for making an oscilloscope with an arduino. Do any of you have any links to using an oscilloscope on an arduino? If not, maybe you can just give me some simple ideas? I'm in between projects right now but will be starting something new soon and just want something simple to practice on for now.

which one ? was thinking of getting a basic one.

Here's a some code that outputs a 20 KHz, pulse, see if you monitor the output on the scope

/* sketch to output burst of 20KHz signal
 
 run on regular Arduino
 */
byte triggerIn = 2;
byte triggerOut = 3;
int pulses = 0;
byte pinState = 0;
byte pulsing = 0;

unsigned long currentMicros;
unsigned long nextMicros;
unsigned long duration = 25UL; // flip every 50uS = 20KHz pulse
unsigned long elapsedMicros;

void setup(){
  pinMode (triggerIn, INPUT);
  digitalWrite (triggerIn, HIGH);
  pinMode (triggerOut, OUTPUT);
  digitalWrite(triggerOut, LOW);
  Serial.begin(115200);
  Serial.println("hello");
}
void loop(){
  //  Serial.println(pulsing);
  if (pulsing == 0){
    if ( digitalRead(triggerIn) == LOW){
      //      Serial.println("starting");
      pulsing = 1;
        currentMicros = micros();  // get times caught up & current
        nextMicros = currentMicros;
    }
  }
  while (pulsing == 1){
    currentMicros = micros();
    elapsedMicros = currentMicros - nextMicros;
    if (elapsedMicros >= duration){
      nextMicros = nextMicros + duration;
      pulses = pulses +1;
      pinState = 1 - pinState;
      if (pinState == 1){
        PORTD = PORTD | 0b00001000;
      }
      else {
        PORTD = PORTD & 0b00000111;
      }
      if (pulses == 672){
        pulses = 0;
        pulsing = 0;
        delay (500); // debounce button push that starts pulse train
      }
    }
  }
}

And for another test you could generate a simple low frequency 490Hz/980Hz, (pin dependent), square wave at 50% duty-cycle using 'analogWrite(pin, 127)', then set the scope trigger to "Internal".

Thanks for the ideas! I will do some building/tinkering tonight. By the way, I got the Rigol DS1054Z from Amazon.

CrossRoads:
Here's a some code that outputs a 20 KHz, pulse, see if you monitor the output on the scope

let's see what I learned.

After triggering by putting a low on pin2, the arduino puts this out for 16.8ms.
It looks like the period is 50uS, which makes sense for a 20 kHz wave (1/20,000 = 0.00005, or 50uS)
So, the duration of 16.8ms makes sense because the sketch puts out 672 pulses, times 50uS/2 each totals 16.8ms. I guess we had to divide by two because the pulse counter increments at each change??

What I didn't find was if there is a way for the scope to count the number of pulses. That would be cool, I think. I don't know if it can do that or not.

Finally, can you tell me a little about the PORTD lines in the code?

Port manipulation was used instead of digitalWrite to control the outputs much quicker for faster cycles.

Make a bit High:
PORTD = PORTD | 0b00001000; // D3 high without impacting other bits (0,1,2 specifically)
1 OR anything = 1
0 or anything = anything

Make a bit Low:
PORTD = PORTD & 0b00000111; // D3 low without impacting other bits (0,1,2 specifically)
0 AND anything = 0
1 AND anything = anything

The 672 counter was to limit the pulse stream for a short time, I don't recall what that was being used for.

Cool! Thanks, @CrossRoads!

I was wondering, is there an easy way to make a sine wave or triangle wave with an arduino? Any ideas for reading signals on the SPI or I2C pins?

Sine/triangle: can use an external DAC to create true analog output levels.
Example:

Writing data is easy:

digitalWrite(ssPin, LOW):
SPI.transfer(highByte(dataWord));
SPI.transfer(lowByte(dataWord));
digitalWrite(ssPin, HIGH);

Run that in a loop, with data coming from an array (for sine waves) or make up data as you go (easy for triangle).
Speed of loop will determine the frequency of the periodic signal.
dataWord will be xxxxdddddddddddd
where xxxx are 4 bits of control, and ddddddddddddd are 12 bits of data, 0x000 to 0xFFF. See Figure 5-1 of the datasheet (page 23).

Reading signals on the SPI or I2C pins? You can use either bus to connect to sensors to read all kinds of things.
As asked, sounds like you just want digitalReads on the associated pins.