An oscilloscope is an instrument that graphs voltages over time. Engineers and technicians use them to check voltage signals, especially ones that repeat too rapidly to measure with a simple voltmeter.
In this activity, you will:
Same as Measure a Blinking Light with a Voltmeter [1] (shown again below.)
An oscilloscope plot graphs voltage over time. Since your script turns the light on for 500 ms, then off for 500 ms, the plot shows the voltage repeatedly stays at 2.65 V for about half a second and then at 0 V for half a second.
As you can see the script timing is not precise. It spends more than more than 500 ms high and low. The reason for this is because it takes the micro:bit time to execute each statement, and it also takes time for it to send that data to the CYBERscope.
When you adjusted the Time/Div from 1000 ms to 500 ms, you changed the x-axis increments from 1000 ms to 500 ms. The total amount of time it graphed dropped from 10,000 ms to 5000 ms.
This script also started as led_blink from Connect and Blink a Light [5]. Again, the multimeter module is imported for sending data to the CYBERscope. The plot data is sent to the CYBERscope with plot(volts(pin2),"y2"). The plot function sends data to the CYBERscope formatted so that it can be plotted in the oscilloscope display. The value it sends is volts(pin2), which measures the voltage with the P2 pin (through the red alligator clip lead). The "y2" text string is forwarded to the CYBERscope, which results in the data being plotted on its red channel 2 (ch2) trace.
# led_blink_with_plot # <-- changed from microbit import * from multimeter import * # <-- added while True: pin13.write_digital(1) sleep(1) # <-- added plot(volts(pin2), "y2") # <-- added sleep(499) # <-- changed plot(volts(pin2), "y2") # <-- added pin13.write_digital(0) sleep(1) # <-- added plot(volts(pin2), "y2") # <-- added sleep(499) # <-- changed plot(volts(pin2), "y2")
The measurements have to be plotted before and after each pin13.write_digital call. Normal oscilloscopes send many data points; whereas, this script sends just the points before and after each signal level change. The sleep(1) is added between each pin13.write_digital call to give the voltage enough time to rise to its final value.
If you are curious why the sleep wasn’t needed for the voltmeter but is needed here, it’s because voltmeter() measurements are actually the average of ten measurements, taken every 10 ms. In contrast volts() is a single measurement.
In the main activity, you experimented with a 50% duty cycle signal. The high and low times were equal, and the plot showed that. Here, you will change it to a 25% duty cycle and observe the differences in the CYBERscope.
Oscilloscopes have a trigger feature that allows you to position the entire plot on the screen relative to a certain trigger time and trigger voltage. The trigger event can be rising or falling. If the trigger event is rising, it means that the voltage rose above the trigger voltage. Falling means the voltage fell below the trigger voltage. The oscilloscope takes the entire plot and aligns that rise or fall event with the vertical trigger time.
When binary on/off signals are plotted, they are described as having rising and falling edges. The rising edges are the lines that connect 0 V to 2.65 V, and the falling edges are the ones that connect 2.65 V to 0 V.
Change the resistor in the green LED circuit to a 1 kΩ resistor (brown-black-red-gold). What changes do you observe in the graph? (Make sure to switch the resistor back.)
Solution. Remember the Your Turn activity in Measure Blinking Light with a Voltmeter [6]. Your measurements showed decreased voltage. The oscilloscope graph will show the same thing. More resistance resulted in less current. It turns out that the voltage will remain about the same. The increase in resistance results in less current, which in turn results in less light. The LED has (mostly) unchanging forward voltage, so the change in current is simply caused by more resistance. The voltage drops remain about the same, but since there is more resistance, there is less current to get the same voltage across the resistor.
Links
[1] https://learn.parallax.com/tutorials/language/python/led-lights/measure-blinking-light-voltmeter
[2] https://learn.parallax.com/sites/default/files/content/Python/LED/led_blink_with_plot.hex
[3] https://python.microbit.org/v/2
[4] https://cyberscope.parallax.com
[5] https://learn.parallax.com/tutorials/language/python/led-lights/connect-and-blink-light/script-and-tests
[6] https://learn.parallax.com/tutorials/language/python/led-lights/measure-blinking-light-voltmeter/change-resistance