You are on page 1of 11

Optical Theremin Design & Implementation

Critical Design Review

Team Lucky Sevens


Corbin Reeder Vladimir Bakirov Nikolaus Fritz

5 March 2014

Abstract
One of the more obscure musical instruments ever invented is an electronic device called a theremin. This instrument can be played with no physical contact and is controlled by the position of the musicians hands, one of which controls the amplitude whil e the other controls the frequency. This project tackles creating a theremin device which senses hand position via the light intensity incident on a photodiode. The first sub-system of our design transforms the light intensities into voltage signals using analog circuitry. After that, the voltage signals are sampled using the analog inputs on an NI myDAQ along with a LabVIEW Virtual Instrument. The LabVIEW coding scales and coerces the signals to acceptable values, then uses them to generate a sine wave. This sine wave is then written to the myDAQ and outputted through its 3.5mm TRS connector. Our design offers a selectable auto-tune feature which enables the device to only play musical notes. The final product of this project yielded a fully functioning optical theremin that automatically adjusts to be played in different ambient light levels.

Introduction
This project is aimed at taking us through the design process and teaching us how to develop a design review document. Team Lucky Sevens undertook the design and implementation of an optical theremin device to meet the requirements of Lab 2 for EE 300W. The device must be capable of generating a user-controllable audio tone. This audio tone will have amplitude and frequency that can be adjusted through light intensity in a range of different ambient settings. Our implementation of this device includes an analog photodetector circuit, a LabVIEW virtual instrument, and an NI myDAQ. The light intensities incident on the amplitude and frequency sensors are transformed into voltage signals then sampled using the myDAQ. Using LabVIEW code, the signals are normalized then used to generate an output sine waveform through the myDAQs 3.5mm audio port.

Rationale
A block diagram showing the high level system design can be found under Figure 1 in the appendix. LabVIEW programming along with the MyDAQ was chosen to read inputs, generate, and output an audio signal because of its usability and flexibility in design. The photodector circuits were designed and implemented first in order to provide appropriate inputs for the MyDAQ to sample. Photodiodes produce a leakage current in proportion to the light intensity. In order to be used as an input to the MyDAQ, this current must first be transformed into a voltage range between 10 volts. The best way to achieve this is through a transimpedance amplifier. The TL074 op-amp was used for this because it features low input bias and offset currents as well as high input impedance. Current limiting resistors and zener diodes were used to protect the circuit devices from high current and voltage levels. The LabVIEW code auto-adjusted the light intensity to ambient light levels to improve usability, accuracy, and precision as opposed to a user estimating light intensity range. The DAQ assistant read in a set number of samples for the amplitude and frequency light intensities. This set number of samples was used in order to prevent a large backup of data that would occur with continuous sampling, which crashes the program. Next, normalization occurred in order to prepare the data for any auto tuning and to be sent to generate the signal. Signal generation occurred at high enough frequency to comply with the Nyquist sampling theorem. These samples were continuously outputted in order to create a smooth sounding audio tone.

Implementation

Figure 1: Front Panel

Figure 2: Theremin VI Block Diagram

Photodector circuit:
The photodetector circuit has a photodiode that acts as a variable current source based on light intensity. At ambient light levels in the demo room, the photodiode produced a current of 300nA with a 1kohm limiting resistor. The transimpedance amplifier included a TL074CN op amp whose input-output relationship is described by the formula Vout=-Iin*Rb. Rb was chosen as 10Mohm to produce a Vout of 3 volts. In order to protect the MyDAQ from an input greater than 10 volts in high light levels, a 10 volt rated zener diode in series with a 1kohm resistor was put at the output of the op amp. MyDAQ inputs were read from across the zener diode. This circuit was constructed twice to provide two distinct light levels for frequency and amplitude. Testing revealed that with non-ideal effects, ambient light level inputs were at 6.2 volts for the amplitude circuit and 7.8 volts for the frequency circuit. This was within the requirements for the MyDAQ input.

Figure 3: Photodetector Circuit Schematic

Ambient Light Adjuster:


On program start up, 100 samples for both the frequency and amplitude light intensities are read in from the MyDAQ. These samples are averaged to find the maximum ambient light levels. These values and an error signal will be passed out and used for the normalizer and to ensure the program runs in the designated order, respectively.

