Exercise: Analog Sensing with the Pico¶
The world is an analog place; physical phenomena have continuity and exist over time. To represent a physical property computationally, the physical process information must be transduced into electrical form and then converted from an analog voltage into a digital number by an analog-to-digital converter, or ADC.
This is a wide and deep topic ranging from signal and information theory to robotics and epistemology, and we will only just begin to explore this idea. But to start, this exercise will use sensors which represent a physical condition as a varying voltage which we will process as a stream of integers.
Objectives¶
After this exercise, you should be able to:
Sense a physical process using an analog sensor.
Structure a program to continuously process sensor data.
Apply program logic to detect events of interest.
Reference Guides
Please review the following reference guides as needed:
Reference Circuits¶
Steps and observations¶
Wire up the circuit to connect a photointerrupter to an analog input.
Try the sample code from Analog Input/Output Examples - Raspberry Pi Pico.
Use the plotter in the mu editor or Arduino IDE to show the raw data.
Tune the thresholds in the code for your device.
Challenges¶
If you would like to explore more, please consider the following optional challenge questions.
How fast is the Pico ADC?