Optical Theremin Critical Design Review Team Plasma: Michael Giallorenzo, Joseph Mertz, Daniel Mikhail, Omar Fernandes EE 300W, Lab 2 March 8, 2015 Abstract An optical theremin is an instrument that can adjust its volume and frequency without being physically touched. This design implements two photodiodes, which can source varying amounts of current depending on how much light they are exposed to. If a user holds one hand over each photodiode, moving one hand will adjust the pitch of the sound being played, and the other will adjust the volume. This is accomplished by converting the currents to voltages, measuring them with a MyDAQ, and analyzing this input and producing the output with LabVIEW. This method utilizes materials that can be obtained at a fairly low cost, as well as software that is available to many university students, and it produces a product that will function properly as long as it is used in a well lit room. Introduction Traditionally played by waving hands through an electric field, one of the first electronic instruments was invented by Leon Theremin in 1928. Team Plasma was tasked with creating a different kind of Theremin, one that is played by moving hands to control the amount of light the photodiodes are exposed to. The requirement for the Optical Theremin was that two optical diodes, one controlling frequency, another controlling amplitude, must be used. Additionally, the Theremin controls must be created with the LabVIEW software. An optical diode takes ambient photons and creates current. By placing the diode in the shadow of an object, the output current of the diode decreases. By varying the distance of the object to the diode a low-level current signal can be created. An amplified voltage signal can be created by feeding the current signal into a transimpedance amplifier. The LabVIEW interface is able to take the voltage representation of the frequency and amplitude current signals to create the Theremin instrument. A high level block diagram is shown in Figure 3 in the appendix and a Gantt chart showing Team Plasma’s progress is shown in Figure 4. Rationale The requirement that LabVIEW and a MyDAQ were to be used heavily influenced our design. Since MyDAQs can more easily measure voltage, a transimpedance amplifier opamp was used to convert the current to voltage and to amplify it. Using an 8.2 MΩ resistor in each amplifier circuit, our measured maximum current of 0.3µA was converted into 2.46 V. This provided a greater degree of resolution to counteract the limited accuracy of the MyDAQ, while leaving plenty of overhead so as to avoid clipping due to brighter light. Photodiodes would never be used when designing a high quality theremin because measuring exposure to light is not always an accurate measurement of distance. Since photodiodes were required to be used, we decided to emphasize flexibility and simplicity over performance. For example, every time this theremin is used it must be calibrated by completely removing your hands and exposing it to the maximum amount of light. This is a very simple form of calibration that requires minimal prior experience. However, temporary sources of light would ruin the calibration and would require a restart. Given the nature of our theremin and its expected users, this was deemed an acceptable compromise. The use of photodiodes, LabVIEW, and a MyDAQ were required, but they all offer distinct advantages. Photodiodes will not account for small changes in distance very well, but they are cheap and were readily available. LabVIEW is an expensive program, but it is one that is widely available at universities and in research labs. Its graphical interface enabled our team to complete its work quickly, and provides an easy interface for users to examine and expand upon the existing software. The value of the MyDAQ is that it is an inexpensive device that interfaces very well with LabVIEW. Implementation Circuit Analysis: In our circuit design we used a TL074CN operational amplifier configured as two transimpedance amplifiers. One will be the frequency control circuit and one will be the amplitude control circuit. In this configuration we could convert the leakage current from the OP906 photodiode in each circuit to a voltage. We could then manipulate this voltage value in LabVIEW. The value of the resistor in each transimpedance configuration is 8.2 megaohms. This resulted in a leakage current of about 0.3 microamps and a voltage range of 0-2.46 Volts. With these values being sent to the MyDAQ, we could now use LabVIEW to manipulate the signals. We chose to use this circuit design because it was the simplest and most realizable. Block Diagram Analysis: Our main VI will take the two input signals generated by our circuit and split them into two separate signals. One signal will designate the amplitude of the audio signal we output and then other will designate the frequency. After manipulating these signals they will be output to a speaker where the resultant audio signal can be heard. The front panel of our block diagram is shown in Figure 5 of the appendix. The settings for the DAQ assistants used for reading the input and writing the output are shown in Figure 9. After the MyDAQ acquires signals from our circuit, the dynamic data type is split into two signals. The input signals will be read 100 samples at a sampling rate of 100kHz. After we acquired these 100 samples they are averaged with the mean VI. That value is then sent to a min/max VI with a shift register that is initialized at 0.1. The original input value is then divided by the maximum value from the min/max block. This will normalize our signal and give us values between 0 and 1 only. This will make it possible for the user to scale the signals into the desired range of values. This is done by allowing the user to input a multiplier on the front panel. This process is done to both the frequency and amplitude signals, allowing the user to control the range of values for both. The block diagram for this portion of the VI, Figure 6, can be seen in the appendix. The autotune feature was designed as a sub VI controlled by enumerated data type. The autotune sub VI contains an array of frequency values of the notes of a chromatic scale. The values are then fed into a Threshold 1D Array block. This block will compare the input frequency to the value closest to it in our chromatic scale array. It then outputs the fractional index of the frequency which is then converted to an unsigned integer value. This value is then fed into an index array block which will output the frequency in our chromatic scale array that is closest to the original input frequency. The autotuned frequency will then be sent back to the main VI. The user also has the choice of which key the sound will be played in. The G, C, and F# major scales are included. This was done in exactly the same method as the autotune feature. The arrays of frequencies for each scale are placed in a case structure and fed into the tuning circuit. If the user chooses a different scale, there will only be a different array of frequencies fed into the tuning circuit. The autotuning and scale selecting circuit is Figure 7 in the appendix. The amplitude signal and frequency signal (autotuned or not) are then fed into a simulate signal VI. This block will simulate a sine wave that can then be output as an audio signal. There is also a frequency offset control on the front panel for the user to choose. The user can also control distortion of the signal. They can control how they would like to clip the signal, hard or soft, and if they chose to clip the signal, they can control how much they would like to. An enumerated type is used to control which clipping method is employed. First the dynamic data type at the output of the simulate signal block is converted to an array and then fed into a case structure. When the user choses hard clipping the signal is fed into an “In Range and Coerce” block. The user also chooses where they would like to clip the signal. They can clip the signal anywhere from 30-90% of the original signal. The user will chose any allowed value and this multiplier will be the range that the In Range and Coerce block checks to see if the original amplitude falls within. If the amplitude is out of the chosen range it will be clipped off. The same process occurs if the user selects soft clipping with one extra addition. The difference between the original amplitude and the clipped amplitude is calculated and then scaled down. The user can chose how much they would like to scale this value meaning they can control how much they would like to soft clip the signal. Once this difference is calculated and scaled, it is then added back to the clipped amplitude resulting in a signal with soft clipping. This process is all done within the clipping case structure and is Figure 8 in the appendix. Once the signal passes through the clipping case structure it is then converted back to a dynamic data type and sent to the DAQ assistant block that will send the signal to the audio output port on the MyDAQ. Now the user can run the program and the optical theremin will control the audio output from the MyDAQ. Pitch, volume, autotuning, and distortion, can all be controlled with this simple circuit and via the LabVIEW front panel shown in Figure 5. The final circuit is shown in Figure 2, and the complete LabVIEW program is shown in Figure 10. Conclusion We created an optical theremin, a musical instrument that is played without physical contact, by building transimpedance amplifier circuits and a LabVIEW program. The photodiodes in the circuit detect light intensity which then control the amplitude and frequency of the audio signal produced by the theremin. A MyDAQ is used to read the voltages that correspond to the varying light intensities, controlled by the position of the user’s hands, and to output the audio signal through an audio jack. The total list of required components is shown in the Bill of Materials in Figure 1 of the appendix. This method proved to be a cost-effective method for creating a theremin. Appendix A: Optical Theremin Figures Bill of Materials Item Texas Instruments TL074CN Operational Amplifier Silicon Photodiode OP906 8.2MΩ Resistor National Instruments MyDAQ Quantity Price per unit Totals Source 1 $0.62 $0.62 Mouser 2 2 1 $0.59 $1.95/10 resistors $250 $1.18 $0.39 $250 Mouser Amazon Studica Total: $252.19 Figure 1: Bill of Materials Figure 2: Circuit Diagram Figure 3: Block Diagram Figure 4: Gant Chart Figure 5: LabVIEW Front Panel Figure 6: Input Normalization and Scaling Stage Figure 7: Autotune Stage Figure 8: Clipping and Final Output Stage DAQ Assistant and Sampling Settings DAQ Assistant (input) Voltage_0 Max (V) 10 Voltage_0 Min (V) -10 Acquisition Mode N Samples Samples to Read 100 Rate (Hz) 100k DAQAssistant3 (output) VoltageOut Max (V) 2 VoltageOut Min (V) -2 Generation Mode Continuous Samples Samples to Write 10k Rate (Hz) 100k Figure 9: DAQ Assistant Settings Figure 10: Complete LabVIEW Block Diagram Works Cited "What's a Theremin?" Theremin World. N.p., 6 Dec. 2005. Web. 08 Mar. 2015.
© Copyright 2026 Paperzz