29
Department of Physics and Astronomy Ithaca College Senior Project Report The Light Theremin: Transforming Light Into Sound A Light Based Instrument Submitted by, Scott Robbins May 11, 2016

ThereminReport

Embed Size (px)

Citation preview

Page 1: ThereminReport

Department of Physics and Astronomy

Ithaca College

Senior Project Report

The Light Theremin: Transforming Light Into Sound

A Light Based Instrument

Submitted by,

Scott Robbins

May 11, 2016

Page 2: ThereminReport

ITHACA COLLEGE DEPARTMENT APPROVAL

of a Senior Project submitted by

Scott Robbins

This senior project report has been reviewed by the senior project instructor and has been

found to be satisfactory.

Dr. Matthew C. Sullivan, Senior Projects Instructor Date

I understand that a digital copy of my senior project report will remain on file in the Depart-

ment, and may be distributed within the Department or College for educational purposes.

My signature below authorizes the addition of my report to this repository.

Scott Robbins Date

Page 3: ThereminReport

Abstract

Using a combination of resistors, photo transistors, op amps and one inexpen-

sive Arduino micro-controller, I designed and created a unique and potentially

educational musical and scientific instrument. The sound production and con-

trol of this instrument relies on the manipulation of light hitting photo tran-

sistors. The Arduino takes this analog voltage from the collector of this photo

transistor and converts it into digital square wave pulses, with frequencies that

can be modulated by controlling the amount of light hitting a second photo

transistor. This device would be a good future project for other undergraduate

students with interests in engineering, computer programming and music. This

device also has the potential to be a good demonstration of how to experience

science in a very different and entertaining way, and in an elementary educa-

tion setting (perhaps with special needs students as well) it has the capacity

to entertain, educate and perhaps even inspire.

i

Page 4: ThereminReport

Acknowledgments

I’d like to thank Jennifer Mellott for helping me throughout the construction of this project.I’d also like to thank Matt Sullivan for his guidance, for motivating me throughout theconstruction of this instrument, for his help with writing this report and for suggesting Ianalyze the speaker output with Raven. I would also like to thank Dan Briotta for teachingme so much about analog electronics and computer programming, for helping me develop arange of skills as a scientist and as an inventor, and for encouraging me to embrace an ideaand turn it into a reality. Thank you all so much!

ii

Page 5: ThereminReport

Contents

1 Introduction 1

2 Design 4

2.1 First Stage: Pitch Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Second Stage: Micro-controller . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Third Stage: Volume Control . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Test Methods 9

3.1 Testing: Pitch Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Testing: Micro-controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3 Testing: Volume Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Data and Analysis 12

4.1 Pitch Control Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.2 Micro-Controller Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3 Volume Control Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 External Sound Analysis 17

5.1 External Frequency Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.2 External Volume Control Analysis . . . . . . . . . . . . . . . . . . . . . . . . 205.3 External Frequency Modulation Analysis . . . . . . . . . . . . . . . . . . . . 21

6 Conclusion 22

iii

Page 6: ThereminReport

1. Introduction

The worlds of science and art collided with the invention of the Theremin, a bizarre experi-mental instrument patented in 1928 by Leon Theremin who subsequently signed a contractwith RCA (Radio Corporation of America) in 1929 making them the “first mass producerof an electronic instrument” [2]. The Theremin is often cited by historians as being thefirst invention to “lay the foundations for modern electronic music” [2]. However, this is notwhere his story begins.

Theremin was initially a young physicist doing research for the Russian government,specializing in the development of “proximity sensors” [3] that would react to changes inmagnetic fields. Theremin took this research, on electromagnetic field sensors, and insteadapplied it to create a musical instrument. He brought his invention to Lenin (the currentleader of the the Russian Communist Party at the time) who wanted Theremin to show hisdevice off to the entire world. This freedom to travel allowed Theremin to come to the UnitedStates to patent and sell his device, but also to spy on the major technology companies [2]in the United States. He enjoyed life in America, but after marrying an African-Americanwoman he found his US funding depleting (an unfortunate consequence of the racism inthe US during the 1920s) and was no longer considered an asset by the Soviets. He wassubsequently kidnapped by the KGB and brought back to Russia. Nevertheless, his devicewas already being mass produced and generating enormous interest.

The Theremin enables performers to draw out pitches from thin air, without the per-former ever physically touching the instrument, by using the position of the musicians handto control pitch and volume through manipulation of the electric field around an antenna [1].Although the timbre of the Theremin is quite strange and somewhat unpleasant, it was thepioneering invention that paved the way for musical instruments rooted in physics and specifi-cally analog electronics. Robert Moog, who many attribute as the inventor of the synthesizer,began his career by building Theremins and attributes this instrument as his inspiration [2].

Science is a pursuit of the objective, dealing with concrete logical ideas that exist farbeyond the classroom and far from the hands of students. We run experiments and manip-ulate the world every day, but most of this is done in a sterile environment. A scientist mayrun an experiment but the outcomes (almost) always depend on invisible forces extendingthroughout the universe. This quality is what I find so compelling about the concept ofthe original Theremin and the device I have built. It can be used to engage people fromoutside of the scientific community and spark the curiosity that leads them down the pathof discovering the true magic that is science.

In addition, my mother is an elementary school teacher for students with disabilities, anda device like this allows handicapped individuals to be both expressive and entertained in anon-verbal way that requires very little dexterity. I have a passion for music because it has asimilar capacity for experimentation, allowing an individual to share a subjective experiencein an (almost entirely) objective world. The motivation and goal of my project was to unitemy passions for science and music, and in the process design a device that can bring theabstract and unseen nature of physics to your fingertips.

This can be done in a variety of ways using modern technology. The instrument I havedesigned and built relies on the manipulation of light instead of the electric field surround-

1

Page 7: ThereminReport

Introduction

ing an antenna (the primary scientific phenomenon that the Theremin utilizes). The LightTheremin relies on the performer to control the amount of light hitting a photo-transistorto influence the pitch of a tone being continuously amplified by a speaker.

