This week, I built on my previous sensor-reading experience from Week 6 (Bluetooth Computer Mouse), where I read XY data from an IR laser sensor over SPI. However, due to proprietary limitations of that chip, I decided to work on a different type of sensor reading.
The project picks up from Week 5 (Electronics Design), where I designed a SAMD21E-powered piano synthesizer with capacitive sensing pads on the PCB to drive the DAC output, amplified by an LM4871 circuit into an 8-ohm speaker. Thanks to Anthony, the design was ordered from JLCPCB for the Week 6 group assignment after the failed milling attempt at EDS. A few days later, five FR5 boards arrived, ready for assembly.
After soldering everything together, the PCB looked like this:
My goal this week was to get capacitive sensing working using the QTouch library, as recommended in the SAMD21E datasheet. I started with self-capacitance, which was straightforward to implement using the AdaFruit FreeTouch library. Here's the code I used:
Running this code resulted in the following behavior (with pad readings outputted every 0.1s on Arduino Serial Output):
The ultimate goal is to expand this setup from 5 keys to 24 keys by utilizing the SAMD21Eās mutual capacitance capability, which supports more pins through multiplexing. Unfortunately, FreeTouch does not natively support mutual capacitance, and QTouch library installation presented issues on my M-series Mac. I plan to revisit this approach, diving deeper into the SAMD21E datasheet and exploring solutions for more extensive capacitive sensing.