Lesson 5: Capacitive Touch
Table of Contents
- Lesson 5.1: Intro to Capacitive Touch on the CPX
- Lesson 5.2: Capacitive Sensing with Everyday Objects
- Lesson 5.3: Making a Capacitive Touch Keyboard
- Lesson 5.4: Making a Lo-fi Capacitive Touch Nintendo Controller
- How Capacitive and Resistive Touch Work
- Next Lesson
In Lesson 5 in our CPX series, we will learn how to use capacitive touch sensing. This is a multi-part series starting with an introduction to capacitive sensing.
Lesson 5.1: Intro to Capacitive Touch on the CPX
In this lesson, we will first introduce the concept of capacitive sensing before building a simple capacitive touch “piano.” We will then show how to visualize the raw capacitance values and capacitance touch threshold values, which are used to trigger capacitance events. Third, we cover how to use both auto-calibration and manual calibration to change the capacitance touch threshold before building a capacitive-responsive instrument (similar to Lesson 4: Light-Responsive Instrument).
Lesson 5.1 Code
Here is a link to the programs we built in Lesson 5.1.
- Code for graphing A1 capacitance
- Code for graphing A1 capacitance, the touch threshold, and recalibration
- Code for capacitive-responsive instrument (proximity!)
Lesson 5.2: Capacitive Sensing with Everyday Objects
Building on 5.1, we will prototype an interactive piano out of everyday objects like an orange, banana, and soda can with the CPX, MakeCode, and capacitive touch sensing. We’ll again show how important it is to measure the capacitance touch values of different objects and to use auto-calibration or manual calibration to configure capacitance touch thresholds.
Lesson 5.2 Code
Here is a link to the programs we built in Lesson 5.2.
Lesson 5.3: Making a Capacitive Touch Keyboard
Building on 5.2, we’ll use capacitive touch sensing to make a custom keyboard and play music and video games with fruit, a coin, and a soda can. Essentially, we’re going to make your laptop think the CPX is a keyboard and have all sorts of fun using different objects as keys!
Lesson 5.3 Code
Here is a link to the programs we built in Lesson 5.3.
Lesson 5.4: Making a Lo-fi Capacitive Touch Nintendo Controller
Building on 5.3, we’ll use capacitive touch sensing to make a custom lo-fi Nintendo NES controller out of cardboard, copper tape, and tin foil and play Super Mario Bros.
Lesson 5.4 Code
Here is a link to the programs we built in Lesson 5.4.
Capacitive Touch Input on the CPX, Adafruit MakeCode Documentation
Calibrate Capacitive Sensitivity, Adafruit MakeCode Documentation
Making Touch Sensor Objects, Adafruit MakeCode Documentation
How Capacitive and Resistive Touch Work
If you want to learn more about how capacitive and resistive touchscreens work, see below:
- Capacitive Touch Screens, Tufts Final Project 2015
- Using a resistive touchscreen, DroneBot Workshop
- How to Add Capacitive Sensing to Any Arduino Project, Maker.io
In the next lesson, we’ll revisit using the CPX as a programmable keyboard and deepen our understanding.
Previous: Light-Responsive Instrument Next: CPX as a Keyboard