In this tutorial you will learn how to turn any conductive surface into a capacitive touch sensor. This project illustrates how to use capacitive touch to turn on a motor (fan) and neopixel. In this example, all of the components were custom designed and built specifically for this application. Since this method can be used for many different applications, this instructable will cover the behind the scenes making of the circuit and code.
Step 1: Step 1: Gather Materials
The main components needed for this example are:
12volt fan (3 inch)
a lidded jar
12volt wall plug adapter
22k ohm resistor
100k ohm resistor
The video above illustrates the first stages of prototyping the capacitive touch switch. The ball jar and foam sqaures are a stand-in for the final product, they do a great job of illustrating the animation that will happen in finished piece. Although the conductive fabric is acting as a stand-in for the actual switch, you can easily imagine that if it were hooked up to the metal lid of the jar, it would act the same way.
Step 2: Step 2: Download the code
Below is the code used to create this animation.
It is a combination of code taken from Arduino’s capacitive touch library, and Adafruit’s neopixel code.
You must download the capacitive touch library and import it into your Arduino to use this code.
Use your serial monitor to calibrate your capacitive sensor. Note that your values will change depending on whether or not you are plugged into your computer, or connected to earth ground, etc.
calibrate your switch by changing the values in the if statement that reads:
if (total1 <=50)
this if statement controls both the motor and the neopixel.
For more detail: Beacon