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.
click the link below to see what your project can do!
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.
Step 3: Step 3: Hooking Up Your Circuit
Use this diagram to help you set up your circuit.
Pin 6 is the input pin for the neopixel
Pins 4 and 2 control the motor
Note the use of a transistor (tip 120) and 2 separate resistors
Try you keep your circuit as clean as possible. Once you try to place all of the components inside the box wires can get tangled and may act as an antenna, which allows them to conduct even though the wires are all coated. If there is too much noise, try using wire that has its own ground to keep everything safe from conducting when you don't want it to.
Step 4: Step 4: Assemble All of Your Components
Place the fan close to the opening to allow air to flow through your piece.
Make sure that the fan blades are protected so that no wires get stuck in the motor when it starts spinning.
Hot glue your breadbord and Arduino to the bottom plate of your box so that it does not move around inside.
Step 5: Step 5: Congrats!
You've just build a functioning capacitive touch sensor
Here's some confetti to help you celebrate.
Participated in the
Make It Glow Contest