To do this, a photo-transistor is connected to a power source with the output of thecollector being put into an Arduino Uno and the emitter being connected to ground. Ambi-ent light hitting the photo-transistor yields an output of zero volts because the transistor isessentially “shorted” when there is maximum light. As an obstacle blocks light from hittingthe photo-transistor, the voltage at the collector increases. A 100KΩ resistor is placed inbetween the power source and the collector to maximize the possible range in voltage thatcan be output by the transistor.

The circuitry becomes a musical instrument by mapping the possible range of voltages toa range of pitches or frequencies. Therefore as the the voltage being taken from the collectorchanges, the Arduino Uno will produce a digital square wave with a pitch that is directly pro-portional to the voltage and by extension the amount of light hitting the photo-transistor.

The Arduino Uno is a cheap, open source micro-controller that has six analog input-s/outputs and 13 digital inputs/outputs. Programs for the Arduino are written in theArduino Integrated Development Environment (IDE), and are compiled and uploaded tothe micro-controller via USB. Compiling the programs, which are written in a programmingenvironment that is extremely similar in syntax to Java or Python, puts them into a machinelanguage that tells the Arduino what to do. Once a sketch is uploaded to the Arduino thereis no need for a computer. The photo-transistor circuit and the Arduino itself can run onthe same power source so the whole device can be contained on the same small area.

Although quite different in circuitry, the philosophy and operation of this instrument is

Figure 1: This is an image of the instrument I have built. The Arduino is depicted in themiddle, with the photo-transistor for pitch control on the left and the photo-transistor forvolume control shown on the right. The speaker is also in this image, and is built into theboard.

analogous to the Theremin because the sounds being created are generated by the performermanipulating light, requiring no physical contact with the instrument. Pitch is continuouslyshifted or altered by moving a hand around or above the photo-transistor, this movementchanges the amount of light hitting the photo-transistors. The sound is much more coarsethan the Theremin because the Arduino outputs rough digital square waves. The sensitiv-

2

Page 8: ThereminReport

Introduction

ity is quite impressive however, as the photo-transistor output voltage responds extremelyquickly to changes in light.

Science is an amazing tool for understanding the world around us, but sometimes fails toinspire students because it feels intangible. Instruments like the Theremin, and the one thatI have built, are good tools for showing how these properties of physics are truly physicalthings that we interact with continually and unconsciously but are invisible to the naked eye.These instruments allow us to tinker with these invisible forces and allow someone to createsomething out of (seemingly) nothing, providing the potential for the scientifically inclinedto pursue musical endeavors or for the musically inclined to pursue scientific studies.

3

Page 9: ThereminReport

2. Design

The design of this instrument relies on three distinct stages of circuitry. The first stage iswhere ambient light from the performance space is used to control a voltage. This analogvoltage is fed into a micro-controller which is the second stage of the device. The third stageof the device controls the volume of the output of the micro-controller, which is now a digitalsquare wave of varying frequency. This modulate of frequency changes based on how theuser is occluding the light hitting the photo-transistor in the first stage.

2.1 First Stage: Pitch Control

The first stage of the device is where light intensity is converted into a proportional voltage.To understand how the photo-transistor does this, one needs to first understand the opera-tion of a photo-transistor. Essentially, a photo-transistor operates in a fashion very similarto a light emitting diode or LED. When a voltage is applied to an LED, current will flowand the LED with begin emitting light. Once light is emitted there will also be a voltagepotential across the LED.

Similarly an LED can be oriented in an opposite fashion such that a voltage potentialcan be induced by light hitting the LED, allowing current to flow. The amount of currentan LED will generate upon illumination is quite small. To increase the current produced bythe LED we connect it to the base of a transistor. Now, when the LED is illuminated it willallow a much larger current to pass through the collector to the emitter. This use of theLED is referred to as being reverse biased, and this combination of an LED with a transistoris called a photo-transistor.

The photo transistors used in this device are sensitive to visible light and also to infrared

Figure 2: Circuit diagram illustrating voltage source, 100KΩ resistor and photo-transistorin parallel with Vout coming from the collector.

light. During maximum illumination the photo-transistor puts out a minimum voltage andtotal darkness creates a maximum voltage. To understand this, we treat the photo-transistora bit like a variable resistor. When fully illuminated, the photo-transistor essentially makesa short to ground and so the voltage measured at the collector is essentially zero because all

4

Page 10: ThereminReport

2.1 First Stage: Pitch Control Design

of the voltage has been used across the resistor R1. When partially illuminated the phototransistor begins to act like a variable resistor (with a “resistance” dependent on the amountof incident light) and there will be a voltage coming out of the collector. If one fully coversthe photo-transistor the equivalent “resistance” is extremely high, because almost no cur-rent will flow from the collector to the emitter. Therefore the voltage at the collector is at amaximum because this equivalent resistance of the photo transistor is much larger than theresistance of R1. This equivalent resistance of the photo transistor will be denoted as Rpt inEquation 1.

Fundamentally this circuit acts like a voltage divider, with a voltage being connected toa resistor and photo transistor in series. With our applied voltage being Vcc (in this case aconstant +5V), and the output being taken after the resistor R1, our equation for the Vout

is as follows:

Vout =Rpt

R1 +Rpt

Vcc (1)

Treating our photo transistor as a variable resistor (this variable resistance denoted asRpt) we can make our circuit be equivalent to a voltage divider circuit and use Equation1 to approximate the maximum and minimum output voltages of the first stage circuit.When fully illuminated we approximate the equivalent resistance of the photo-transistoris 100Ω, and when in complete darkness the equivalent resistance is approximately 1MΩ.Calculating for our theoretical minimum and maximum output voltages we find that witha fully illuminated circuit we should get an output of 4.99mV. Our theoretical maximumvoltage for our circuit in complete darkness is calculated to be 4.55V. These numbers aresimply approximations (based on the nature of reverse biased diodes) so we can conceptualizehow to control a voltage by manipulating the amount of light hitting a photo-transistor.

