In 1928 Léon Theremin – a Russian musician and inventor – patented the Theremin: an electronic instrument controlled without physical contact. Using two metal antennas, the relative position of the thereminist's hands is detected to generate notes with variations in frequency and volume. The Theremin has been widely used in soundtracks but also in rock concerts and avant garde music.
While researching music projects for an Arduino book, I’ve decided to make a Theremin (sort-of) with Arduino that can be actually played for improvisations and jams, since most Theremin projects seems to only generates ghostly sound.
What's insideInstead of using antennas like the original Theremin, this one uses an ultrasonic distance sensor HC-SR04. According to the distance from the unit to the player’s hand, the note (frequency) is determined. Example: if your hand is closer, notes will be lower. If you elevate your hand, notes will be higher.
Instead of converting distances to frequencies, only the notes of a certain scale – selected with the potentiometer – will be played.
What kind of scales can be selected with the potentiometer? minor scales, major scales and minor pentatonic scales in different pitches.
What about the switches? The first switch is used for Vibrato. The second switch is used to provide extra notes with a little off-set in order to obtain the Theremin allure.
The led will be turned on only when sound is played and the button is used to turn on/off the Theremin.
In order to avoid extra cables and also to provide a cleaner sound, the unit is powered by a small 3.3v Lithium battery connected to a TP4056 charger.
You just have to connect Switches ground, led ground, potentiometer ground, audio cable ground and sensor ground to Arduino GND pin, then potentiometer VCC to sensor VCC to 3.3 Arduino. Switches to Digital 12 and 8. Potentiometer signal to Analog 0 pin and sensor Echo and Trig to Digital 6 and 7 pins. Audio cable to Digital pin 9. Battery is connected to VIN and Ground.
The Nano Theremin does not require any special hardware to play sounds. Just a regular audio cable connected to D9 and Ground and the magic of Mozzi Library.
Custom Case//An array with C minor scale
int myFrequenciesArrayCminor[]={65.41, 73.42, 77.78, 87.31, 98, 103.83, 116.54, 130.81, 146.83, 155.56, 174.61, 196};
//To read sensor distance the following code is used
digitalWrite(pulso,LOW);
delayMicroseconds(5);
digitalWrite(pulso, HIGH);
delayMicroseconds(10);
myTime = pulseIn(rebote, HIGH);
myDistance = 0.01715*myTime;
//To map the distance to scale notes
int mappedDistance=map(myDistance,0,80,1,13);
//To assign array note according to mapped distance
input=myFrequenciesArrayCminor[mappedDistance];
// To play the note
aSin0.setFreq(input);
Note: in YouTube’s video you can find information about the complete code for this project.
Demo 1Improvisation over a blues track in A.
This project has been sponsored by DigitSpace They have a great selection of electronic components and boards, competitive prices and they ship overseas.
Arduino Theremin on TikTokhttps://www.tiktok.com/@ronibandini/video/7368889236495371525
For other projects follow me:
Comments
Please log in or sign up to comment.