Make Every Week: Sensing Human Touch

Capacitive sensing is how your phone’s touch screen works — basically detecting the natural charge in a person’s body on the screen.

I’ve seen Team Blinky friend Liza Stark play and build simple touch sensors using the same technique with Arduino, so this week I gave it a try.

My goal: Use a touch sensor instead of a button on the Monthly Mood Cube.

It turns out to be pretty easy.

The code

There’s great information about detecting capacitance with Arduino here, but essentially the steps to get started are:

  • Download this “CapactiveSensor” library
  • Unzip it
  • Rename the folder from CapactiveSensor-master to CapacitiveSensor
  • Drag that folder into your Arduino libraries folder, which is located within the same folder you keep your sketches in. (More on that here if you're new to this.)
  • Launch (or relaunch if it’s running) the Arduino program

Once that was done, I saw “CapactiveSensor” under File -> Examples, and modified it a bit to make it simpler:

Wiring it up

The circuit is pretty simple. The trickiest part was having a hefty resistor, upwards of 10M-ohms. The most resistive one I had was 1M-ohms, which worked fine.

In my case, the “foil” part is a little heart cut out of copper taffeta I had, which I soldered to a wire.

Making it go

I uploaded the sketch to the Arduino, and opened the Serial Monitor (Tools -> Serial Monitor), making sure the window was set for 9600 baud. Then I watched the numbers jump every time I touched the little piece of copper attached to Pin 6!

For the Mood Cube, I altered the code a bit to check whether the sensor_reading value was above a certain point (I used 300). If it was, the code triggered the button function.

This way, I avoided actually mounting a button, and also made it feel a little less techie (at least on the outside).



#MakeEveryWeek is a challenge to myself to do just that for all of 2015. The original post on the idea is here, and the running list of projects so far is here.