A capacitive touch switch is a switch that works by touch. It even works when your hand is close to it. This means you can conceal your switch under plastic, wood, or other insulating material and still trigger the switch by touch.
PART 1: ASSEMBLE THE CIRCUIT
PART 2: PROGRAM THE ARDUINO
BEFORE YOU BEGIN
STEP 1: Download the CapacitiveSensor library.
STEP 2: Unzip the downloaded file, and rename the folder to CapacitiveSensor.
STEP 3: Copy the CapacitiveSensor folder to the Arduino libraries directory (default location c:/Program Files/Arduino/libraries or c:/Program Files (x86)/Arduino/libraries)
STEP 1: Upload this program to Arduino.
STEP 2: Open the Serial Monitor and observe how value1 and value2 change when you touch the bare wires.
You can use these values to trigger an outcome. For example, you can turn a tri-colour LED red when you touch the first wire and turn the tri-colour LED blue when you touch the other wire.
PART 3: CREATE TOUCH PLATES
You can use any conducting material, such as fruits and leaves, as a touch plate. Here’s an example of a touch plate you can make yourself.
With a pencil, draw a solid square on a piece of paper, as shown below. Use a paperclip to connect the square to a jumper wire.
The grounding of the Arduino board is very important in capacitive sensing. The board needs to have some connection to ground. Here are some grounding considerations:
- Connect the mains power supply to the laptop, which in turn is connected to the Arduino via the USB port.
- Connect the Arduino ground to an earth ground, such as a water pipe.
- Run a ground plane (for example, an aluminium foil) under the touch plate (insulated by plastic, paper, etc.) as shown. Connect the ground plane to Arduino ground. This method stabilises the sensor values and increases its sensitivity.
PART 4: HOW CAPACITIVE TOUCH WORKS
The capacitive sensing method toggles the send pin to a new state and then waits for a receive pin to change to the same state. A variable is incremented inside a loop to time this change. The method then reports the variable’s value in an arbitrary unit.
The delay between the send pin changing and the receive pin changing is determined by an RC time constant, where
- R is the resistor value
- C is the capacitance at the receive in CPIN plus capacitance CTOUCH introduced by your hand at the touch plate
You can view our body as helping to draw away the charges from the receive pin, which results in the increase in time to change its state.