Subsection2.2.2Part 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.
Figure2.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 a laptop over USB; flying-lead cables reach your breadboard.
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.
Figure2.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.
Each channel has a plus (signal) and a minus (ground-reference) lead.
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.
Figure2.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.
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).
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.
Figure2.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.
Time Base 100 ms/div, 2 V/div on both channels, CH2 offset β6 V: CH1 (orange) and CH2 (blue) pulses 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.
Figure2.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.
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?
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.