Week06: Electronics Design¶
group assignment
use the test equipment in your lab to observe the operation of a microcontroller circuit board
This article was written by Shintaro Ito.
01. Oscilloscope settings.¶
- oscilloscope Information
Item | Details |
---|---|
Manufacturer | Tektronix |
Series | TBS1000B |
Model | TBS1202B (200MHz), TBS1152B (150MHz), TBS1102B (100MHz), TBS1072B (70MHz), TBS1052B (50MHz), TBS1032B (30MHz) |
Frequency Band | 200MHz, 150MHz, 100MHz, 70MHz, 50MHz, 30MHz (30MHz model is limited to North America and Europe) |
Number of Input Channels | 2 |
Maximum Sample Rate | 2GS/s on all channels |
Record Length | 2.5k points on all channels |
Trigger Function | Advanced triggers (pulse trigger, selectable line video trigger, etc.) |
Display | 7-inch (17.78 cm) WVGA (800×480) Active TFT Color Display |
Automatic Measurement Items | 34 types |
FFT Function | Dual-window FFT (simultaneous display of time domain and frequency domain) |
USB Port | USB host port on the front panel, USB device port on the rear panel |
Other Features | Limit Test, Data Logging, Frequency Counter, TrendPlot™, Context-sensitive Help Menu |
02. Probe Compensation¶
Compensation is performed first because noise may be present in the probe.
Procedure¶
- connect the probe to the equipment.
- You need to rotate it when connecting.
- The terminal comes out by pulling the probe.
Steps 2, 3, and 4 are described in the image.
A: Main signal terminal: Voltage signal flows here.
B: GND terminal: Terminal for grounding.
- Connect A: Main signal terminal on top of the probe compensation, and B: GND terminal below.
- C: By pressing Autoset, a rectangle for compensation appears and is compensated. Fine adjustments are possible with the compensation driver.
03. Check the signal emitted from the microcontroller with an oscilloscope.¶
Microcontroller and Environment Used This Time¶
- Xiao rp2040
- macbook air M1
Procedure¶
-
Prepare an IDE “Thonny” that has the function of writing Python to MicroPython.
-
You can download it from here.
-
-
Connect Xiao rp2040 to the PC with TypeC while pressing the boot load button. Then you can connect to the PC in boot load mode.
-
To convert XIAO RP2040 to Micro Python, you need to update to Micro Python firmware. It seems that the firmware for Raspberry Pi Pico can be used, so download and use it. You can download and write it from the following site.
-
To write the downloaded firmware to Xiao rp2040, you can use either the file manager or the terminal command. I moved it with the mv command because the file manager was malfunctioning. The command is
mv ./ ~/Volums/NO NAMME/
.Warning
The file path is different depending on each environment, so this command cannot be used as is.
-
After writing, have Thonny, the IDE, recognize Xiao rp2040. To make it recognize, move to the interpreter tab from Tools > option, and set as follows:
- Device: MicroPython (Raspberry Pi Pico)
- Port: Serial port of XIAO RP2040
Warning
The serial port differs depending on each environment, so select the port for your environment.
-
Write the code
- This time’s code
main.py
from machine import Pin, PWM import time # Output pin (GPIO of RP2040) PWM_PIN = 7 # PWM initialization pwm = PWM(Pin(PWM_PIN)) pwm.freq(50000) # Set PWM frequency to 50kHz pwm.duty_u16(32768) # 50% duty with 16bit value (range of 0 to 65535) while True: time.sleep(1) # Maintain PWM signal in an infinite loop
- To write, save as main.py, then right-click the target from the file list on the left and select write.
- This time’s code
- After writing, the signal should be outputting. Connect the probe and check the signal. At this time, the output pin needs to be re-read between Xiao rp2040 and Raspberry Pi pico.
-
The re-reading is as shown in the table below.
-
Connect the probe to GND of Xiao rp2040 and pin 7 set in the code (5pin in xiao rp2040 by re-reading).
A: Main signal terminal: Voltage signal flows here.
B: GND terminal: Terminal for grounding.
-
make a measurement with an oscilloscope. The information on the measurement screen is as follows .
- Average voltage: 1.68V
- Voltage offset: 2V
- Time Base (time scale): 10.0µs/div
- Ch1 (Channel 1 setting): 100mV/div Sampling Rate: 50.0006kHz
- Peak-Peak voltage: 6.80V