Figure 3: This is an oscilloscope snapshot of how blocking light increases the voltage atthe collector. This figure does not depict the full voltage range, but rather illustrates thecapacity of the circuit to allow a person to manipulate the voltage at the collector.

5

Page 11: ThereminReport

2.2 Second Stage: Micro-controller Design

2.2 Second Stage: Micro-controller

The second stage of the instrument is the Arduino Uno micro-controller. The actions thatthe Arduino performs are hardcoded in the Arduino Integrated Development environment.These programs are called “Sketches”, and are uploaded to the micro-controller through aUSB connection to be stored so that the device can run without being connected to a com-puter.

The sketch for this project first requires declarations of variables, such as the pin to bespecified for the analog input coming in from the first stage (for this project this is analoginput pin A0). The program itself runs through a “loop” method that performs the con-tinuous actions we desire from the micro-controller. In the case of the Light Theremin themicro-controller first sets a serial communication rate of 9600 bits per second, and then takesa reading of the voltage A0.

The Arduino has a function called “Map”, which requires five parameters. It is de-signed to take a number and re-assign it to a new value based on a second specified rangeof values. In our case the first set of ranges are the digital values for our minimum voltageand the digital value for our maximum voltage (the voltages that come from the first stagecircuit). The second range of values are the pitches that we will want the Arduino to put out.

int sensorPin = A0; // select the input pin for the photo-transistor

int sensorValue = 0; // variable to store the value coming from the sensor

void setup()

void loop()

//initialize serial communication at 9600 bits per second:

Serial.begin(9600);

//read analog input

sensorValue = analogRead(A0);

int pitch = map(sensorValue,0,1023,100,800);

tone(9,pitch,15);//the pitch!

delay(.25);

tone(9,pitch*2,15);//harmonics!

The first parameter of the Map function is the sensor value from reading the voltage atA0. The next two parameters are the lowest and highest possible digital values which are0 and 1023 because the resolution of the analogRead function is 10 bits (although a higherresolution could be achieved, this may slow down the program and sacrifice functionality).The last two parameters for the Map function are the lowest and highest values of pitch(in Hertz) that we want the Arduino to produce. This range is currently set to a minimumof 100 Hertz and a maximum of 800 Hertz, although experimentation with this range willbe necessary to determine what sounds most interesting! The value returned by the Mapfunction is saved as the variable denoted “int pitch”, and will be used in the next line ofcode.

The next step in the program is to call the tone function (not to be confused with the

6

Page 12: ThereminReport

2.3 Third Stage: Volume Control Design

“int pitch” variable calculated and stored as a return from the map function), saved in thecode as the variable “int pitch”.) which requires three arguments. The first argument of thetone function (the Arduino sketch that is included in the report also illustrates calling thetone function) included is the digital pin that will output digital square waves. The secondargument is the frequency you want these square waves to have, in our case a value savedas “pitch” from the map function we previously used. The third and final argument of thetone function is the length of time (in milliseconds) that the tone will be played.

To try and make the timbre of the instrument somewhat less “rough” sounding, I havealso added a second tone (with twice the frequency, an octave above) to make the roughdigital sound slightly “larger” and more interesting. To add a harmonic, the program isdelayed briefly after the first tone is played and then the tone function is called again. Onthe second function call for tone however the pitch is doubled.This series of sensor readings,calculations and function calls will loop continuously as long as the instrument is poweredon. The result is a seamless stream of tones that can be manipulated in the manner describedabove.

2.3 Third Stage: Volume Control

The third stage of the device is a circuit to regulate volume and play our tones through asmall speaker. The first component of this stage is to take the output from the digital pinof the Arduino. To regulate the volume of this tone using light, we utilize a similar circuitto that of the first stage. Instead of a constant DC voltage, we use the digital output as ourV+ and again feed this voltage into a resistor and photo-transistor in series, with the emitterconnected to ground.

This will allow us to manipulate the voltages being put out by the Arduino pins byblocking and partially blocking the light hitting the photo-transistor. However, if we usedthe same circuit as the first stage, our overall range of volume would be decreased becauseof the first resistor and because of the low power output of the photo-transistor (typicalCollector current of 5× 10−4A [4]). Although we would be able to vary the volume ofthe tones, the maximum volume will be quieter than we would like because of these powerconstraints.

Considering we desire to connect this circuit, which allows us to influence voltage andsubsequently volume, to an 8Ω speaker we need a way to safely make this connection withoutdrawing too much power from the photo-transistor (connecting the 8Ω speaker will draw alarge amount of current). So we need a circuit to amplify the output of this second photo-transistor without drawing too much power from the it.

The way we do this is to connect the output of the collector (from our third stagephoto-transistor circuit) into an op-amp buffer circuit (operational amplifier). The benefitof using the op-amp buffer circuit is that it’s input impedance is extremely high so as to notdraw too much additional current from the photo-transistor (no increased load). The outputimpedance of the buffer circuit is extremely low as well, which is exactly what we need foramplification. The most important aspect of the buffer circuit is that the output voltageexactly follows the input voltage and provides additional power.

Although the buffer circuit has solved our issues of power and impedance for the speaker,

7

Page 13: ThereminReport

2.3 Third Stage: Volume Control Design

Figure 4: Full circuit of the Light Theremin, including the first stage circuit, the Arduino,and the third stage volume control circuit which consists of another photo transistor system,along with a buffer circuit and an amplifier circuit which then connects to a speaker. The opamps used for the buffer and amplification circuit are TVL2362 and are designed for lowerpower/voltage applications compared to convential op amps.

we still need to increase the voltage in the third stage to get the signal from the digitaloutput of the Arduino to get back to an audible level (the buffer circuit provides no voltagegain). However, now that we have isolated the output signal from the Arduino we can safelyamplify this signal with another op-amp circuit. The best op-amp circuit for this stage is thenon-inverting amplifier because it will provide us with the decibel gain we require to makethis instrument audible. The load put on the non-inverting amplifier should not be an issuebecause of the low output impedance from the buffer circuit, however the resistor labeled R2