Figure 4: Calibrator Block Diagram

Input Sampler:
After the maximum light levels have been acquired, the program begins to take samples through the DAQ Assistant. 10 samples are read in at 10kHz for both analog in channels. This signal is split into the separate frequency and amplitude values, which get averaged by the MEAN function. These values are displayed to fill a design requirement and are sent to the normalizer.

Normalizer:
The normalizer takes in 6 inputs. These are the user-controlled frequency minimum and maximum values, the two average sampled values, and the two ambient level values. The
Figure 5: Input Sampler

amplitude sample is converted into a value between 0 and 1 by dividing the input sample by the maximum possible amplitude value (the ambient). The frequency sample is ranged between the users frequency minimum and maximum by this formula: fmin+(fmax-fmin)*Lsamp/Lambient (L being light intensity in volts). The normalized values are passed out, displayed, and sent to the optional auto-turner.

Figure 6: Normalizer Block Diagram

Auto-Tuner:
If active, the auto-tuner will coerce the normalized frequency sample to the nearest note. An array is created that stores the frequency values of the 12 notes in an octave for the first 8 octaves. The frequency sample is compared to the values in the array and thresholded to the nearest note. A check is made to ensure the notes frequency is above the user -set minimum and below the user-set maximum. If it does not fall in this range, the next highest or lowest note, respectively, is chosen. If the auto-tuner is not active, the normalized values are sent directly to the signal generator.

Figure 7: Autotuner Block Diagram

Signal Creator:
The Simulate Signal function is used to create a virtual sine wave. To prepare the sine wave for output, the frequency of the wave is set by the auto-tuner (if active) or the normalizer (inactive auto-tuner). The amplitude is set as the normalized sample value. This value, between 0 and 1, complies with the MyDAQs maximum output range of 2 volts. 50k samples per second are generated to comply with the nyquist theorem, as you must sample at least 2x as fast as your highest frequency (20kHz). 5k samples are then displayed and sent to the DAQ Assistant for output.

Audio Output:
The DAQ Assistant receives the data generated by the Simulate Signal function and generates the output wave. The 5k samples read in are all written out to the audio out terminal of the MyDAQ at the same speed that the samples are generated. This ensures no data loss or backup, allowing instantaneous changing of the frequency and amplitude values. Continuous generation of these samples creates a smooth sounding audio tone to be heard. Speakers or headphones are plugged into the audio out jack to listen to the generated tone.

Figure 8: Output Generation

Conclusion
Analog circuitry, an NI myDAQ, and a LabVIEW virtual instrument came together in this project to create a simple and easy to use optical theremin. An analysis of our initial block diagram compared to our final project is located under Figure 1 in the appendix. A bill of materials is located under Figure 2 in the appendix. Our team learned from breaking the design process into stages and decomposing the system into sub-systems. This project was a useful and enjoyable exercise for team-building and writing technical design documents. We also greatly increased our understanding of data sampling and generation within LabVIEW. The outcome of this project yielded a fully functioning optical theremin that is able to output audio tones according to the users hand position.

Appendix
Figure 1: System Block Diagram

Analysis: Our final product shows that our initial block diagram was an accurate representation of the system. However, the calibrate light levels block was incorrectly placed under the light detection circuits block instead of the signal generation block.

Figure 2: Bill of Materials

Bill of Materials Optical Theremin


Item Op-Amp Photodiodes Zener Diodes 1k Resistors 10M Resistors LabVIEW 2011 myDAQ Manufacturer Texas Instruments Advanced Photonix Inc. NXP Semiconductors Stackpole Electronics Inc. Stackpole Electronics Inc. National Instruments National Instruments Model TL074CN PDB-C142 NZX10B,133 CF14JT1K00 CF18JT10M0 LabVIEW Base myDAQ Supplier Digi-Key Corp. Digi-Key Corp. Digi-Key Corp. Digi-Key Corp. Digi-Key Corp. National Instruments National Instruments Unit Price Quantity $0.62 $2.98 $0.21 $0.08 $0.09 $999.00 $233.00 1 1 2 4 2 1 1 Extended Price $0.62 $2.98 $0.42 $0.32 $0.18 $999.00 $233.00 Total $1,236.52

You might also like