15
Tori Chitwood Tori Qualls ARDUINO THEREMIN

Theremin Presentation

Embed Size (px)

Citation preview

PowerPoint Presentation

Tori ChitwoodTori QuallsArduino Theremin

Invented in 1919 by Russian Physicist Lev Termen (Leon Theremin) Brought instrument to US in 1920, but was taken back to Soviet Union by force in 1938Different Rock bands have used it in the 60s and 70s including Led Zeppelin

History

Musical Instrument that operates off of hand capacitance in relation to the antennae (talk more about this later)One antenna controls sound pitch and one antenna controls volume levelTalk about different ranges pitch in picture

Nowadays, costs range from $99-$450The lower end is for single antenna theremin; for pitch and volume control, at least $170

2

Schematic for Leons Theremin

How a real theremin works There are multiple oscillators (a couple for pitch and one for volume) that generate the tone of the instrument and control the volume.Tone works by multiplying the outputs of the variable pitch and fixed pitch oscillators, when waves multiplied and low pass filtered, the frequency of the output is the difference of the frequencies of the variable and fixed When playing, the goals is to alter very slightly the frequency of the variable pitch oscillator so that the overall difference in frequency changesThis is done by utilizing the capacitive effect that the players hand has on the antenna. Hand acts as ground plate and varies the antenna capacitance by different amounts depending on how close or far it is away. Change in capacitance then causes a change in current. With inductors, change in current causes a change in voltage across the inductor and change in frequency of oscillator.Volume works in similar way but converts the frequency to a DC voltage which controls then is used in conjunction with the difference in frequency gained from the pitch antenna circuit to produce a sound

3

Takes a single measurement at a time and translates it into a value through code before outputting a tonePitch controlVolume controlArduino sends data to speakerHow Ours is Different

Required to use Arduino or labviewWe also had two antennae: one for pitch and one for volume Other used oscillators to generate different sounds by comparing an output from a reference oscillator to an oscillator affected by hand movement4

Arduino Code

Here is our Arduino code. It is divided into six main sections

** Capacitive sensign for pitch and volume, reset code, digitpot initialization, data mapping, tone

5

Arduino Code

Here is our Arduino code. It is divided into six main sections

6

Capacitive Sensing

Pitch Control

Tone

Have separate Capacitive sensing circuits for pitch and volumeDownloaded Capacitive Sensing Library from Arduino website; heres how it worksCapsenseArdunio changes send pin state eventually changes the state of the receive pin.Time delay between send and receive pin is determined by RC with C being the sum of the Cpin and CsensedCpin used to stabilizeCsensed is what we control** The capacitiveSensor Function argument (where it says 30) represent the number of samples in one sensing cycle and the capacitive sensing library has a built in low pass filter to smooth noiseToneInput value received from capacitive sensing code into map() functionTake mapped value and use tone() function to generate sound7

Volume Control

Capacitive SensingUsed same capacitive sensing library as the pitch control to get a valueInstead of directly using the map value, we first constrained the values to ensure we didnt try to tap into a digipot state that didnt exist (7 bit digipot with 128 different resistance states)Constrained values were mapped and then rounded and sent to digipot

DigipotNo simple Arduino method the way there was for pitchFound someone who used a digipot to control light intensityThe digipot has 7 bits and 128 states but the lower the state number, the greater the volume, so in our code we constrained the state values to 1-20 to keep the volume audibleArduino has a few different libraries that can be used to communicate with digipotWe used SPI library because it better fit our purposeThe first block code is how it is initialized, ss is the chip number if have multiple chips, reg is the wipper blade number (some are duel potentiometers), and level is the state number

1P is chip select for if you have more than one potentiometer in your device (we have one)2P clock which is used to keep track whether it is SDI or SDO3P is SDI/SDO which is the interpreted and mapped data from our sensing plate4P is ground5P is unused6P is the wiper and leads to the speaker7P is our tone/pitch input (so the wiper only affects the amplitude of our sound wave but the frequency of the sound wave is still included and regulated by the pitch sensing plate)8P is power (5V)

8

Circuit Schematic for PCB

**Our circuit design (for reference):Sensitivity (#of resistors), stability (extra 100 pF capacitors), linearity (mapping of capsense values to freq range), resolution (mapping, bit range, changed mapping to narrow range of freq outputted), SNR (MAF)

9

PCB design and Soldered Board

Picture with PCB schematic and soldered boardWorked, but didnt seem to work as well Unknown cause, potentially soldering error and we didnt have time to redo it

**Values were all over the place like what happened initially, so possibly charge build up10

Noise and Data RegulationChallenges

MAF to increase SNR and smooth spikes outAdjusted window width to get best response timeToo big = must hold hand a long time to changeToo small = didnt get rid spikes

Changed mapping to play within certain range of frequenciesDidnt want to go all way to human hearing range because it was unpleasant and unmusical

11

Capacitor values increase randomly

Sensitivity

Challenges

Reset codeIf the cap values for pitch went too high, it reset the Arduino without having to press the button and the values go back downOnly applied to pitch because the volume values were more stable and less likely to randomly jump up**Charge build up might be cause of increasing values

Resistor values More resistors mean slower because you are increasing the time constant (R*C)But increased sensitivity because now smaller changes in capacitance change the time constant12

Video: pitch

Video: volume

14

Referenceshttps://www.arduino.cc/en/Tutorial/Smoothinghttps://www.youtube.com/watch?v=pp36Q5i08HEhttps://www.arduino.cc/en/Reference/SPIhttp://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSensehttp://www.thereminworld.com/Article/14232/what-s-a-theremin-http://www.theremin.info/index.php?module=-&type=file&func=get&tid=15&fid=image&pid=54