Introduction: How to Make Arduino Theremin - Control Arduino With Proximity and Touch
In this instructable I'll show you what I've learned and tried with Arduino Capacitive Sensing Library.
I've managed to make this simple and inexpensive Theremin.
Theremin is a contactless instrument that uses electromagnetic interaction of the human body to control sound.
First, I'll remind you with something that you may have noticed in Arduino projects.
You may have made an Arduino project but you missed some connections. Then you can notice some strange and unreliable circuit behavior when you touch any wire of the circuit. You may notice some LED flickering or general circuit instable response.
That may have happened with you as it happened with me many times with Microcontrollers and with Arduino.
This made me believe that I can use a Microcontroller and Arduino to sense the touch without any external sensor.
I have tried with Microcontrollers like PIC16F84A. I have made my own vision of the circuit but could not make something reliable that can be used as a touch sensor.
Later, I found that concept realized in PIC and in many other Microcontrollers.
And here on Arduino website I found that there was a complete library that uses that concept.
I found it so cool, easy and reliable.
It requires no external sensors or hardware. You only need Arduino board connected to a resistor, some wires and a piece of foil paper.
Step 1: Circuit Components
The circuit sensitivity depends on the value of the resistor. In general, for larger resistor values, the circuit can sense from a distance. Hence, work as a proximity sensor.
Here I've found a 10 Mega Ohm resistor and used it. I worked as a touch and it also responds from about 2 inches away from the wire.
optional. On Arduino website, they provided an optional capacitor that increases circuit reliability but I didn't use it and it worked fine.
- The sensor itself is the wire or a piece of foil.
Here is the circuit connection
Step 2: Software
I used the example sketch inside the Capacitive Sense library with some modifications.
The example sketch reads the sensor values and displays them on the serial output.
I wanted to make something functions, so instead of lighting an LED I made a responsive tone generator using the tone function.
The tone pitch responds to the capacitive sensor.
First, we include the capacitive sensor library.
Then we define the variables.
In the setup function, we initiate the serial communication and baud rate.
Then we map the total variable to use with the tone function.
We compile the sketch and upload it on Arduino board.
Step 3: Test
We connect Arduino and run the sketch.
It's helpful to open the serial monitor from Arduino IDE and watch the values as the change on your touch.
You can also use the Serial Plotter tool from Arduino IDE and see the values change graphically.
You can test the different tones while you touch the wire on PIN 2.
You also notice that the tones change as you get your hand near it without touch (proximity).
Step 4: Other Useful Circuits
You can use this setup as touch switch to light a lamp or control a robot motor.
You need to read the different sensor values after you connect all of your circuit components as all components contribute to the overall circuit capacitance.