May 17, 2016 - sive Arduino micro-controller, I designed and created a unique and potentially educational musical and scientific instrument. The sound production ...... nteinc.com/specs/3000to3099/pdf/nte3034a.pdf. [5] S. Fox , Noise Level ...
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 17, 2016
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 Department, 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
Abstract Using a combination of resistors, photo transistors, op amps and one inexpensive Arduino micro-controller, I designed and created a unique and potentially educational musical and scientific instrument. The sound production and control of this instrument relies on the manipulation of light hitting photo transistors. 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 education setting (perhaps with special needs students as well) it has the capacity to entertain, educate and perhaps even inspire.
i
Acknowledgements 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 the construction of this instrument, for his help with writing this report and for suggesting I analyze the speaker output with Raven. I would also like to thank Dan Briotta for teaching me so much about analog electronics and computer programming, for helping me develop a range of skills as a scientist and as an inventor, and for encouraging me to embrace an idea and turn it into a reality. Thank you all so much!
i
Contents 1 Introduction
1
2 Design
5
2.1
First Stage: Pitch Control . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.2
Second Stage: Micro-controller
. . . . . . . . . . . . . . . . . . . . . . . . .
8
2.3
Third Stage: Volume Control . . . . . . . . . . . . . . . . . . . . . . . . . .
10
3 Test Methods
13
3.1
Testing: Pitch Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
3.2
Testing: Micro-controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
3.3
Testing: Volume Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
4 Data and Analysis
18
4.1
Pitch Control Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
4.2
Micro-Controller Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.3
Volume Control Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5 External Sound Analysis
25
5.1
External Frequency Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.2
External Volume Control Analysis . . . . . . . . . . . . . . . . . . . . . . . .
29
5.3
External Frequency Modulation Analysis . . . . . . . . . . . . . . . . . . . .
30
6 Conclusion
32
ii
1. Introduction The worlds of science and art collided with the invention of the Theremin, a bizarre experimental instrument patented in 1928 by Leon Theremin who subsequently signed a contract with RCA (Radio Corporation of America) in 1929 making them the “first mass producer of an electronic instrument” [2]. The Theremin is often cited by historians as being the first invention to “lay the foundations for modern electronic music” [2]. However, this is not where 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 in magnetic fields. Theremin took this research, on electromagnetic field sensors, and instead applied it to create a musical instrument. He brought his invention to Lenin (the current leader of the the Russian Communist Party at the time) who wanted Theremin to show his device off to the entire world. This freedom to travel allowed Theremin to come to the United States 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-American woman he found his US funding depleting (an unfortunate consequence of the racism in the US during the 1920s) and was no longer considered an asset by the Soviets. He was subsequently kidnapped by the KGB and brought back to Russia. Nevertheless, his device was already being mass produced and generating enormous interest. The Theremin enables performers to draw out pitches from thin air, without the performer ever physically touching the instrument, by using the position of the musicians hand to 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 the pioneering invention that paved the way for musical instruments rooted in physics and specifically 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]. 1
Introduction Science is a pursuit of the objective, dealing with concrete logical ideas that exist far beyond the classroom and far from the hands of students. We run experiments and manipulate the world every day, but most of this is done in a sterile environment. A scientist may run an experiment but the outcomes (almost) always depend on invisible forces extending throughout the universe. This quality is what I find so compelling about the concept of the original Theremin and the device I have built. It can be used to engage people from outside of the scientific community and spark the curiosity that leads them down the path of discovering the true magic that is science. In addition, my mother is an elementary school teacher for students with disabilities, and a device like this allows handicapped individuals to be both expressive and entertained in a non-verbal way that requires very little dexterity. I have a passion for music because it has a similar capacity for experimentation, allowing an individual to share a subjective experience in an (almost entirely) objective world. The motivation and goal of my project was to unite my passions for science and music, and in the process design a device that can bring the abstract and unseen nature of physics to your fingertips. This can be done in a variety of ways using modern technology. The instrument I have designed and built relies on the manipulation of light instead of the electric field surrounding an antenna (the primary scientific phenomenon that the Theremin utilizes). The Light Theremin relies on the performer to control the amount of light hitting a photo-transistor to 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 the collector being put into an Arduino Uno and the emitter being connected to ground. Ambient light hitting the photo-transistor yields an output of zero volts because the transistor is essentially “shorted” when there is maximum light. As an obstacle blocks light from hitting the photo-transistor, the voltage at the collector increases. A 100 KΩ resistor is placed in between the power source and the collector to maximize the possible range in voltage that can be output by the transistor.
2
Introduction The circuitry becomes a musical instrument by mapping the possible range of voltages to a range of pitches or frequencies. Therefore as the the voltage being taken from the collector changes, the Arduino Uno will produce a digital square wave with a pitch that is directly proportional 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 inputs/outputs and 13 digital inputs/outputs. Programs for the Arduino are written in the Arduino Integrated Development Environment (IDE), and are compiled and uploaded to the micro-controller via USB. Compiling the programs, which are written in a programming environment that is extremely similar in syntax to Java or Python, puts them into a machine language that tells the Arduino what to do. Once a sketch is uploaded to the Arduino there is no need for a computer. The photo-transistor circuit and the Arduino itself can run on the 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 analogous to the Theremin because the sounds being created are generated by the performer manipulating light, requiring no physical contact with the instrument. Pitch is continuously shifted or altered by moving a hand around or above the photo-transistor, this movement changes the amount of light hitting the photo-transistors. The sound is much more coarse than the Theremin because the Arduino outputs rough digital square waves. The sensitivity is quite impressive however, as the photo-transistor output voltage responds extremely quickly to changes in light. Science is an amazing tool for understanding the world around us, but sometimes fails to inspire students because it feels intangible. Instruments like the Theremin, and the one that I have built, are good tools for showing how these properties of physics are truly physical things 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 create something out of (seemingly) nothing, providing the potential for the scientifically inclined to pursue musical endeavors or for the musically inclined to pursue scientific studies.
3
Introduction
Figure 1: This is an image of the instrument I have built. The Arduino is depicted in the middle, with the photo-transistor for pitch control on the left and the photo-transistor for volume control shown on the right. The speaker is also in this image, and is built into the board.
4
2. Design The design of this instrument relies on three distinct stages of circuitry. The first stage is where ambient light from the performance space is used to control a voltage. This analog voltage is fed into a micro-controller which is the second stage of the device. The third stage of the device controls the volume of the output of the micro-controller, which is now a digital square wave of varying frequency. This modulate of frequency changes based on how the user 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 operation of a photo-transistor. Essentially, a photo-transistor operates in a fashion very similar to a light emitting diode or LED. When a voltage is applied to an LED, current will flow and the LED with begin emitting light. Once light is emitted there will also be a voltage potential across the LED. Similarly an LED can be oriented in an opposite fashion such that a voltage potential can be induced by light hitting the LED, allowing current to flow. The amount of current an LED will generate upon illumination is quite small. To increase the current produced by the LED we connect it to the base of a transistor. Now, when the LED is illuminated it will allow a much larger current to pass through the collector to the emitter. This use of the LED is referred to as being reverse biased, and this combination of an LED with a transistor is called a photo-transistor. The photo transistors used in this device are sensitive to visible light and also to infrared light. During maximum illumination the photo-transistor puts out a minimum voltage and total darkness creates a maximum voltage. To understand this, we treat the photo-transistor
5
2.1 First Stage: Pitch Control
Design
Figure 2: Circuit diagram illustrating voltage source, 100 KΩ resistor and photo-transistor in parallel with Vout coming from the collector.
a bit like a variable resistor. When fully illuminated, the photo-transistor essentially makes a short to ground and so the voltage measured at the collector is essentially zero because all of the voltage has been used across the resistor R1 . When partially illuminated the photo transistor begins to act like a variable resistor (with a “resistance” dependent on the amount of incident light) and there will be a voltage coming out of the collector. If one fully covers the photo-transistor the equivalent “resistance” is extremely high, because almost no current will flow from the collector to the emitter. Therefore the voltage at the collector is at a maximum because this equivalent resistance of the photo transistor is much larger than the resistance of R1 . This equivalent resistance of the photo transistor will be denoted as Rpt in Equation 1. Fundamentally this circuit acts like a voltage divider, with a voltage being connected to a resistor and photo transistor in series. With our applied voltage being Vcc (in this case a constant +5V), and the output being taken after the resistor R1 , our equation for the Vout is as follows:
6
2.1 First Stage: Pitch Control
Design
Figure 3: This is an oscilloscope snapshot of how blocking light increases the voltage at the collector. This figure does not depict the full voltage range, but rather illustrates the capacity of the circuit to allow a person to manipulate the voltage at the collector.
Vout =
Rpt Vcc R1 + Rpt
(1)
Treating our photo transistor as a variable resistor (this variable resistance denoted as Rpt ) we can make our circuit be equivalent to a voltage divider circuit and use Equation 1 to approximate the maximum and minimum output voltages of the first stage circuit. When fully illuminated we approximate the equivalent resistance of the photo-transistor is 100 Ω, and when in complete darkness the equivalent resistance is approximately 1 MΩ. Calculating for our theoretical minimum and maximum output voltages we find that with a fully illuminated circuit we should get an output of 4.99 mV. Our theoretical maximum voltage for our circuit in complete darkness is calculated to be 4.55 V. These numbers are simply approximations (based on the nature of reverse biased diodes) so we can conceptualize how to control a voltage by manipulating the amount of light hitting a photo-transistor.
7
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 that the Arduino performs are hardcoded in the Arduino Integrated Development environment. These programs are called “Sketches”, and are uploaded to the micro-controller through a USB connection to be stored so that the device can run without being connected to a computer. The sketch for this project first requires declarations of variables, such as the pin to be specified for the analog input coming in from the first stage (for this project this is analog input pin A0). The program itself runs through a “loop” method that performs the continuous actions we desire from the micro-controller. In the case of the Light Theremin the micro-controller first sets a serial communication rate of 9600 bits per second, and then takes a reading of the voltage A0. The Arduino has a function called “Map”, which requires five parameters. It is designed to take a number and re-assign it to a new value based on a second specified range of values. In our case the first set of ranges are the digital values for our minimum voltage and the digital value for our maximum voltage (the voltages that come from the first stage circuit). The second range of values are the pitches that we will want the Arduino to put out.
int sensorPin = A0; int sensorValue = 0;
// select the input pin for the photo-transistor // 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 8
2.2 Second Stage: Micro-controller
Design
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 at A0. The next two parameters are the lowest and highest possible digital values which are 0 and 1023 because the resolution of the analogRead function is 10 bits (although a higher resolution 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 minimum of 100 Hertz and a maximum of 800 Hertz, although experimentation with this range will be necessary to determine what sounds most interesting! The value returned by the Map function is saved as the variable denoted “int pitch”, and will be used in the next line of code. The next step in the program is to call the tone function (not to be confused with the “int pitch” variable calculated and stored as a return from the map function), saved in the code as the variable “int pitch”.) which requires three arguments. The first argument of the tone function (the Arduino sketch that is included in the report also illustrates calling the tone function) included is the digital pin that will output digital square waves. The second argument is the frequency you want these square waves to have, in our case a value saved as “pitch” from the map function we previously used. The third and final argument of the tone 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 have also added a second tone (with twice the frequency, an octave above) to make the rough digital sound slightly “larger” and more interesting. To add a harmonic, the program is 9
2.3 Third Stage: Volume Control
Design
delayed briefly after the first tone is played and then the tone function is called again. On the 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 powered on. The result is a seamless stream of tones that can be manipulated in the manner described above.
2.3 Third Stage: Volume Control The third stage of the device is a circuit to regulate volume and play our tones through a small speaker. The first component of this stage is to take the output from the digital pin of the Arduino. To regulate the volume of this tone using light, we utilize a similar circuit to that of the first stage. Instead of a constant DC voltage, we use the digital output as our V+ and again feed this voltage into a resistor and photo-transistor in series, with the emitter connected to ground. This will allow us to manipulate the voltages being put out by the Arduino pins by blocking and partially blocking the light hitting the photo-transistor. However, if we used the same circuit as the first stage, our overall range of volume would be decreased because of the first resistor and because of the low power output of the photo-transistor (typical Collector current of 5 × 10−4 A [4]). Although we would be able to vary the volume of the tones, the maximum volume will be quieter than we would like because of these power constraints. Considering we desire to connect this circuit, which allows us to influence voltage and subsequently volume, to an 8 Ω speaker we need a way to safely make this connection without drawing too much power from the photo-transistor (connecting the 8 Ω speaker will draw a large amount of current). So we need a circuit to amplify the output of this second phototransistor without drawing too much power from the it. The way we do this is to connect the output of the collector (from our third stage photo-transistor circuit) into an op-amp buffer circuit (operational amplifier). The benefit 10
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 op amps used for the buffer and amplification circuit are TVL2362 and are designed for lower power/voltage applications compared to convential op amps.
11
2.3 Third Stage: Volume Control
Design
of using the op-amp buffer circuit is that it’s input impedance is extremely high so as to not draw too much additional current from the photo-transistor (no increased load). The output impedance of the buffer circuit is extremely low as well, which is exactly what we need for amplification. The most important aspect of the buffer circuit is that the output voltage exactly follows the input voltage and provides additional power. Although the buffer circuit has solved our issues of power and impedance for the speaker, we still need to increase the voltage in the third stage to get the signal from the digital output of the Arduino to get back to an audible level (the buffer circuit provides no voltage gain). However, now that we have isolated the output signal from the Arduino we can safely amplify this signal with another op-amp circuit. The best op-amp circuit for this stage is the non-inverting amplifier because it will provide us with the decibel gain we require to make this instrument audible. The load put on the non-inverting amplifier should not be an issue because 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 are designed for low power applications so when choosing these resistors we need to maximize this power without damaging the Op-Amps in order to have sound output at an audible level. The Gain of a non-inverting amplifier is:
G=
Vout Rf =1+ Vin R2
(2)
The maximum power output of the photo-transistor is quite small, as well as the OpAmps, so to avoid breaking any of these circuit elements we have designed a buffer and an amplification circuit with resistors Rf and R2 in the non inverting amplifier of 1 KΩ and 100 KΩ respectively. Now we have a third stage for the Light Theremin which will allow for volume control through the manipulation of light.
12
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 sure each component does what it should. However, because each part of the design operates simultaneously, another method of testing was to modify the micro-controller program to achieve optimal timbre. The final test was to assess the overall operation of the device including all components, and to evaluate and confirm that the Light Theremin is operating as intended.
3.1 Testing: Pitch Control The “pitch” or frequency is actually assigned within the program stored in the microcontroller, so the first stage is only concerned with manipulating light in order to proportionally change a voltage. To test the first stage I connected the output of the collector to an oscilloscope, and observed the voltage coming out. The first stage worked properly once it put out the widest possible range between 0 V and 5 V (we have chosen 5 V because this is the maximum operating voltage of the Arduino). I confirmed that the pitch control photo transistor operated as intended by connecting the output to an oscilloscope and verified that this output was reacting to hand motion (resulting in the obstruction of light), by observing oscilloscope images that resembled Figure 7. Therefore I concluded that the first stage of the Light Theremin worked properly, by inspecting the voltage as aforementioned, because as I occluded more light the voltage steadily rose. The output will never quite get to a maximum of 5 V, but the circuit is considered to be functioning properly if the voltage essentially reads zero while all ambient light hits the photo transistor, and with a hand directly covering the photo transistor the oscilloscope reads a voltage that is at least 4.5 V, but ideally closer to 4.85 V or higher (but always less
13
3.2 Testing: Micro-controller
Test Methods
Figure 5: This oscilloscope image shows the the signal coming from the Arduino when the program is modulating frequency properly. I began with my hand covering the phototransistor and slowly moved my hand away, resulting in the depicted modulation of the frequency of the digital square wave output.
than 5V).
3.2 Testing: Micro-controller When Testing the micro-controller I first pressed the on-board reset button. Before uploading the code, I compiled the sketch to make sure all the syntax was correct and when there were no errors. I then uploaded it to the Arduino to be saved. Once the syntax has been verified and the sketch is uploaded to the Arduino, I tested whether the program assigned pitches correctly, as specified by the program, by connecting the digital output pin, assigned by the program, into an oscilloscope and observed the digital square waves. After observing the pulse-widths of the digital output being modulated as one varies the amount of light hitting the first stage photo-transistor, I concluded that the pitch control and micro-controller portion of the Light Theremin device were working together. Another test method I utilized was to simply connect the digital output to a speaker
14
3.3 Testing: Volume Control
Test Methods
Figure 6: This oscilloscope image captures the voltage of the signal being manipulated. This signal 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. It is also interesting to notice that the high frequencies appear to be more responsive to the volume control circuit.
(and ground the other terminal), and listened to the sound that came out. This method will not ensure that the proper frequencies were being generated, but if the Arduino modulates the digital pulse widths, as depicted in Figure 5, then as I moved my hand over and around the 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 volume control circuit began with testing the operation of the photo transistor portion first. The output from the collector, from the photo transistor used in the third stage volume control circuit, is where the signal was tested first. By connecting the collector output to an oscilloscope and covering and uncovering this photo transistor, the waveform on the oscilloscope changed 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 buffer 15
3.3 Testing: Volume Control
Test Methods
circuit provides a boost in voltage and power, however the signal coming in should be nearly identical to the signal coming out. To test this I used a voltmeter and simply put the contacts before the buffer and after, and checked that these voltages were identical (or at least extremely close to one another). Connecting the buffer to an oscilloscope proved to be an ineffective method, for reasons that I cannot explain, however I believe it may have to do with 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. This was done quickly and subjectively by simply connecting the output of the amplifier to the speaker and listening to the sound for changes in volume as I covered and uncovered the photo transistor. This is not the most scientific approach or the most effective way to test the 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 amplitude of the wave forms change as I covered and uncovered the photo transistor. However, as mentioned earlier, introducing the oscilloscope into the circuit at this point did not influence the functioning of the circuit the way it did when trying to test the buffer circuit. This is why I believe using the oscilloscope to test the buffer circuit must cause some sort of impedance issue that influences the overall function of the circuit. Regardless, I have established that the amplifier worked and operated properly by observing infinitesimal voltages when I fully enclosed the photo transistor with my hands, and seeing extremely large voltages when the photo transistor was left untouched and all the light in the performance space is allowed to hit it. I noticed that the operation of the buffer and amplifier (both of which rely upon the function of op amps) seemed to be less responsive to lower frequencies than higher frequencies. 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 entirely covered, the output signal had very quiet lower frequency signals coming out and was never
16
3.3 Testing: Volume Control
Test Methods
completely silent. believe this could be addressed with the inclusion of a low pass filter somewhere in the third stage circuit (this was eventually done later, referenced is Section 5.2). Overall the entire volume control circuit worked as originally designed, such that there was a maximum volume when light was completely unblocked, and the speaker is essentially silent (except for some slight noise) when the photo transistor in the volume control circuit was completely covered.
17
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 fluorescent bulbs on the ceiling. This may seem like a mundane detail, but the device does require some sort of light source to be manipulated, and one that is ideally coming down uniformly from overhead. With all of this ambient light, unimpeded and hitting the surface of the first NTE3034A photo-transistor, we observe a minimum voltage of 160 mV. Measuring the resistance of the R1 , the resistor connected to this photo transistor we find that it’s resistance is actually 87 kΩ. Using these numbers we can use Equation 1 to solve for the equivalent 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 the equivalent resistance of the photo-transistor under maximum illumination is 287 Ω. This confirms our design goal of and is quite close to our approximation, but moreover this result confirms while being fully illuminated the photo transistor is essentially a short to ground. When fully blocking the photo transistor from all light, the observed voltage was 4.56 V. This is extremely close to our theoretical values from the design section. Once again solving the voltage divider equation, to evaluate the equivalent resistance of the photo-transistor in the dark, we find that it’s equivalent resistance is 0.902 MΩ. This is also quite close to what we expected.The voltage range achieved by moving our hand from far away to extremely close was about 4.41 V. This is a good range to map our frequencies, and means we are utilizing almost 90% of our allowed range of 0 V-5 V. The oscilloscope image depicted in Figure 8 demonstrated the sensitivity of the device. I waved my hand rapidly over the photo transistor and observed if the quick physical motion would correspond to rapidly fluctuating voltages on the oscilloscope. From Figure 8 I have demonstrated the capacity of the device to respond to extremely quick changes in light 18
4.1 Pitch Control Analysis
Data and Analysis
Figure 7: This oscilloscope image depicts how the voltage slowly increased as I moved my hand closer to the NTE3034A photo transistor in the first stage of the device, starting at the minimum of 160 mV and moving steadily to a maximum of 4.56 V.
Figure 8: This oscilloscope image illustrates the sensitivity of the first stage circuit utilizing the NTE3034A photo transistor. Rapid hand motion translates into quickly changing voltages.
19
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 out of the Arduino. When the voltage is high the corresponding frequencies are high, and as the voltage drops, the pulse width is appropriately modulated. From this figure we can deduce that the Arduino is working properly.
intensity (again, by waving my hand over the photo transistor to rapidly change the amount of light incident on it) translating into rapidly changing voltages. In addition, Figure 7 illustrates the circuits capability to steadily increase in a smooth fashion as well. This means that the device can produce smooth changes in pitch or rapid and large changes in pitch, depending on how the performer chooses to manipulate the light in the performance space.
4.2 Micro-Controller Analysis It was difficult to capture data, on an oscilloscope, of the voltage at analog pin A0 influencing the modulation of pitch coming out of digital pin 9 in a single image. To do this I edited the overall values and range of frequency in the program to be smaller. This made it easier to capture both changes in voltage and subsequently pitch on the same figure (without the digital waves simply looking like noise or a solid square block.) It was difficult to capture 20
4.2 Micro-Controller Analysis
Data and Analysis
Figure 10: The first channel on the scope is again, depicted in yellow, the voltage coming from the collector of the photo transistor in the first stage. In blue are the digital pulses coming out of the Arduino. It was especially hard to capture this figure, as the range in frequencies that will be distinguishable on a single oscilloscope image are constrained by the timescale, and so trying to having a quickly fluctuating voltage and pulse width together was a difficult balance to find, but this image illustrates the device’s capacity to do so.
data, on an oscilloscope, of the voltage at analog pin A0 influencing the modulation of pitch coming out of digital pin 9 in a single image. To do this I edited the overall values and range of frequency in the program to be smaller. This made it easier to capture both changes in voltage and subsequently pitch on the same figure (without the digital waves simply looking like noise or a solid square block.) The oscilloscope image depicted in Figure 9 shows how slowly changing the voltage leads to the micro controller modulating the pulse simultaneously. This motion and voltage change corresponds to smooth sounding changes in pitch. To make the images look better I also eliminated the second octave harmonic from the program because it made the pulse width modulation in the images much more confusing to look at. To analyze the response time of the Arduino, we captured an image of a rapidly changing voltage overlapped with the resulting pulse width modulation illustrated in Figure 10.
21
4.3 Volume Control Analysis
Data and Analysis
Figure 11: The voltage coming out of the buffer appears to follow the signal from the photo transistor as expected, and we see that the voltage has been lifted by the op amp without influencing the frequency of the signal.
4.3 Volume Control Analysis The third stage is a difficult part of the overall circuit to analyze because there are a lot of pieces connected together serving many different functions, all of which can be interrupted/adulterated by the presence of the scope. First we analyzed the individual components in the circuit and found that the resistance of the feedback resistor was 98.7 kΩ, while the other resistor (connected to ground) in the amplifier was approximately 1 kΩ (actually measured 0.97 kΩ but this value fluctuated a bit). It is important to note that at this point in the analysis the second frequency was added back into the code (the second pitch being an octave higher or twice the frequency). Then we analyzed the output at the buffer to be sure that the volume was being manipulated, and to see what the signal going into the amplifier looked like. The buffer is a voltage follower circuit, so these voltages should not be too much larger than the signal coming out of 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 22
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 signal is clearly growing. This illustrates our capacity in the third stage to influence volume by manipulating the incident light on the photo transistor in the third stage. Note the enormous gain in signal voltage from left to right as I slowly allow more light to hit the photo transistor.
rising to and average value around 5V, which affirms what we expect from the voltage follower circuit. These figures do seem to indicate that the higher frequency signals are more responsive to the volume control circuit. Next we analyze the signal coming out of the amplifier to examine whether it too will respond to changes in voltage, while also amplifying the overall signal. The cursors in Figures 11 and 12 are not well placed, but you can see from Figure 11 that 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 much greater, resulting in a much louder maximum volume, while also indicating the dynamic range 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 positive voltages because the digital output is a square wave. When we move to the third stage, and the op-amps are introduced, we see that we get positive and negative voltages. This helps increase the overall volume as well in addition to the current and voltage boost that the
23
4.3 Volume Control Analysis
Data and Analysis
TVL2362 op-amps provide. After analyzing the volume control circuit it is clear that various frequencies behave differently when passing through the op-amps. This leads to a signal that is noisy both graphically and aurally. The volume control circuit is also much harder to manipulate in comparison to the pitch circuit. This may be due to the orientation of the photo transistors in combination with the arrangement of light sources. This may also be indicative of the fact that changes in volume are harder to control and also perceive due to the frequency response of 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 controlled by the performer and be audible.
24
5. External Sound Analysis Using an external microphone (in my laptop) and the audio analysis software Raven (designed for analyzing bird sounds), I can analyze the output of the speaker. All of the analysis done thus far has been on the circuitry itself, which has indicated that everything is functioning properly. By performing this alternative method of analysis, I can inspect the actual sound that is heard rather than the raw electronic signal. Raven is a powerful piece of software that allows the user to simultaneously capture the waveform of a sound, as well as a frequency spectrogram of this sound in real time. A frequency spectrogram is simply a diagram of frequency versus time, where the color intensity represents the power of each frequency. Before I did any analysis in Raven, I eliminated the secondary octave tone from the Arduino sketch to make the process of interpreting the figures generated in Raven more straightforward. In the process of doing this external sound analysis I was reminded of the subtle nature in which the square waves are actually being generated by the Arduino. In addition, the usage of pulse-width modulation (PWM) in the Arduino to create the changes in pitch becomes important as well when studying the frequency spectrogram of sound from an external source. 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 Fourier series [6]. Essentially, square waves are created by combining an infinite sum of sine and cosine functions. When analyzing the frequencies being captured by Raven, we expect to not simply see a straight line at the frequency desired, but rather a sum of (theoretically infinite) frequencies because of the mathematical necessity of using a Fourier series to create these square waves. Below is an equation for this Fourier analysis specifically for analyzing digital pulses, where L equals twice the period of the signal. Equation 3 mathematically represents how a square wave function is generated by using the summation of an infinite number of sin and cosine functions in addition to the fundamental frequency [6]. 25
5.1 External Frequency Analysis
External Sound Analysis
Figure 13: This frequency spectrogram created in Raven illustrates how using a Fourier series will combine multiple frequencies to approximate the shape of a square wave. The more frequencies added, the more the signal will resemble a square wave. This image was taken from an outside source [7].
f (t) =
∞ ∞ ∑ a0 ∑ nπt nπt + an cos( )+ bn sin( ) 2 L L n=1 n=1
(3)
5.1 External Frequency Analysis The first part of my analysis with Raven was to analyze the lowest pitch generated when all 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 frequency still sounds low despite so many high frequencies being captured. The more interesting information from this data was the sheer number of additional frequencies. This must be because it takes more terms in a Fourier series to approximate a signal with a smaller period/lower pitch. This is why the importance of using PWM in the device is important to consider when studying the sound externally using Raven. The next test was to observe and analyze the highest frequencies coming out of the Light 26
5.1 External Frequency Analysis
External Sound Analysis
1.500 1.000 0.500 0.000 kHz
S
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 capture the lowest frequency, while all ambient light is unblocked. The y-axis is frequency and the x-axis is time in seconds. Although there was a recorded frequency of 102 Hz with a power of 95.5 dB, there were more than 14 other frequencies captured whose power were not smaller than the fundamental. We do expect to see a large number of frequencies, however each increasing frequency should be quieter, and the power/darkness of these additional frequencies illustrated was unexpected.
Theremin with Raven, with the goal of capturing a powerful frequency at 800 Hz. What was observed was similar to that of the low frequency spectrogram, however there were fewer additional frequencies present than when analyzing the lower pitch. To reiterate, the darker the line the more powerful the frequency captured in the figure is. The maximum frequency with the most power captured was 771 Hz with a power of 105.7 dB. The other frequencies were still powerful, but had less power than the fundamental frequency which is what is expected from the Fourier series expansion as these additional frequencies should become less powerful. Overall, Raven revealed that the Arduino is in fact putting out our desired fundamental frequencies, with a minimum of 102 Hz and a maximum of 796 Hz. However the power of the additional frequencies, required by a Fourier series to make the square waves, were too strong at low frequencies. When analyzing the highest fundamental frequency the power of these additional frequencies were overall smaller than the fundamental, and also decreased in a fashion that would be expected of a Fourier series expansion. The frequencies present were both even and odd multiples of the fundamental frequencies. This is an interesting result which may be related to how the Arduino actually performs the pulse width modulation, or
27
5.1 External Frequency Analysis
External Sound Analysis
Table 1: Lowest Frequency Raven Data Frequency (Hz) Power (dB) Frequency Compared Fundamental 102 95.5 1.02f0 238 90 2.3f0 363 99.9 3.63f0 499 105.2 4.99f0 612 102.2 6.12f0 748 100.9 7.48f0 885 96.5 8.85f0 998 98.8 9.98f0 1123 91.2 11.23f0 1259 89.6 12.59f0 1372 97.9 13.72f0 1497 97 14.97f0 1633 97.7 16.33f0 1894 89.9 18.94f0
Table 2: Highest Frequency Raven Data Frequency (Hz) Power (dB) Frequency Compared Fundamental 771 105.7 0.96f0 1485 103.8 1.86f0 2250 104.9 2.81f0 2298 96.7 3.74f0 3769 95.3 4.71f0 4511 74.5 5.64f0 5253 82.6 6.57f0
Figure 15: This frequency spectrogram generated by Raven was produced when trying to capture the highest frequency coming out of the speaker from the Light Theremin. The y-axis is frequency and the x-axis is time in seconds.The darkness indicates the power of each frequency. There were many frequencies captured, bother higher and lower than the target of 800 Hz, however at 771 Hz the signal had a power of 105.7 dB. This was stronger than the other frequencies that appear on the spectrogram. 28
5.2 External Volume Control Analysis
External Sound Analysis
may 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 external microphone and the Raven software, was to take a look at the volume manipulation. Before analyzing the volume control with Raven, I chose to cover the pitch control photo transistor in order to keep the pitch constant. This choice is subtle but important, because the volume control circuit is more sensitive to higher frequencies than lower frequencies. This may be due to the fact that higher frequencies carry more energy and power, and therefore manipulating the volume of a high frequency will have a more noticeable range in decibel change. The frequency that was recorded in Raven during the volume control analysis was 796 Hz. 30 20 10 0.000 -10 -20 kU
S
5
10
15
20
25
30
36.052
S
5
10
15
20
25
30
36.052
3.500 3.000 2.500 2.000 1.500 1.000 0.000 kHz
Figure 16: The top image is the waveform of the recorded sound. The units of the waveform figure on the y-axis are measured in kilo-Pascals, which is indicative of the sound pressure and therefore the perceived volume. The x-axis of both figures is time in seconds. The bottom image is the frequency spectrogram. Using Raven to analyze the recording depicted in this figure, we found a maximum volume of 105.7 dB and a minimum volume of 15.2 dB. This is visually represented by the varying darkness of the frequency spectral lines, and is corroborated by simultaneous changes in the amplitude of the waveform.
29
5.3 External Frequency Modulation Analysis
External Sound Analysis
I also chose to use higher frequencies for this stage of analysis because as mentioned previously, Raven appears to be designed for higher pitches and therefore creates much cleaner images when recording higher frequencies. I also decided to add a 1 nF capacitor in parallel with the volume control photo transistor, which not only made the volume control must more responsive, but also allowed for complete silence to be achieved when the light hitting the volume control photo transistor is completely occluded. This was a somewhat educated guess that turned out to be highly effective. From the recording in Raven, I was able to measure a change in volume (of the 796 Hz frequency that we are choosing to analyze) from 105.7 dB to a volume of 10.2 dB. The decibel is a logarithmic scale because the power intensity of sounds that the human ear can respond to covers an enormous range. Therefore this change in decibel created by the volume control circuit is extremely dramatic. To get a sense of how dramatic this decibel change is, we can compare these decibel values to commonplace sounds. 105 dB is equivalent to the volume of a 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 modulation of the Light Theremin with the Raven Software. Similar to the previous examples of analysis using Raven, the recording of frequency modulation also recorded many frequencies being captured simultaneously. Again, these other frequencies were unanticipated, and when analyzing the frequency modulation of the Light Theremin in Raven I chose to only look at the fundamental pitch range that was programmed into the Arduino (100 Hz -800 Hz). For the recording of frequency modulation I began with the pitch control photo transistor being completely unblocked, and slowly moved my hand closer and closer (which manipulates the intensity of light hitting the photo transistor) until it was eventually completely covered. The frequency of this fundamental pitch was modulated from approximately 88 Hz to a maximum of 798 Hz. This is a good result because the map function in the Arduino 30
5.3 External Frequency Modulation Analysis
External Sound Analysis
5 4 3 2 1 0.000 kHz
S
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 frequency spectrogram as the frequency coming from the Light Theremin is modulated from a minimum frequency of approximately 88 Hz to a maximum of 798 Hz. Again the y-axis is in kHz and the x-axis in seconds. It is reassuring to see in this figure that the frequencies higher than the fundamental appear to be quieter than the fundamental, which is how the Fourier series creation of square waves is supposed to behave. is programmed to have a frequency range of 100 Hz -800 Hz. From these results it can be concluded that the frequency modulation of the Light Theremin works properly. It is also interesting to see how the Fourier series overtones respond to changing the fundamental.
31
6. Conclusion Overall the instrument I designed and built functions as initially proposed. The pitch coming out of the speaker was extremely sensitive to the movement of a performer’s hand altering the amount of incident light on the photo-transistor (in the first stage of the design). This sensitivity was a result of our ability to get such a wide range of voltages from the first stage. This range was approximately 4.41 V as denoted in Section 4.1 of this report. Having such a large voltage range, and the ability to manipulate the voltage so precisely (which was confirmed and illustrated in Section 4.1 as well), allows the Arduino to have a more continuous sounding change in pitch or dramatic changes in pitch (depending again on how the light is being manipulated). The Arduino quickly and easily translates a voltage to a pitch, using very simple code included in Section 4.1 of this report. As I have previously mentioned the wide range in analog input voltages allows the map function to assign many more pitches between the minimum and maximum frequencies. This leads to outputs with changes in frequency that can 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 adding a capacitor in parallel to the volume control photo transistor the circuit was able to control volume 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 the voltage/power constraints of the Arduino forced me to use op-amps designed for low power and voltage operation. These limitations may be why the volume control is less responsive and/or sensitive compared to the pitch control. However, the output signal has a voltage range that can reach up to 17 V and a minimum of essentially zero volts (as described in the Section 4.3, even while muted and fully blocked some high frequencies seem to occasionally slip through). This enormous range in amplification was illustrated in Section 4.3, and quantified in Section 5.2. By using Raven, this change in volume was quantified and shown 32
Conclusion to 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 the audio recording/analysis software Raven. Although Raven utilized an external microphone to confirm the data and analysis done on the actual electronic signal, it revealed that the speaker is not simply playing a single tone as I imagined. At first I thought that perhaps Raven was so sensitive it was picking up another source of noise, however after reviewing the figures that illustrate changes in volume (found in Section 4.3) and changes in pitch (found in Section 4.2), it is clear that these frequencies react in accordance with the programmed fundamental frequency. After consulting with Professor Sullivan I was reminded of how square waves are produced using 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 accordance with how a digital pulse is constructed should with a Fourier series. The tables, included in Section 5.1, indicate that the power of these additional frequencies were far too high at the low end. Furthermore, when analyzing the highest frequencies in Section 5.1 the additional frequencies are both odd and even which is not what is to be anticipated, and may be a byproduct of how the Arduino handles pulse width modulation, or perhaps is an unintended 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 in alignment with the philosophy and aesthetic I initially desired. It is a fun and interesting little 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 to experience and interact with science, and I think this device does so in a tangible manner which also allows for subjective expression and may foster an appreciation for Science for those already exposed to science. Similarly, if children were exposed to such a device earlier on (elementary or middle school
33
Conclusion perhaps) in a music education environment they may gain a new appreciation for science and a curiosity that would motivate them to want to learn more! In addition if introduced into the classroom of students with special needs, this device may allow them to communicate and be expressive in a non-verbal manner, enable them (despite being disabled) to feel more connected to the world that has taken so much from them and given back so little, and hopefully and most importantly it could excite them and bring them joy.
34
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 and Sons, 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.
35