← About PHYS 351

PHYS 351 · Advanced Instrumentation

Lab 3 · LED control & timing analysis

Submission Submit the completed lab report as a PDF on Gradescope.

Due: 2:00 p.m. on the next Wednesday or Thursday.

Policies and Instructions
  1. Report Format: Submit a formal, typed lab report in PDF format. Handwritten lab reports will not be accepted. Hand-drawn circuit diagrams will not be accepted; draw every schematic with software (see Software at the end of this manual). Include screenshots, code, and simulation or measurement results where specified.
  2. AI Policy: The use of any AI tool, including a large language model (LLM), to write, generate, debug, or modify code or any portion of the lab report is prohibited unless the course instructor grants explicit permission in advance. A teaching assistant (TA) cannot grant permission to use AI tools.

By signing below, I acknowledge that I have read and understood the policies and instructions above and agree to follow them.

Student Name (print):

Student Signature: Date:

All tasks in this lab are required.

Preparation Tasks

  1. Setting Up Raspberry Pi:
    1. Turn on the Raspberry Pi computer.
    2. Confirm that you can see the Raspberry Pi OS desktop.
  2. Preparing Your Workspace:
    1. Open the terminal on the Raspberry Pi.
    2. Check the installed Python version.
    3. Create a new directory named “YourFirstName_python” inside /home/pi/Documents.

Basic LED Operations

  1. Blinking a Single LED:
    1. Open VS Code and create a new .py file in the directory you created.
    2. Write code to turn on one LED and save the file.
    3. Construct the circuit based on your code.
    4. Before running the code, show the circuit and code to the course instructor or a TA for approval.
  2. Alternating Between Two LEDs:
    1. Duplicate the .py file from the previous task.
    2. Modify the code to alternate between turning on a blue LED and a green LED every 2 seconds.
    3. Build the circuit and verify its timing using an oscilloscope.
    4. Record the highest frequency achieved and check for timing jitter at higher frequencies.
    5. Save oscilloscope screenshots to a USB drive and then to your computer.
Task approvalTasks 3–4 (Basic LED Operations)

Course Instructor or TA Signature:

Date and Time:

Advanced LED Operations

  1. Sequential LED Lighting:
    1. Save your current program as a new copy.
    2. Modify the code to illuminate three LEDs sequentially. Use a new color, red, for the third LED.
    3. Build the circuit and test your code.
  2. RGB LED Flashing:
    1. Write a program that makes an RGB LED flash its three colors in sequence at a visible rate.
    2. Build the circuit and demonstrate its operation to the course instructor or a TA.
  3. LED Brightness Control with PWM:
    1. Write a program that changes an LED’s brightness using pulse-width modulation (PWM).
    2. Modify the duty cycle and frequency, and use an oscilloscope to monitor the output waveform.
    3. Report the waveform period and on-time in your lab report, and explain how PWM works.
    4. Evaluate whether this method provides better timing compared to previous tasks.
Task approvalTasks 5–7 (Advanced LED Operations)

Course Instructor or TA Signature:

Date and Time:

  1. RGB LED Breathing Effect:
    1. Write a program that makes an RGB LED “breathe” through all three colors using a pattern of your own design.
    2. Build the circuit and demonstrate its operation to the course instructor or a TA.
Task approvalTask 8 (RGB Breathing Effect)

Course Instructor or TA Signature:

Date and Time:

Clean-Up and Data Transfer

  1. Save and Remove Work:
    1. Copy the directory you created in the first task, including all files, to your own computer.
    2. Delete this directory from the Raspberry Pi.
Task approvalTask 9 (Clean-Up and Data Transfer)

Course Instructor or TA Signature:

Date and Time:

Note: Always save your new programs as a new copy for each task.

Submission Reminder

  • Complete, commented Python scripts for each task.
  • Oscilloscope screenshots demonstrating the LED timing (Task 4) and the PWM waveform (Task 7).
  • The recorded maximum frequency and any timing jitter you observed.
  • An explanation of how PWM works and a comparison of its timing performance to the earlier tasks.
  • An error analysis for every task where it applies: the uncertainty of each measured or calculated value, its main sources of error, and a comparison with the expected, simulated, or datasheet value.
  • A discussion of any challenges encountered and how you overcame them.
  • Task 8: your breathing-effect script, a description of your pattern, and a photo or short video of it running.
Software for drawing and simulation

Draw every circuit diagram with software; hand-drawn circuit diagrams will not be accepted. We recommend the free draw.io; the course’s Drawing Circuit Diagrams page shows how to set it up. If a component has no symbol of its own, use the closest one and label it clearly.

Where a task asks for a simulation: the web version of Multisim is no longer available. If you have a Windows computer, you can install the offline (desktop) version of Multisim; ask a TA for the serial number to install it. Otherwise, feel free to use any SPICE-based simulation tool, such as LTspice or ngspice.

← All course materials