Using a Capacitive Touch Sensor

This blog post on the capacitive touch sensor is an excerpt from Lesson B-17 of our Intro to Robotics program. Level B is the second level in Intro to Robotics and covers working with electronic components (including a variety of sensors), writing intermediate-level code commands in Python, and using a Raspberry Pi to control your electronics projects with the code you write. It contains 575 pages with 18 lessons and 57 projects and activities. Sample lessons and a full scope and sequence for Level B can be found here.

 

The Capacitive Touch Sensor (CTS) in the Intro to Robotics Level B kit measures the capacitance of four touchpads, and will toggle four output lines high or low based on which pads are being touched. Output lines will be low until a pad is touched, at which point the corresponding output will go high.

This model of CTS can run from 3.3V supplied by your Raspberry Pi. This means that the output lines from the CTS will not exceed 3.3V, making them safe to connect directly to GPIO pins on your Pi.

Capacitive Touch Sensor Pinout

When 3.3V and ground are initially applied to the CTS, it will determine the baseline capacitance of the four input pads. When you touch a pad after this initialization process, your skin will change the capacitance that is measured at the pad, and the output line for that pad will be pushed high.

The CTS uses the baseline measurement to determine when a pad is touched or not. If you happened to be touching a pad when the CTS first turned on, your skin capacitance would change the baseline value, and now the CTS can no longer determine if a pad has been touched. To avoid this problem, ensure that you are not touching the pads when the CTS is initially powered on.

There is not much to working with the CTS as an input for your programs. It handles the capacitive touch sensing internally, so you end up with four outputs that switch between high and low, just like any other switch input.

In the activities for Lesson B-17 we guide you through writing the Python code needed to operate the capacitive touch sensor.

Breadboard circuit with capacitive touch sensor and OLED screen

 

This blog post on the capacitive touch sensor is an excerpt from Lesson B-17 of our Intro to Robotics program. Level B is the second level in Intro to Robotics and covers working with electronic components (including a variety of sensors), writing intermediate-level code commands in Python, and using a Raspberry Pi to control your electronics projects with the code you write. It contains 575 pages with 18 lessons and 57 projects and activities. Sample lessons and a full scope and sequence for Level B can be found here.

Older Post
Newer Post
Close (esc)

Popup

Use this popup to embed a mailing list sign up form. Alternatively use it as a simple call to action with a link to a product or a page.

Age verification

By clicking enter you are verifying that you are old enough to consume alcohol.

Search

Your cart is currently empty.
Shop now