How to make a capacitive sensor with Electric Paint and Arduino
Discover capacitive sensing with Electric Paint and an Arduino
Capacitive sensing is a great way to create touch and distance sensing interfaces that are low cost and that can be integrated behind another material. Similar to inductive sensing, capacitive sensing detects changes in the local electric field and these changes are then detected as a touch event.
You can make make a simple capacitance sensor using a pad of Electric Paint, an Arduino and a resistor. When correctly constructed, this sensor can detect the presence of a person from up to 300 mm and can work behind any non-conductive material, such as glass, wood, plastic, etc. By changing the resistor value and by changing the size of the sensor, you can create either just a capacitive touch sensor or a whole range of capacitive proximity sensors.
All credit for the code goes to Paul Badger for making this so easy to implement, we just modified it a bit.
If you are a fan of experimenting with a capacitive sensor, the Touch Board comes with 12 capacitive electrodes and you can use each electrode to trigger a whole range of different outputs
Step 1 Paint your sensor
First, you need to paint your sensor with Electric Paint. We painted a square that is just about the size of our hand. You can paint it on any non-conductive surface, we used card. The size of the pad can impact the sensitivity of the sensor, so try a few different sizes if you want and see how this changes the way that the sensor reacts. Leave your sensor pad to dry.
Step 2 Build the circuit
While the paint is drying, you can build your circuit with your Arduino, a breadboard, some wires and a large resistor. We used an Arduino Uno and a 1MΩ resistor. Connect the resistor between pin 4 and pin 2. Pin 4 is referred to as the “Sensor Pin” and Pin 2 is referred to as the “Receive Pin”.
Step 3 Connect to the Electric Paint
Once you have your circuit built you can connect it to the pad of Electric Paint. We used a crocodile clip and trimmed it to connect it to the paint. Connect the other end to pin 2 on the breadboard.
Step 4 Upload the code
First, you need to install Arduino’s CapSense library. If you currently have your Arduino IDE open, close it first. Download the library and move it to the library folder of your Arduino folder. Reopen Arduino and install the library via
Now it’s time to upload the sketch. You can download it here. Open it, Arduino will ask you to move it, to which you can reply “Yes”. Connect your Arduino Uno to the computer and upload the sketch.
Step 5 Test the sensor
Open the Serial Monitor of Arduino, you should a constant stream of numbers. Hover your hand over the sensor and you see the numbers changing! This is your sensor at work, displaying the current measurement. Touch the pad to see the largest change!
Step 6 Next steps
Now you have explored capacitive touch and proximity sensing you can paint your very own touch sensor and proximity sensor. The sensor doesn’t need to be square, you can paint your own designs.
Capacitive sensing with the Arduino is very limited. The capacitive sensor is very easily influenced by noise and changes in the environment. To adjust the sensor requires constant calibration. The Touch Board has been designed to easily implement capacitive sensing.