in Figure 4 should be high enough to prevent this.In addition the choices for the resistor values in the non-inverting amplifier will depend

on how loud we want the instrument to be, and what Op-Amp we choose. Our Op-Amps aredesigned for low power applications so when choosing these resistors we need to maximizethis power without damaging the Op-Amps in order to have sound output at an audiblelevel. The Gain of a non-inverting amplifier is:

G =Vout

Vin

= 1 +Rf

R2

(2)

The maximum power output of the photo-transistor is quite small, as well as the Op-Amps, so to avoid breaking any of these circuit elements we have designed a buffer and anamplification circuit with resistors Rf and R2 in the non inverting amplifier of 1KΩ and100KΩ respectively. Now we have a third stage for the Light Theremin which will allow forvolume control through the manipulation of light.

8

Page 14: ThereminReport

3. Test Methods

To asses the overall function of the device, I tested segments of the overall device individually.These sections operate simultaneously, but I needed to test them individually to make sureeach component does what it should. However, because each part of the design operatessimultaneously, another method of testing was to modify the micro-controller program toachieve optimal timbre. The final test was to assess the overall operation of the deviceincluding all components, and to evaluate and confirm that the Light Theremin is operatingas intended.

3.1 Testing: Pitch Control

The “pitch” or frequency is actually assigned within the program stored in the micro-controller, so the first stage is only concerned with manipulating light in order to propor-tionally change a voltage. To test the first stage I connected the output of the collector toan oscilloscope, and observed the voltage coming out. The first stage worked properly onceit put out the widest possible range between 0V and 5V (we have chosen 5V because thisis the maximum operating voltage of the Arduino). I confirmed that the pitch control phototransistor operated as intended by connecting the output to an oscilloscope and verified thatthis output was reacting to hand motion (resulting in the obstruction of light), by observingoscilloscope images that resembled Figure 7. Therefore I concluded that the first stage ofthe Light Theremin worked properly, by inspecting the voltage as aforementioned, becauseas I occluded more light the voltage steadily rose.

The output will never quite get to a maximum of 5V, but the circuit is considered tobe functioning properly if the voltage essentially reads zero while all ambient light hits thephoto transistor, and with a hand directly covering the photo transistor the oscilloscopereads a voltage that is at least 4.5V, but ideally closer to 4.85V or higher (but always lessthan 5V).

3.2 Testing: Micro-controller

When Testing the micro-controller I first pressed the on-board reset button. Before uploadingthe code, I compiled the sketch to make sure all the syntax was correct and when there wereno errors. I then uploaded it to the Arduino to be saved. Once the syntax has been verifiedand the sketch is uploaded to the Arduino, I tested whether the program assigned pitchescorrectly, as specified by the program, by connecting the digital output pin, assigned bythe program, into an oscilloscope and observed the digital square waves. After observingthe pulse-widths of the digital output being modulated as one varies the amount of lighthitting the first stage photo-transistor, I concluded that the pitch control and micro-controllerportion of the Light Theremin device were working together.

Another test method I utilized was to simply connect the digital output to a speaker(and ground the other terminal), and listened to the sound that came out. This method willnot ensure that the proper frequencies were being generated, but if the Arduino modulates

9

Page 15: ThereminReport

3.3 Testing: Volume Control Test Methods

Figure 5: This oscilloscope image shows the the signal coming from the Arduino whenthe program is modulating frequency properly. I began with my hand covering the photo-transistor and slowly moved my hand away, resulting in the depicted modulation of thefrequency of the digital square wave output.

the digital pulse widths, as depicted in Figure 5, then as I moved my hand over and aroundthe photo transistor the sound coming out had an audible change in frequency/pitch.

3.3 Testing: Volume Control

The volume is controlled by the same principles used to control pitch, so testing the volumecontrol circuit began with testing the operation of the photo transistor portion first. Theoutput from the collector, from the photo transistor used in the third stage volume controlcircuit, is where the signal was tested first. By connecting the collector output to an oscil-loscope and covering and uncovering this photo transistor, the waveform on the oscilloscopechanged in amplitude in direct response to blocking the light hitting this photo transistor.

The signal coming out of the collector travels into into a buffer circuit. This buffercircuit provides a boost in voltage and power, however the signal coming in should be nearlyidentical to the signal coming out. To test this I used a voltmeter and simply put the con-tacts before the buffer and after, and checked that these voltages were identical (or at leastextremely close to one another). Connecting the buffer to an oscilloscope proved to be anineffective method, for reasons that I cannot explain, however I believe it may have to dowith the oscilloscope itself somehow interfering with the circuit and pinning the op amp.This is why I chose to use the voltmeter instead.

The last part of the volume control circuit I tested was the non-inverting amplifier. Thiswas done quickly and subjectively by simply connecting the output of the amplifier to thespeaker and listening to the sound for changes in volume as I covered and uncovered thephoto transistor. This is not the most scientific approach or the most effective way to testthe volume control circuit, but it was most certainly the quickest and easiest test method.

The other test method I utilized was to again use an oscilloscope, and observed the ampli-tude of the wave forms change as I covered and uncovered the photo transistor. However, asmentioned earlier, introducing the oscilloscope into the circuit at this point did not influence

10

Page 16: ThereminReport

3.3 Testing: Volume Control Test Methods

Figure 6: This oscilloscope image captures the voltage of the signal being manipulated. Thissignal is being measured before the buffer or amplification circuit, directly from the collector,which is why the maximum voltage is so small and necessitates an amplification circuit. Itis also interesting to notice that the high frequencies appear to be more responsive to thevolume control circuit.

the functioning of the circuit the way it did when trying to test the buffer circuit. This is whyI believe using the oscilloscope to test the buffer circuit must cause some sort of impedanceissue that influences the overall function of the circuit. Regardless, I have established thatthe amplifier worked and operated properly by observing infinitesimal voltages when I fullyenclosed the photo transistor with my hands, and seeing extremely large voltages when thephoto transistor was left untouched and all the light in the performance space is allowed tohit it.

