Info page · no simulation · Arduino and electronics
Oscilloscope and Function Generator Basics
What an oscilloscope screen shows, how to read the time and voltage grid, and how an Arduino can give test signals.
This topic cannot be run safely or meaningfully in the simulator, so this page explains it with diagrams, calculations and sample code instead. Everything here is original.
What you will learn
- How to read the time/div and volts/div controls
- How to find the period, frequency and peak-to-peak voltage
- What a function generator makes
In short
An oscilloscope draws voltage against time. The screen is a grid. Each square across is a set time (for example 2 ms) and each square up is a set voltage (for example 1 V). You read the signal by counting squares. A function generator is the opposite: it makes a clean sine, square or triangle wave at a frequency and height you choose.
Try this next
- Measure the 490 Hz PWM from pin 3 and write the period and duty cycle.
- Compare a 5 V USB supply with a switch-mode supply and look at the ripple.
- Measure the time of a button bounce with a single trigger.
Reading the screen
- Time/div: how much time each square across is. Here 2 ms per square.
- Volts/div: how many volts each square up is. CH1 here is 1 V per square.
- Period: the time for one full wave. The sine wave above takes 4 squares, so the period is 4 x 2 ms = 8 ms.
- Frequency = 1 / period = 1 / 0.008 s = 125 Hz.
- Peak-to-peak voltage: the height from the lowest to the highest point. If it covers 3 squares at 1 V/div, it is 3 V.
- Trigger: tells the scope where to start the sweep, so the picture stands still. Set it to the rising edge at the middle of the signal.
Using the probe
- The probe has a switch x1 and x10. In x10 the signal is divided by 10 and the scope must also be set to x10.
- Clip the ground lead to the circuit ground. The scope ground is joined to the mains earth.
- Always check the probe compensation with the 1 kHz test square wave on the front of the scope.
- For fast signals use a short ground spring on the probe tip.
Caution: the scope ground clip is connected to earth. Never clip it to a mains live or neutral wire, and do not measure mains directly. Use an isolation transformer or a differential probe, and ask a teacher to help.
Function generator and Arduino test signals
A function generator gives a sine, square or triangle wave from a few hertz to many megahertz. A school Arduino can make simple square waves that are useful for practice.
| Source | Signal |
|---|---|
| analogWrite on pin 3, 9, 10, 11 (Uno) | About 490 Hz PWM, duty set by 0 to 255 |
| analogWrite on pin 5 and 6 (Uno) | About 980 Hz PWM |
| tone(8, 1000) | 1 kHz 50 percent square wave, from 31 Hz up |
void setup() {
pinMode(3, OUTPUT);
tone(8, 1000); // 1 kHz square wave on pin 8: look at it on CH1
analogWrite(3, 64); // about 25 percent duty, 490 Hz: look at it on CH2
}
void loop() { }For a sine wave filter the PWM with a resistor and capacitor, or use a DAC module or a DDS module such as the AD9833.
Do and do not
- Do connect the probe ground and signal tip to the same circuit.
- Do start with the largest volts/div and reduce until the signal fills the screen.
- Do press AUTO SET if you cannot find the trace.
- Do not feed the scope more than the probe rating (for example 300 V on x10).
- Do not use the Arduino pins to drive more than 20 mA while testing.