Do you know how your smartphone's touchscreen work?
Smartphone has an array of touch sensors beneath the glass screen. Nowadays, its based on capacitance touch sensing technology and even a gentle touch is easily detected. Capacitive touch is sensed when the sensor or probe is touched by a large object or person or conductive object. For example detecting when a person touches a piece of foil, conductive ink, a piece of fruit or a vegetable.
Well the principle behind it is very simple: by touching an object, its capacitance is slightly changed by your body and that change is detected by special circuits.
In this tutorial, we will learn how to make a touch sensors based DIY projects using evive and Scratch. We will grow our project step by step in following order:
- Single Channel Touch Detection
- Multiple Channel Touch Detection
- Touch Piano
Now you know the principle, lets see how to do it?
evive Touch Channelsevive has 12 touch input (that means you can check up to 12 inputs independently), which are interfaced via the MPR121 chip using I2C interface. These inputs are very easy to connect to fruits, copper tape, water etc. You just have to use jumper wires or alligator clips to make your circuits. With evive, its just plug&play.
Female headers are provided in evive (at bottom left side - inside magic lid) for capacitive touch inputs. You can connect any conductive object with using a Male - Male Jumper wires or alligator clip like:
- Fruits
- Vegetables
- Aluminium Foil
- Metal
- Conductive Ink, etc
In the figure, we have illustrated how to connect different objects using jumper wires.
Mini-Project 1: Detecting Touch (Single Channel) in ScratchScratch is a free programming language where you can create your own innovative and interactive projects, stories, games, and animations. Using mBlock (Scratch 2.0 based), you can monitor touch channels and detect touch.
Click here if you want to steps to install Scratch and evive extensions.
Click here if you want to learn more about Scratch.
We will use evive TFT Screen to display the state of channel 1. If Channel 1 is touched, we will display green colored box else we will display red colored box. To sense touch we are using "channel () touched" block. You have to use evive inBuilt extension to use this block. If the specified channel is touched, the block returns “True”, else it returns false. To learn more about this block click here.
The above image shows the script for detecting touch on channel 1. Once you have created the script select the appropriate Board and Serial Port. Right click on the hat block and click upload to Arduino. Upload the code and you are done.
Find this final files below:
Scratch Program: SingleChannel.sb2
Arduino Code: project_SingleChannel10_3.zip
Mini-Project 2: Multiple Channel Touch in ScratchIn this case, we will use multiple channels to detect different types of fruits. Given below is the Scratch script for the same.
You can rename the objects attached to each channel in the scratch script.
Find this final files below: Scratch Program: SingleMultipleChannel.sb2Arduino Code: project_SingleMultipleChannel10_3.zip
Mini-Project 3: Touch PianoIn this case, we will make Touch Piano. We are using evive buzzer to make sound.
We will use 8 channels for 8 basic tones- Sa, Re, Ga, Ma, Pa, Dha, Ni, San in Sargam (first seven are equivalent to Do Re Mi Fa So La Ti in western music). We have used these in our piano. All possibles notes can be derived by these 8 notes.
Given above is the circuit diagram and below is the script for Touch Piano.
Find this final files below: Scratch Program: Piano.sb2 Arduino Code: project_Piano_3.zip
ConclusionIn this tutorial, we have shown three different use-cases of capacitive touch using evive.:
- Single Channel Touch
- Multiple Channel Touch
- Touch Piano
You can turn any conductive object into a sensor now!
Waiting for your funny ideas and pranks in comments below.
What is evive?
evive is a one-stop electronics prototyping platform for all age groups to help them learn, build, debug their robotics, embedded and other projects. With an Arduino Mega at it's heart, evive offers a unique menu-based visual interface which removes the need to re-program the Arduino repeatedly. evive offers the world of IoT, with power supplies, sensory and actuators support in one small portable unit.
In short, it helps you build projects/prototypes quickly and easily.
To explore more, visit here.
Comments