I noticed that the operation of the buffer and amplifier (both of which rely upon thefunction of op amps) seemed to be less responsive to lower frequencies than higher frequen-cies. Although the volume of these lower frequencies had the ability to be manipulated,they seemed to be controlled less effectively than the higher frequencies. Even when entirelycovered, the output signal had very quiet lower frequency signals coming out and was nevercompletely silent.

believe this could be addressed with the inclusion of a low pass filter somewhere in thethird stage circuit (this was eventually done later, referenced is Section 5.2). Overall theentire volume control circuit worked as originally designed, such that there was a maximumvolume when light was completely unblocked, and the speaker is essentially silent (exceptfor some slight noise) when the photo transistor in the volume control circuit was completelycovered.

11

Page 17: ThereminReport

4. Data and Analysis

4.1 Pitch Control Analysis

The first stage of the circuit was tested under the lighting of a uniform plane of fluorescentbulbs on the ceiling. This may seem like a mundane detail, but the device does requiresome sort of light source to be manipulated, and one that is ideally coming down uniformlyfrom overhead. With all of this ambient light, unimpeded and hitting the surface of thefirst NTE3034A photo-transistor, we observe a minimum voltage of 160mV. Measuringthe resistance of the R1, the resistor connected to this photo transistor we find that it’sresistance is actually 87 kΩ. Using these numbers we can use Equation 1 to solve for theequivalent resistance of the photo-transistor when under this lighting. After some algebra(again, treating the photo-transistor as Rpt) we solve Equation 1 for Rpt and find that theequivalent resistance of the photo-transistor under maximum illumination is 287Ω. Thisconfirms our design goal of and is quite close to our approximation, but moreover this resultconfirms while being fully illuminated the photo transistor is essentially a short to ground.

Figure 7: This oscilloscope image depicts how the voltage slowly increased as I moved myhand closer to the NTE3034A photo transistor in the first stage of the device, starting atthe minimum of 160mV and moving steadily to a maximum of 4.56V.

When fully blocking the photo transistor from all light, the observed voltage was 4.56V.This is extremely close to our theoretical values from the design section. Once again solvingthe voltage divider equation, to evaluate the equivalent resistance of the photo-transistor inthe dark, we find that it’s equivalent resistance is 0.902MΩ. This is also quite close to whatwe expected.The voltage range achieved by moving our hand from far away to extremelyclose was about 4.41V. This is a good range to map our frequencies, and means we areutilizing almost 90% of our allowed range of 0V-5V.

The oscilloscope image depicted in Figure 8 demonstrated the sensitivity of the device. Iwaved my hand rapidly over the photo transistor and observed if the quick physical motionwould correspond to rapidly fluctuating voltages on the oscilloscope. From Figure 8 I havedemonstrated the capacity of the device to respond to extremely quick changes in lightintensity (again, by waving my hand over the photo transistor to rapidly change the amount

12

Page 18: ThereminReport

4.2 Micro-Controller Analysis Data and Analysis

Figure 8: This oscilloscope image illustrates the sensitivity of the first stage circuit utiliz-ing the NTE3034A photo transistor. Rapid hand motion translates into quickly changingvoltages.

of light incident on it) translating into rapidly changing voltages. In addition, Figure 7illustrates the circuits capability to steadily increase in a smooth fashion as well. Thismeans that the device can produce smooth changes in pitch or rapid and large changes inpitch, depending on how the performer chooses to manipulate the light in the performancespace.

4.2 Micro-Controller Analysis

It was difficult to capture data, on an oscilloscope, of the voltage at analog pin A0 influencingthe modulation of pitch coming out of digital pin 9 in a single image. To do this I editedthe overall values and range of frequency in the program to be smaller. This made it easierto capture both changes in voltage and subsequently pitch on the same figure (without thedigital waves simply looking like noise or a solid square block.) It was difficult to capturedata, on an oscilloscope, of the voltage at analog pin A0 influencing the modulation of pitchcoming out of digital pin 9 in a single image. To do this I edited the overall values and rangeof frequency in the program to be smaller. This made it easier to capture both changes involtage and subsequently pitch on the same figure (without the digital waves simply lookinglike noise or a solid square block.)

The oscilloscope image depicted in Figure 9 shows how slowly changing the voltage leadsto the micro controller modulating the pulse simultaneously. This motion and voltage changecorresponds to smooth sounding changes in pitch. To make the images look better I alsoeliminated the second octave harmonic from the program because it made the pulse widthmodulation in the images much more confusing to look at. To analyze the response timeof the Arduino, we captured an image of a rapidly changing voltage overlapped with theresulting pulse width modulation illustrated in Figure 10.

13

Page 19: ThereminReport

4.2 Micro-Controller Analysis Data and Analysis

Figure 9: The first channel on the oscilloscope is the voltage being taken at analog pin A0,depicted in yellow in this image. The blue channel represents the digital pulses coming outof the Arduino. When the voltage is high the corresponding frequencies are high, and as thevoltage drops, the pulse width is appropriately modulated. From this figure we can deducethat the Arduino is working properly.

Figure 10: The first channel on the scope is again, depicted in yellow, the voltage comingfrom the collector of the photo transistor in the first stage. In blue are the digital pulsescoming out of the Arduino. It was especially hard to capture this figure, as the range infrequencies that will be distinguishable on a single oscilloscope image are constrained by thetimescale, and so trying to having a quickly fluctuating voltage and pulse width togetherwas a difficult balance to find, but this image illustrates the device’s capacity to do so.

14

Page 20: ThereminReport

4.3 Volume Control Analysis Data and Analysis

4.3 Volume Control Analysis

