Week 11: Input devices¶
For this week, I was interested in the step response sensors which Neil was showing in the lecture this week. I wanted to try using the self-capacitance on a PCB to detect gestures (up and down) which used multiple pads which somebody’s finger could slide down.
I had to rewatch the part of Neil’s lecture about step response sensors a couple times to fully understand what they’re doing, but basically, the increased capacitance results in the voltage taking longer to settle, which can be measured by code.
After searching around I found Akash Badshah’s documentation for input devices which looked moderately similar for I wanted to do.
Electronics design (first try)¶
I first based my design off Akash Badshah’s board (by visually looking at it; I didn’t bother with trying to download his files). I decided to use a SEEED XIAO RP2040 module over an ATTiny since I wanted to try out Neil’s example that used the PIOs to measure the time between steps (hello.steptime.RP2040.py).
My PCB ended up as:
Schematic:
Each pad has a 1M resistor between it and the pin which does the steps, which forms an RC circuit.
After milling the board:
After soldering all the components:
Soldering all the components was annoying, especially since I had set the minimum Trace Clearance in the Bantam Tools menu to 0.15 mm, so the copper areas on the board were pretty close together. This was combined with me trying to solder this late at night while I was pretty tired. There were unfortunately a lot of solder bridges which limited the functionality of my board so I had to limit the code to running on the top four copper pads.
Running code¶
To start, I used Neil’s hello.steptime.RP2040.py example and got code running on pins 26-29 to measure the capacitance via the step time. To do this, I had to install MicroPython to the RP2040 I was using. To do this, I held down the B (bootsel) button and then pressed the R (reset) button on the XIAO RP2040, which set it to the Pico USB mode where I could copy a uf2 file manually to the exposed filesystem. I downloaded the firmware