Capacitive Touch Sensitivity

Capacitive touch pads can be finicky, especially for wearables and battery powered projects.  Capacitive touch functionality is happiest when there's a strong ground connection, like you get with a wall plug.  For small battery powered projects there's no real ground.  But that's okay!  Our body's electromagnetic field can work as our ground connection.

When this necklace is being worn against bare skin, the electronics have contact with the body, and through the body, the ground.  You may find the necklace won't change colors if you touch it when you aren't wearing it, or if it's being worn over a sweater or other clothing.  It needs that skin contact to be able to read your touch.  

This can make calibration a little bit tricky, but with some trial and error you can get it to respond correctly.

With your necklace fully assembled, plug it in to your computer's USB port and switch it on.  Open the code in your Arduino window, then open the serial monitor.  You should see numbers scrolling by.  (If you don't see them, try re-uploading the code)

Touch the pendant's face firmly with the pads of your fingers.  You should see a change in the numbers scrolling by when the necklace reads your touch. When you let go, the values will revert.

Now look at your code and find this line near the top:

// Calibrating your capacitive touch sensitivity: Change this variable to something between your capacitive touch serial readouts for on and off
int touch = 850;  

Change the number to a number roughly halfway between your "touched" and "not touched" numbers.  Since I have 700-ish as "not touched" and 1000-ish as "touched", I chose 850.

Re-upload the code.  Now the color should change when you touch the necklace.   

You're not quite done yet!  Unplug the necklace and put it on, so that the back of the necklace is touching your skin (not over your shirt).   See if it still works the same way.  If so, you're golden!  If not, plug your necklace back in and try adjusting this value until it works the way you like.

Color Calibration

There are several other variables you can change that will allow you to customize the way your necklace acts.  

BRIGHTNESS: This will adjust the brightness -- use a value between 0 and 255.

SATURATION: Make your colors more pastel (lower number) or more rainbow-bright (255 max).

COLORCHANGE:  Use this variable to define how much the color value changes each time you touch the necklace. 

The code starts with a hue of 0, also known as "red".  FastLED breaks down hue values on a range of 0-255, with red at 0, yellow around 60, and blue around 180, until it cycles back to red at 255.   Using a value of 50 means that each time you touch the necklace, the hue will jump by 50.  This gives me 6 different modes: red-orange (0), yellow-green (50), green-blue (100), blue-purple (150), purple-pink (200), and red-purple (250).  

Using a value of 30 would give me 8 different color modes, since the hue would jump by 30 each time.  Play with this until you get a satisfying array of colors.

This guide was first published on Oct 11, 2018. It was last updated on Jul 11, 2024.

This page (Calibration) was last updated on Mar 08, 2024.

Text editor powered by tinymce.