PHYS 351 LAB 8
ADC with SPI and Remote Access
© Ran Yang, Ph.D.
SUBMISSION
Submit the completed lab report as a PDF on Gradescope.
Due: 2:00 p.m. next Monday.
Introduction
This week, we continue to explore different sensors communicating with a Raspberry Pi via serial protocols. While I2C is a popular serial protocol due to its simplicity, we will investigate another synchronized serial protocol called SPI (Serial Peripheral Interface) with an analog-to-digital converter chip, the MCP3008. Throughout the lab, capture screenshots, pictures, and videos as necessary and include them in your report. Remember to annotate your Python scripts with descriptive comments.
Tasks
- Initial Setup and Configuration
- Connect your Raspberry Pi to the internet.
- Create a new directory for this lab using terminal commands.
- Update and upgrade the operating system.
- Enable SPI in the Raspberry Pi settings.
- Download
ADC3008_SPI.pyto your newly created directory.
- ADC Implementation
- Connect the MCP3008 ADC correctly to the Raspberry Pi.
- Write code to read the output as a voltage (
v_volt). - Demonstrate your program to the course instructor or a TA.
- Voltage Testing and Calibration
- Build a circuit that can output various voltages from 0 V to 3.3 V.
- Connect the circuit output to a digital multimeter (DMM).
- Verify that your Python code output matches the DMM readings, with proper error handling.
- Document the testing process and results.
TASK APPROVAL
Tasks 1–3 (ADC Setup and Calibration)
Course Instructor or TA Signature:
Date and Time:
- Code Enhancement and Data Analysis
- Modify your code to output
v_frac(0 to 1023) based on input voltage, for at least 20 data points. - Create and plot the
v_voltvs.v_fracrelationship. - Include analysis of the linearity and accuracy of the measurements.
- Modify your code to output
- Waveform Analysis
- Use a function generator to create a sine wave input.
- Connect the signal to both the ADC and an oscilloscope.
- Modify your code to plot voltage vs. time, matching the oscilloscope trace.
- Determine the maximum frequency capabilities of the setup.
- Analyze and document the frequency limitations.
TASK APPROVAL
Tasks 4–5 (Data and Waveform Analysis)
Course Instructor or TA Signature:
Date and Time:
- SSH Remote Control
- Find and document your Raspberry Pi’s IP address.
- Enable remote control in the settings.
- Establish an SSH connection from your laptop.
- Demonstrate remote operation of your voltage measurement program.
- VNC Remote Desktop
- Configure a VNC server on the Raspberry Pi.
- Install a VNC viewer on your laptop.
- Demonstrate remote desktop access.
- Run and display the temperature sensor program remotely.
TASK APPROVAL
Tasks 6–7 (Remote Access)
Course Instructor or TA Signature:
Date and Time:
Submission Reminder
- Complete circuit diagrams and connections for the MCP3008 ADC setup.
- An explanation of the functionality of
ADC3008_SPI.py. - Your modified Python scripts with clear comments explaining the functionality.
- Plots and analysis of voltage measurements and waveform data.
- Documentation of frequency limitation testing and results.
- Screenshots demonstrating successful remote access implementations.
- A discussion of any challenges encountered and their solutions.
- (Optional) A link to a video demonstrating the remote control capabilities.