A theremin consists of a sound (musical) instrument operated by waving hands before two sensors (antenas, distance sensors, etc.), one of which determines frequency while the other determines volume of the sound produced. This usually calls for a bulky apparatus, as well as for a lot of training in order to get the right position of the hands to get the desired sound. (It is also tyring on the hands after a while!)
Here we show how to build a simple, portable, theremin which works through the touch of a screen, and in which one axis of the screen determines pitch while the other one determines the duration of the note. The screen also displays the frequency and duration while the note is playing. The frequency interval may be defined by the user (here we make it from C3 to C7), as well as the note duration (which we make here from 100 to 1000ms).
We use a 240x320 2.4" TFT-LCD Touchscreen from Banggood, with ID=0x9340, and use the MCUFRIEND_kbv library to drive it. This is mounted on an Arduino UNO R3. A speaker is connected between digital pin 10 of the Arduino and ground; it needs to be a PWM-enabled pin, and since the tone() function clashes with PWM signals on pins 3 and 9 (because they use the same timer), we chose pin 10 which is not used by the touchscreen itself unless an SD card is present and being used.
The screen dimensions are mapped to the minimum and maximum note durations, and to the minimum and maximum frequencies, so that when the screen is touched at a point p its coordinates (x, y) are registered and used by the tone() function to send to the speaker, as well as displayed on the screen as feedback for the user.
In order to avoid spurious signals going to the speaker, we place a lower bound on the z-coordinate of p (used for screen pressure) for the touch to be a valid one.
The sound quality is not great, but one could use MIDI to improve upon it and to switch to the timbre of different instruments.
There is space between the shield and the Arduino board to glue a small speaker under the shield, if a more permanent circuit is desired. The whole theremin fits inside a shirt pocket.
Comments
Please log in or sign up to comment.