The third stage is a difficult part of the overall circuit to analyze because there are a lotof pieces connected together serving many different functions, all of which can be interrupt-ed/adulterated by the presence of the scope. First we analyzed the individual componentsin the circuit and found that the resistance of the feedback resistor was 98.7 kΩ, while theother resistor (connected to ground) in the amplifier was approximately 1 kΩ (actually mea-sured 0.97 kΩ but this value fluctuated a bit). It is important to note that at this point inthe analysis the second frequency was added back into the code (the second pitch being anoctave higher or twice the frequency).

Then we analyzed the output at the buffer to be sure that the volume was being manipu-lated, and to see what the signal going into the amplifier looked like. The buffer is a voltagefollower circuit, so these voltages should not be too much larger than the signal coming outof the collector of the photo transistor used to control volume in the third stage.

Although the signal is a bit noisy the voltage appears so be starting close to zero and

Figure 11: The voltage coming out of the buffer appears to follow the signal from the phototransistor as expected, and we see that the voltage has been lifted by the op amp withoutinfluencing the frequency of the signal.

rising to and average value around 5V, which affirms what we expect from the voltage fol-lower circuit. These figures do seem to indicate that the higher frequency signals are moreresponsive to the volume control circuit. Next we analyze the signal coming out of the am-plifier to examine whether it too will respond to changes in voltage, while also amplifyingthe overall signal.

The cursors in Figures 11 and 12 are not well placed, but you can see from Figure 11that most of the signal is being amplified from an initial infinitesimal voltage to about 5V.In Figure 12 we see that this signal is noisier but the overall voltage amplification is muchgreater, resulting in a much louder maximum volume, while also indicating the dynamicrange of this voltage as we move left to right (during which I began to block light).

It is important to note that in the second stage we observe outputs that are only positivevoltages because the digital output is a square wave. When we move to the third stage, and

15

Page 21: ThereminReport

4.3 Volume Control Analysis Data and Analysis

Figure 12: As we move left to right on the scope face the overall amplitude of the signalis clearly growing. This illustrates our capacity in the third stage to influence volume bymanipulating the incident light on the photo transistor in the third stage. Note the enormousgain in signal voltage from left to right as I slowly allow more light to hit the photo transistor.

the op-amps are introduced, we see that we get positive and negative voltages. This helpsincrease the overall volume as well in addition to the current and voltage boost that theTVL2362 op-amps provide.

After analyzing the volume control circuit it is clear that various frequencies behavedifferently when passing through the op-amps. This leads to a signal that is noisy bothgraphically and aurally. The volume control circuit is also much harder to manipulate incomparison to the pitch circuit. This may be due to the orientation of the photo transistorsin combination with the arrangement of light sources. This may also be indicative of the factthat changes in volume are harder to control and also perceive due to the frequency responseof the human ear and the low-power/voltage operating ranges of the op-amps. Regardless,the volume control circuit allows the loudness of the pitches from the speaker to controlledby the performer and be audible.

16

Page 22: ThereminReport

5. External Sound Analysis

Using an external microphone (in my laptop) and the audio analysis software Raven (de-signed for analyzing bird sounds), I can analyze the output of the speaker. All of the analysisdone thus far has been on the circuitry itself, which has indicated that everything is func-tioning properly. By performing this alternative method of analysis, I can inspect the actualsound that is heard rather than the raw electronic signal. Raven is a powerful piece of soft-ware that allows the user to simultaneously capture the waveform of a sound, as well as afrequency spectrogram of this sound in real time.

A frequency spectrogram is simply a diagram of frequency versus time, where the colorintensity represents the power of each frequency. Before I did any analysis in Raven, I elimi-nated the secondary octave tone from the Arduino sketch to make the process of interpretingthe figures generated in Raven more straightforward.

In the process of doing this external sound analysis I was reminded of the subtle naturein which the square waves are actually being generated by the Arduino. In addition, theusage of pulse-width modulation (PWM) in the Arduino to create the changes in pitch be-comes important as well when studying the frequency spectrogram of sound from an externalsource. A square wave is a mathematically impossible function because it has discontinuities.

Therefore, to replicate or produce a square wave requires the mathematical tool called a

Figure 13: This frequency spectrogram created in Raven illustrates how using a Fourierseries will combine multiple frequencies to approximate the shape of a square wave. Themore frequencies added, the more the signal will resemble a square wave. This image wastaken from an outside source [7].

Fourier series [6]. Essentially, square waves are created by combining an infinite sum of sineand cosine functions. When analyzing the frequencies being captured by Raven, we expectto not simply see a straight line at the frequency desired, but rather a sum of (theoreticallyinfinite) frequencies because of the mathematical necessity of using a Fourier series to createthese square waves. Below is an equation for this Fourier analysis specifically for analyzingdigital pulses, where L equals twice the period of the signal. Equation 3 mathematicallyrepresents how a square wave function is generated by using the summation of an infinitenumber of sin and cosine functions in addition to the fundamental frequency [6].

17

Page 23: ThereminReport

5.1 External Frequency Analysis External Sound Analysis

f(t) =a0

2+

∞∑

n=1

ancos(nπt

L) +

∞∑

n=1

bnsin(nπt

L) (3)

5.1 External Frequency Analysis

The first part of my analysis with Raven was to analyze the lowest pitch generated whenall of the ambient light is unimpeded and hitting the first (pitch control) photo transistor.The frequencies captured in this figure were not exactly what is expected of a Fourier series,and the power of these additional frequencies was surprising as well. However, the frequencystill sounds low despite so many high frequencies being captured. The more interestinginformation from this data was the sheer number of additional frequencies. This must bebecause it takes more terms in a Fourier series to approximate a signal with a smallerperiod/lower pitch. This is why the importance of using PWM in the device is important toconsider when studying the sound externally using Raven.

The next test was to observe and analyze the highest frequencies coming out of the Light

kHz S

0.500

1.000

1.500

0.000

0.5 1 1.5 2 2.5 3 3.5 4.198

Figure 14: This is the frequency spectrogram produced by Raven when trying to capturethe lowest frequency, while all ambient light is unblocked. The y-axis is frequency andthe x-axis is time in seconds. Although there was a recorded frequency of 102Hz with apower of 95.5 dB, there were more than 14 other frequencies captured whose power were notsmaller than the fundamental. We do expect to see a large number of frequencies, howevereach increasing frequency should be quieter, and the power/darkness of these additionalfrequencies illustrated was unexpected.

