The Touch Board works great out of the box to detect touch, but it's also possible to reprogram the Touch Board to create proximity sensors that allow you to control your project just by waving your hand or approaching the sensors.
The Touch Board has 12 capacitive electrodes that can either be used as touch sensors or touchless sensors, also known as proximity sensors.
When you use the Touch Board for the first time, the electrodes are set up as touch sensors. With Electric Paint and crocodile clips you can extend the sensors and touch other conductive objects or the paint to trigger the sensors. But you can also change the electrodes so that it can detect your hand or finger either from distance or through a non-conductive material, like glass or wood.
If you want to sense proximity, there are two things to consider: the Touch Board's sensors and the sensor design. In this tutorial, we're going to show you how to change the Touch Board's settings so that you can detect with proximity. For this, you have two options, either change the settings in the Touch Board's code in the Arduino IDE or via our Grapher. We're going to demonstrate how to do proximity sensing by using a square that we painted with Electric Paint and connected to the board with a crocodile clip.
Change the settings in code
If you open the default code Touch_MP3 of the Touch Board in Arduino, scroll down to line 148 and 149 where you see the two lines
These are the default settings of the Touch Board. Simply by changing these numbers, you can change the electrodes sensitivity. Decreasing the numbers, for example, to
the electrodes become twice as sensitive and already can detect a hand.
setTouchThreshold always needs to be twice as big as the
setReleaseThreshold variable, so the smallest value you can go is 2 and 1. Note that the lower you go, the more sensitive the electrodes become, but the more sensitive they are, they also become more susceptible to pick up noise. So it's better to try and see which are the largest value you can use for your project without going too low.
You can also just change the settings for electrodes individually, for example with
This only changes the settings of electrode 11. Remember to always re-upload the code to the Touch Board for the new settings to take effect.
Change the settings with the Grapher
Our Grapher tool not only allows you to visualise the sensors, but with it you can also change the settings of each electrode. Head over to the Grapher tutorial to find out how to change the settings of the Touch Board with the Grapher.