Skip to main content

Subsection 2.2.2 Part 2: The Analog Discovery 2 Oscilloscope

Next we’ll watch a signal change in time. The instrument we’ll use all term for this is the Analog Discovery 2 (AD2), a compact USB instrument that combines a two-channel oscilloscope, a waveform generator, a logic analyzer, and more in a pocket-sized package. Plug it into your laptop and open the Waveforms application: it shows you the actual voltages on your circuit as they change. We’ll point it at the LEDs of a blinky program first, where we already know how wide a pulse should be.
Figure 2.2.1. The Analog Discovery 2 (AD2). The USB port connects to a laptop running Waveforms. The multicolored β€œflying lead” cables connect to your breadboard and Nucleo board.
The AD2 connects to your circuit through flexible flying leads, color-coded wires that plug directly into breadboard holes. The two oscilloscope channels are labeled 1+/1βˆ’ (orange) and 2+/2βˆ’ (blue). The minus leads have a white stripe. Always connect these to your circuit’s GND rail.
Figure 2.2.2. AD2 flying-lead connector pinout. Channels 1 and 2 each have a plus (signal) lead and a minus (ground reference) lead with a white stripe. Additional leads support the waveform generator, digital I/O, and power supply, covered in later labs.
We’ll connect both minus leads to GND, then channel 1’s plus lead to one LED anode and channel 2’s plus lead to a second (FigureΒ 2.2.4), with blinkySEQ.c running on the Nucleo so that there is something to look at.
Figure 2.2.4. Wiring the AD2 to observe two of the three LEDs from Lab 1. The minus (white-stripe) leads connect to ground; the plus leads of channels 1 and 2 connect to two LED anodes.

Activity 2.2.2. Open Waveforms and Check Your Signals.

(a)

Plug the AD2 into your laptop with its USB cable and open Waveforms.

(b)

Make sure Waveforms is connected to your AD2 and open Scope. Set Time Base to 100 ms/div, Range to 2 V/div on both channels, and the Offset of CH2 to βˆ’6 V (FigureΒ 2.2.5).
Figure 2.2.5. The Scope settings for this activity.

(c)

Press Run, or Scan if that is what the button says. Press Single for a steady picture.

(d)

Compare your scope view with the picture that follows. If it looks different, check your wiring and your program before you go on.
Figure 2.2.6. What the scope should show with blinkySEQ.c running (every delay set to 100 ms) and the AD2 wired as above, with Time Base 100 ms/div, both channels at 2 V/div and CH2 offset βˆ’6 V: orange (CH1) and blue (CH2) pulses that alternate.
In the Scope view, four controls do most of the work. Time Base sets how much time fits across the screen: 100 ms/div shows a full cycle of our 100 ms blink, and 20 Β΅s/div is where switch bounce becomes visible. Range sets the vertical scale in volts per division; adjust it until the waveform fills roughly half the screen height. Offset shifts one channel up or down, which is how you separate two traces that would otherwise overlap. Trigger starts the capture when a signal crosses a threshold, and that is what lets you catch a single button press.
Figure 2.2.7. Waveforms scope view of a sequentially-blinking LED program. Orange (CH1) and blue (CH2) pulses alternate; each is about 100 ms wide. The settings panel (right) shows Time Base at 100 ms/div, both channels at 2 V/div, with an offset on CH2 to keep the traces from overlapping.
To measure a time interval precisely, use the cursor tool: drag two vertical cursor lines to the rising and falling edges of a pulse and the toolbar shows the time difference between them.
Figure 2.2.9. Using the Waveforms cursor tool to measure pulse width. Two vertical cursors bracket one LED pulse; the toolbar shows the time difference.

Activity 2.2.3. Exploring the Oscilloscope.

(a)

Run the scope and observe both channels. Then experiment with the following settings and answer each question at your table:
  1. What does Time Base control? What value shows one full blink cycle across the screen?
  2. What does Range control? Set it so the waveform fills roughly half the vertical space.
  3. What does Offset do? How do you use it to separate two overlapping channels?
  4. What voltage does the scope measure on a GPIO pin when the LED connected to it is on?

(b)

Measure the pulse width of one LED’s ON period using the cursor tool. Place two vertical cursors at the rising and falling edges of a single pulse and read the time difference from the toolbar. Does it match the delay_ms value in your code?

(c)

Now open your blinkySIM project, in which all three LEDs blink together, change the delays to 1 ms ON / 10 ms OFF, and flash it to your Nucleo. Observe the LED brightness and the waveform on the scope, adjusting the time base so that you can see the pulses. Then swap to 10 ms ON / 1 ms OFF and flash again. The oscilloscope can see the LED going on and off even when your eyes cannot. Discuss at your table why the brightness changes, and where that could be useful.

(d)

You want to observe a switch bounce that lasts about 1 ms. Which time base setting would you choose, and why?

(e)

Save a screenshot of your scope view: File β†’ Export β†’ Image tab β†’ Save. You will need this skill for all future lab reports.