← MicroPython on Pi Pico and Projects

Project 2.2 Companion

Project 2.2 Worksheet: The Potentiometer and Lists

Name: Date: Period:

Use this with Project 2.2: Reading a Potentiometer. Your answers can be short: you do not need full sentences.

voltage divider: two resistors in series that split a voltage; the wiper reads the split
list: an ordered collection of values stored under one name
element: one value inside a list
index: an element's position in the list, counting from 0
iteration: one pass through a loop; this loop iterates 8 times

A. Wiring check

Three wires go from the potentiometer to the Pico. Write the physical pin number each one reaches. Count pins down the left side, then up the right.
Outer leg 1, to 3V3 (OUT)
Outer leg 2, to GND
Wiper (middle leg), to GP26

B. Measurement table

Turn the knob to each position. Read the wiper-to-ground voltage with the multimeter, then read what your program prints. Difference = multimeter minus Pico.

Knob positionMultimeter voltsPico voltsDifference
minimum
1/4 turn
1/2 turn
3/4 turn
maximum

C. The voltage divider on paper

Ohm's law says V = I × R. The wiper voltage is V_wiper = 3.3 × R_bottom / R_total. Use the 10k pot from your kit.

Knob turned all the way to the ground end. R_bottom is 0. What is V_wiper?
Knob exactly in the middle. R_bottom is half of R_total. About what is V_wiper?
Knob turned all the way to the 3V3 end. What is V_wiper?
With the 10k pot (10,000 ohms), what is the current through the whole strip? Use I = 3.3 / R_total. Give your answer in milliamps.
Swap the 10k pot for a 1k pot. Does the current through the pot get bigger, smaller, or stay the same? Does V_wiper change?

D. Lists on paper

Do these before you touch the code. Here is a list:

samples = [31200, 31540, 30980, 31310, 31650, 31090, 31420, 31270]
How many elements are in the list? len(samples)
What is the first element? samples[0]
What is the last element? samples[7]
The spread: max(samples) - min(samples)
Predict what this does, and why: samples[8]

E. Your own data

Hold the knob still. Add print(samples) to your program and copy one printed list.
Its spread, max(samples) - min(samples):

F. Reflection

Why does the program average 8 readings instead of using just one? Use the word list in your answer.