Skip to content

11. Input devices - Ryan and Kabir

Probing an input device

This week’s group assignment was to probe an input device’s signals. We used Kabir’s input device step-response board to do this.

Measuring the input device when reading the step time

We first used code based on Neil’s steptime example code with the pins changed, in order to see how the steps differ based on how the step-response device is being pressed. This essentially reads the time between the time when the RP2040 sets the digital GPIO on and when it reads the GPIO digital input as high. Therefore, this code waits a variable amount of time for the voltage to pass the high threshold, and this time will increase as the capacitance applied to the step-response sensor increases. To measure this with the oscilloscope, we connected the ground probe to a ground pin, and touched the oscilloscope probe to the input pin on the RP2040.

From this video, we can see that when a finger was touched to the board, the period for the digital input signals changing increased due to the capacitance changing the amount of time the signal required to change digital state.

Measuring the input devices when reading the analog signal

Neil’s other example code for a step response sensor (link) keeps the time for the readings constant, resulting in a constant period. Instead, the difference here is that, after applying the digital signal, the RP2040 waits for a specific amount of time and then reads an analog signal from the input pin, using the ADC, and then takes the sum of the samples in order to create a value that varies with the capacitance applied. We used this code and then observed the input pin using the oscilloscope:

From this video, we can see that as the capacitance on the sensor increases, the analog signals that the RP2040 reads actually decrease; due to the signal taking longer to settle to the desired position, the analog signal that the RP2040 reads after a set time is lower than it would be without any capacitance.


Last update: May 1, 2024