Theremin with Raven, with the goal of capturing a powerful frequency at 800Hz. What wasobserved was similar to that of the low frequency spectrogram, however there were feweradditional frequencies present than when analyzing the lower pitch. To reiterate, the darkerthe line the more powerful the frequency captured in the figure is. The maximum frequencywith the most power captured was 771Hz with a power of 105.7 dB. The other frequencieswere still powerful, but had less power than the fundamental frequency which is what isexpected from the Fourier series expansion as these additional frequencies should becomeless powerful.

Overall, Raven revealed that the Arduino is in fact putting out our desired fundamentalfrequencies, with a minimum of 102Hz and a maximum of 796Hz. However the power ofthe additional frequencies, required by a Fourier series to make the square waves, were toostrong at low frequencies. When analyzing the highest fundamental frequency the power of

18

Page 24: ThereminReport

5.1 External Frequency Analysis External Sound Analysis

Table 1: Lowest Frequency Raven DataFrequency (Hz) Power (dB) Frequency Compared Fundamental

102 95.5 1.02f0238 90 2.3f0363 99.9 3.63f0499 105.2 4.99f0612 102.2 6.12f0748 100.9 7.48f0885 96.5 8.85f0998 98.8 9.98f01123 91.2 11.23f01259 89.6 12.59f01372 97.9 13.72f01497 97 14.97f01633 97.7 16.33f01894 89.9 18.94f0

Table 2: Highest Frequency Raven DataFrequency (Hz) Power (dB) Frequency Compared Fundamental

771 105.7 0.96f01485 103.8 1.86f02250 104.9 2.81f02298 96.7 3.74f03769 95.3 4.71f04511 74.5 5.64f05253 82.6 6.57f0

Figure 15: This frequency spectrogram generated by Raven was produced when trying tocapture the highest frequency coming out of the speaker from the Light Theremin. They-axis is frequency and the x-axis is time in seconds.The darkness indicates the power ofeach frequency. There were many frequencies captured, bother higher and lower than thetarget of 800Hz, however at 771Hz the signal had a power of 105.7dB. This was strongerthan the other frequencies that appear on the spectrogram.

19

Page 25: ThereminReport

5.2 External Volume Control Analysis External Sound Analysis

these additional frequencies were overall smaller than the fundamental, and also decreased ina fashion that would be expected of a Fourier series expansion. The frequencies present wereboth even and odd multiples of the fundamental frequencies. This is an interesting resultwhich may be related to how the Arduino actually performs the pulse width modulation, ormay be a result of something within the circuitry itself.

5.2 External Volume Control Analysis

The next step I took for analyzing the sound output of the Light Theremin, with an externalmicrophone and the Raven software, was to take a look at the volume manipulation. Beforeanalyzing the volume control with Raven, I chose to cover the pitch control photo transistorin order to keep the pitch constant. This choice is subtle but important, because the volumecontrol circuit is more sensitive to higher frequencies than lower frequencies. This may be dueto the fact that higher frequencies carry more energy and power, and therefore manipulatingthe volume of a high frequency will have a more noticeable range in decibel change. Thefrequency that was recorded in Raven during the volume control analysis was 796Hz.

kU S

-20

-10

10

20

30

0.000

5 10 15 20 25 30 36.052

kHz S

1.000

1.500

2.000

2.500

3.000

3.500

0.000

5 10 15 20 25 30 36.052

Figure 16: The top image is the waveform of the recorded sound. The units of the waveformfigure on the y-axis are measured in kilo-Pascals, which is indicative of the sound pressureand therefore the perceived volume. The x-axis of both figures is time in seconds. Thebottom image is the frequency spectrogram. Using Raven to analyze the recording depictedin this figure, we found a maximum volume of 105.7dB and a minimum volume of 15.2 dB.This is visually represented by the varying darkness of the frequency spectral lines, and iscorroborated by simultaneous changes in the amplitude of the waveform.

I also chose to use higher frequencies for this stage of analysis because as mentionedpreviously, Raven appears to be designed for higher pitches and therefore creates muchcleaner images when recording higher frequencies. I also decided to add a 1 nF capacitor inparallel with the volume control photo transistor, which not only made the volume control

20

Page 26: ThereminReport

5.3 External Frequency Modulation Analysis External Sound Analysis

must more responsive, but also allowed for complete silence to be achieved when the lighthitting the volume control photo transistor is completely occluded. This was a somewhateducated guess that turned out to be highly effective.

From the recording in Raven, I was able to measure a change in volume (of the 796Hzfrequency that we are choosing to analyze) from 105.7dB to a volume of 10.2 dB. The decibelis a logarithmic scale because the power intensity of sounds that the human ear can respondto covers an enormous range. Therefore this change in decibel created by the volume controlcircuit is extremely dramatic. To get a sense of how dramatic this decibel change is, we cancompare these decibel values to commonplace sounds. 105 dB is equivalent to the volume ofa lawn mower, while 10.2 dB is barely perceptible and is essentially silence [5].

5.3 External Frequency Modulation Analysis

In addition to analyzing volume modulation in Raven, I also analyzed the frequency modu-lation of the Light Theremin with the Raven Software. Similar to the previous examples ofanalysis using Raven, the recording of frequency modulation also recorded many frequenciesbeing captured simultaneously. Again, these other frequencies were unanticipated, and whenanalyzing the frequency modulation of the Light Theremin in Raven I chose to only look atthe fundamental pitch range that was programmed into the Arduino (100Hz -800Hz).

kHz S

1

2

3

4

5

0.000

2 4 6 8 10 12 14 16 18 20 22 24 26 28 29.6

