Beagleplay + Qwiic Capacitive Touch Slider

Photo of a-taylor2

Made by a-taylor2

About the project

Use Python on BeaglePlay to use Qwiic Capacitive Touch Slider and print the output.

Project info

Difficulty: Easy

Platforms: BeagleBoardSparkFun

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

SparkFun Capacitive Touch Slider - CAP1203 (Qwiic) SparkFun Capacitive Touch Slider - CAP1203 (Qwiic) x 1 BeaglePlay BeaglePlay x 1


This is a simple starter project for any BeaglePlay beginner. Just to help you get a feel for BeaglePlay and software used with it. I am living proof!

Let's Get Started:

First you will connect the Capacitive Touch Slider to the Qwiic port on the BeaglePlay.

I am using an ethernet cord for Wi-Fi Connection on my BeaglePlay. You are able to use what you would like for Wi-Fi Connection.

Next we want to check the buses available with this command:

ls /dev/ |grep "i2c"

Now we will detect which i2c bus is connected to our Capacitive Touch slider.

You would use this command:

i2cdetect -r -y #

this is to help scan each bus to see where the Touch Slider is located. Your code will have whichever number you use to locate the bus. We are looking for the devices address, so that we may modify our own code.

There are 6 buses to look through, try each one by changing the number at the end (i.e. i2cdetect -r -y 3)

In some cases, you will find a symbol UU. This indicates that something is already pre-programmed here in BeaglePlay. This is not the address that we are looking for, the slider will show a number. After you have located the bus that has the connection, you will modify your code to that bus.

As you can see, the device address is 28 on bus 5. You will have a specific number for your code.

(Lil Hint: When using QWIIC connector, the address will always be found in bus 5)

Once that is done, you can copy the code used below.

from CAP1203py.cap1203 import CAP1203
import smbus
bus = smbus.SMBus(5) # For BeagleBoard
cap = CAP1203(bus)
while True:
res = cap.get_touched()
# <Pad.Right: 4>
res = cap.get_touched()
# <Pad.0: 0># True

I put a link to the original code I used below. Mine is an example.

QWIIC Capacitive Touch Slider Code

Now you can run this code by pressing space and enter.

Now you will be able to slide your finger across the pad, and the different sections will output. Examples of the output can be shown below.

Pad.0 will show if there is no interaction with the Touch Slider.

This will be the output when you slide your finger across the different sections.

How Can I expand on this?

I am so glad you asked, Let's discuss!

A fun idea I had was adding on an LED. Programming the LED to change colors depending on which region is touched. For example, the LED would flash yellow when touched in the left region. For the right region, it could flash purple. Just to add a fun twist on the example.


Leave your feedback...