Introduction: Making Distance Sensors: Trigger the Touch Board With Proximity
Learn how to trigger the Touch Board over distance.
The Touch Board works great out of the box to detect… well touch! But it’s also possible to trigger the sounds from a distance, which we call proximity mode (which is really just increasing the board’s sensitivity). This tutorial will take you through an example and explain the principles.
For more project ideas visit www.bareconductive.com
Step 1: Materials
Step 2: Prepare Your Proximity Pad(s)
Using masking tape, start by taping out a proximity pad approximately 10cm square onto a piece of heavy stock paper.
Leave a strip about 1cm wide running off to the side to allow easy connection to the Touch Board.
Once you have the pattern taped out, paint it with Electric Paint and leave it to dry.
This should take about 15 minutes, but you can speed it up with a hairdryer if you are in a hurry.
Be careful not to let it crack in this case – forcing the drying process makes this more likely.
Carefully remove the masking tape while the paint is slightly wet to avoid tearing off the paint.
Step 3: Upload the Proximity Code to the Touch Board
Plug the Touch Board into your computer via USB and plug in your headphones or speaker. Make sure that the power switch on the board is set to ON.
Open the Arduino IDE and open the Proximity demo from your Sketchbook – you’ll find it under File→Sketchbook→Touch Board Examples→Proximity_MP3. Ensure that Bare Conductive Touch Board is selected under Tools→Board and that the correct serial (CU) port is selected under Tools→Port.
With all of the correct settings selected, click File→Upload to push the code to the Touch Board.
The RX and TX LEDs will flash on the Touch Board and the Arduino IDE should say “Done uploading.”
Step 4: Connect the Touch Board to the Pad
Now that we have the code on the board, we can go ahead and connect the (now dry) pad to the board.
You can either do this using a crocodile clip cable, or by cold soldering with a small blob of paint to connect directly.
We like using the crocodile clip for prototyping as it is easier to remove if we want to make any changes.
It doesn’t matter which electrode you connect it to, provided that there is a file named appropriately to the electrode on the microSD card.
For example, TRACK000.mp3 if you are connecting to electrode 0 or TRACK011.mp3 if you are connecting to electrode 11.
For more details on naming the tracks and uploading your own sounds to the microSD card click here.
Step 5: Trigger the Track!
Make sure that your workspace is neat and that the connection between the board and the pad is short and doesn’t snake over other cables (this can cause false triggering).
Now press the reset button on your Touch Board and wait about 8 - 10 seconds for the board to leave “bootloader” mode (the red L LED will pulse) and another 2 seconds for the board to adjust to the new pad.
Try triggering the track by waving your hand slowly over the pad about 5cm from the pad – you should hear your track play!
Step 6: Demonstration Video
Step 7: Having Trouble?
If you are having trouble with getting this to work, don’t panic! Here’s a checklist to help debug things:
– Did the code upload correctly? If not, check out the Uploading FAQ.
– Are your speakers powered, if they need to be?
– Is your wiring neatly organised, not overlapping anything else?
– Is your pad correctly painted with no gaps? You can check this with a multimeter – the pad should read a few kΩ from end to end.
Step 8: Spot the Difference
This code is basically the same as the Touch MP3 code that ships with the Touch Board. The only difference is that the threshold for detecting a touch has been decreased (along with the threshold for detecting a release, for balance).
If you have the Touch MP3 code to compare against, you can see that lines 75-84 in Proximity MP3 have been added in, but the rest are the same.
All we have done is decrease the touch threshold from 40 (default) to 8 and the release threshold from 20 (default) to 4.
You can view code line numbers in Arduino easily by selecting “Display line numbers” in the Arduino→Preferences menu.
Note that the release threshold must ALWAYS be less than the touch threshold.
You could decrease these further to increase sensitivity, if you like, but be careful. More sensitivity means a more noisy (and possibly erratic) signal.
Step 9: Ideas for Taking This Further
So now you have one pad working via proximity, what next?
You could paint up a set of pads like Bibi did for the Kickstarter video and change the sounds on the microSD card to be drum noises! Or you could try and increase the sensitivity even further, to see what that does.
Step 10: More Ideas!
You could also try setting individual thresholds for each electrode.
You can call MPR121.setTouchThreshold(0, 10); to set electrode 0 to have a touch threshold of 10 or MPR121.setReleaseThreshold(2, 5); to set electrode 2 to have a release threshold of 5.
Play around and see what effects you can create. Different pad shapes and sizes will have different effects too, so you can experiment with those. Don’t forget to reset your Touch Board every time you connect a new pad though.
If you liked this tutorial visit www.bareconductive.com for more!
We have a be nice policy.
Please be positive and constructive.