Figure 17: This image, created by the Raven audio analysis software, depicts the frequencyspectrogram as the frequency coming from the Light Theremin is modulated from a minimumfrequency of approximately 88Hz to a maximum of 798Hz. Again the y-axis is in kHz andthe x-axis in seconds. It is reassuring to see in this figure that the frequencies higher thanthe fundamental appear to be quieter than the fundamental, which is how the Fourier seriescreation of square waves is supposed to behave.

For the recording of frequency modulation I began with the pitch control photo transistorbeing completely unblocked, and slowly moved my hand closer and closer (which manipu-lates the intensity of light hitting the photo transistor) until it was eventually completelycovered. The frequency of this fundamental pitch was modulated from approximately 88Hzto a maximum of 798Hz. This is a good result because the map function in the Arduinois programmed to have a frequency range of 100Hz -800Hz. From these results it can beconcluded that the frequency modulation of the Light Theremin works properly. It is alsointeresting to see how the Fourier series overtones respond to changing the fundamental.

21

Page 27: ThereminReport

6. Conclusion

Overall the instrument I designed and built functions as initially proposed. The pitch comingout of the speaker was extremely sensitive to the movement of a performer’s hand alteringthe amount of incident light on the photo-transistor (in the first stage of the design). Thissensitivity was a result of our ability to get such a wide range of voltages from the firststage. This range was approximately 4.41V as denoted in Section 4.1 of this report. Havingsuch a large voltage range, and the ability to manipulate the voltage so precisely (whichwas confirmed and illustrated in Section 4.1 as well), allows the Arduino to have a morecontinuous sounding change in pitch or dramatic changes in pitch (depending again on howthe light is being manipulated).

The Arduino quickly and easily translates a voltage to a pitch, using very simple codeincluded in Section 4.1 of this report. As I have previously mentioned the wide range inanalog input voltages allows the map function to assign many more pitches between theminimum and maximum frequencies. This leads to outputs with changes in frequency thatcan be smooth or erratic, depending on how the performer chooses to play the instrument.

The volume control circuit did not initially work as well as anticipated, however by addinga capacitor in parallel to the volume control photo transistor the circuit was able to controlvolume in a very controlled manner that now functions exactly as I envisioned.

The difficulty is that perceived volume is also dependent on frequency, and in addition thevoltage/power constraints of the Arduino forced me to use op-amps designed for low powerand voltage operation. These limitations may be why the volume control is less responsiveand/or sensitive compared to the pitch control. However, the output signal has a voltagerange that can reach up to 17V and a minimum of essentially zero volts (as described in theSection 4.3, even while muted and fully blocked some high frequencies seem to occasionallyslip through). This enormous range in amplification was illustrated in Section 4.3, andquantified in Section 5.2. By using Raven, this change in volume was quantified and shownto be a change of almost 90 dB, which is a significant change in volume.

The most interesting part of the analysis of the Light Theremin was the usage of theaudio recording/analysis software Raven. Although Raven utilized an external microphoneto confirm the data and analysis done on the actual electronic signal, it revealed that thespeaker is not simply playing a single tone as I imagined. At first I thought that perhapsRaven was so sensitive it was picking up another source of noise, however after reviewing thefigures that illustrate changes in volume (found in Section 4.3) and changes in pitch (foundin Section 4.2), it is clear that these frequencies react in accordance with the programmedfundamental frequency.

After consulting with Professor Sullivan I was reminded of how square waves are producedusing a Fourier series of additional frequencies to construct a square wave. That being said,these additional frequencies at times do not appear to have volumes that act in accordancewith how a digital pulse is constructed should with a Fourier series. The tables, included inSection 5.1, indicate that the power of these additional frequencies were far too high at thelow end. Furthermore, when analyzing the highest frequencies in Section 5.1 the additionalfrequencies are both odd and even which is not what is to be anticipated, and may be abyproduct of how the Arduino handles pulse width modulation, or perhaps is an unintended

22

Page 28: ThereminReport

Conclusion

consequence somewhere in the volume control or amplification process.In the construction of this instrument I have encountered many engineering problems

which were handled accordingly, but in the end I believe the Light Theremin functions inalignment with the philosophy and aesthetic I initially desired. It is a fun and interestinglittle device that allows a person to interact with science in a unique and subjective way.I believe it is important to provide people (especially children) with alternative ways toexperience and interact with science, and I think this device does so in a tangible mannerwhich also allows for subjective expression and may foster an appreciation for Science forthose already exposed to science.

Similarly, if children were exposed to such a device earlier on (elementary or middle schoolperhaps) in a music education environment they may gain a new appreciation for science anda curiosity that would motivate them to want to learn more! In addition if introduced intothe classroom of students with special needs, this device may allow them to communicateand be expressive in a non-verbal manner, enable them (despite being disabled) to feel moreconnected to the world that has taken so much from them and given back so little, andhopefully and most importantly it could excite them and bring them joy.

23

Page 29: ThereminReport

References Cited

[1] K. D. Skeldon, L. M. Reid, V. McInally, B. Dougan, C. Fulton, Physics of the Theremin,American Journal of Physics 66 (1998).

[2] M. Vennard, Leon Theremin: The man and the music machine, BBC News, (2012),available at http://www.bbc.com/news/magazine-17340257.

[3] G. Grimes, How a Theremin Works, How Stuff Works, available at http://

electronics.howstuffworks.com/gadgets/audio-music/theremin1.htm.

[4] NTE Electronics, NTE3034A Photo Transistor Detector, available at http://www.

nteinc.com/specs/3000to3099/pdf/nte3034a.pdf.

[5] S. Fox , Noise Level Chart, Noise Help, available at http://www.noisehelp.com/

noise-level-chart.html.

[6] M. Boas,Mathematical Methods in the Physical Sciences,Third Edition, John Wiley andSons, 2006.

[7] W.T. Bridgman, Quantized Redshifts.II.The Fourier Series, Crank Astronomy, (2011),available at http://2.bp.blogspot.com/_okIcsBieX4U/TRKogEZh16I/AAAAAAAAAIY/

spYsURzN3d0/s1600/squarewave32terms.png.

24