Lab 2 Critical Design Review

advertisement
Lab 2:
Designing an Optical Theremin
Team: Crazy Eights
EE 300W Section 1
February 20, 2013
Abstract
The following document describes the process of designing an optical theremin, a musical
instrument that is played without physical contact. The theremin was implemented with both
hardware and software, with the NI myDAQ serving as the interface between the circuitry and
LabVIEW. The amplifier circuit converted the photodiode currents into two voltage signals, one
each for amplitude and frequency, to be read by the NI myDAQ. In LabVIEW, these signals
were normalized and scaled according to user specifications. The user was also given the option
to autotune the frequency to play a specific octave. The final audio signal was outputted through
the 3.5-mm audio jack of the NI myDAQ. This solution minimizes costs, maximizes the ease of
use and modification.
Introduction
The purpose of this lab experiment was to design an optical theremin to output a user-controlled
audio signal. In this case, the frequency and amplitude of the output signal were proportional to
the amount of light detected by the instrument. To optimize usability, the design must allow the
user to control the amplitude range and frequency range, as well as specify the allowed light
intensity. The second part of the design involved implementing an auto-tune feature that can be
activated by the user if desired. This feature will ensure that the output signal has a tone in the
equal-tempered scale.
The proposed solution consisted of two parts: a circuit for sensing light, and a LabVIEW
program to process the resulting signal. Photodiodes were used to detect the light intensity. The
goal of the circuitry was to convert the current produced by the photodiode into a measurable
voltage signal. This signal was read by the NI myDAQ and processed in LabVIEW, which
resulted in an audio output signal with user-controlled volume, tone, and auto-tuning. The user is
able to choose the range of frequencies and amplitudes of the output signal through the userfriendly LabVIEW Front Panel. If chosen, the auto-tuning option coerces the frequency to the
chosen octave for a smoother sound.
Rationale
The following block diagram details the original design of the theremin:
Figure 1: Initial Block Diagram
Measure
light with
photocell
Light
Currentto-Voltage
Amplifier
Read
signal with
myDAQ
Separate
Amplitude and
Frequency
Signals
±15-V
From
myDAQ
Normalize
the Signals
Scale the
Signals
Auto-tune
frequency
Generate
Sine Wave
Audio
Signal
Output
The circuit design constructed for this project was a basic current-to-voltage amplifier circuit.
This design was used because the photodiode produces a reverse leakage current that is
proportional to light intensity. The TL074CN op-amp was chosen for design because of its low
input impedance. A voltage signal was needed so that the NI myDAQ could implement the
design. The following equation describes the current-to-voltage conversion:
vout = -idiode *Rf
For this design, the NI myDAQ and LabVIEW VI interface was used instead of a purely
hardware solution. Due to difficulty of implementation and modification and the cost of the
hardware, the decision to use software design as well as circuit design was the best approach.
The only drawback was the sampling rate of the NI myDAQ, which could affect the continuity
of the output signal. When writing the LabVIEW code, it was necessary to normalize the data for
both the amplitude and frequency outputs. These outputs were scaled to a user-defined range.
The following equation describes the normalization and scaling:
f0 = fmin + (fmax – fmin) *((xi – xmin)/(xmax – xmin))
This equation is composed of two steps: normalizing the input value between 0 and 1, and
scaling it to the user-defined minimum and maximum values. This equation normalizes the
signals on a linear scale.
Auto-tuning is necessary for the optical theremin design because it allows the user to play the
instrument in a specific octave. In a separate sub-VI, a ten-element array was created to represent
the user-chosen octave. The base value of each user-chosen octave was multiplied by an array of
increasing powers of 2 to initialize the array to the set of frequencies corresponding to that
octave. The input frequency was coerced to one of the values in the octave array using a
rounding operation. The resulting frequency was outputted to the main VI to generate the output
signal.
Implementation
A number of modifications were made to the design during implementation:
 The current-to-voltage amplifier was changed from two stages to one. We originally
included an inverting amplifier to make the signal positive. After building the LabVIEW
virtual circuit, we realized that further amplification of the signal was not necessary and
could be done in LabVIEW.
 In LabVIEW, we decided to normalize the frequency on a logarithmic scale. It was
decided that for a frequency range of 20-20,000 Hz that this scale would more effectively
represent a wide range of frequencies.
 Due to errors stemming from the data type of the signals, we decided to average the input
signals and process a single, averaged value instead of processing the entire array of
inputs.
To make the LabVIEW virtual circuit work correctly over the entire range of frequencies, the
original settings for the DAQ Assistant were changed. On the input side, the sampling frequency
was set to 200 kHz, taking 100 samples with each reading. When simulating the output signal, an
error was received if the sampling frequency was not twice as high as the signal frequency. The
sampling frequency was set to 50 kHz and the number of samples to 50000 to correct the issue.
To create a smoother audio signal as opposed to a pulsing signal, the number of samples created
by the signal generator was lowered to 5000. For the output DAQ Assistant, the voltage
amplitude range was adjusted to be between -2 and 2 V. The signal was outputted continuously.
Value Statement
The production and implementation of an optical theremin does not particularly benefit or
improve the human condition. However, this lab is beneficial to the designers because it allows
them to generate creative ideas and unique solutions to a common goal while building teaming
skills. The final product satisfies both the TA’s and the students. The TA’s are satisfied by
receiving the final product that meets all of the requirements by their deadline. For the design
teams, it shows that they are able to use necessary problem solving and teaming skills to produce
a functional final product from a mere description and engineering requirements.
Results
The LabVIEW Front Panel and block diagrams are shown in the following figures.
Figure 3: LabVIEW Front Panel
Figure 4: LabVIEW Virtual Circuit Block Diagram
The block diagram in Figure 4 starts with the DAQ Assistant acquiring the voltage readings for
the frequency and amplitude. The signal data types are converted from dynamic data to separate
1-D arrays of doubles and outputted to waveform charts. The signals are then averaged using the
Mean VI to convert the arrays into a single value of type double. The mean value is normalized
to between 0 and 1 to set the maximum and minimum light levels. The normalized signal is then
scaled according to the user-defined ranges for amplitude and frequency. The amplitude signal is
scaled linearly, and the frequency is scaled logarithmically. The signals are outputted to another
waveform and are inputted into the Simulate Signal block. The result is a sine wave with varying
frequency and amplitude and is output to the audio jack of the NI myDAQ using the DAQ
assistant.
Figure 5: LabVIEW subVI for Auto-Tuner
Figure 6: LabVIEW Auto-tuner subVI
The block diagram in Figure 6 shows the subVI that was created for auto-tuning the frequency
outputs to a particular octave. The desired octave was user-defined, which corresponds to a base
frequency for the desired octave. This frequency was successively multiplied by 2 to create a tenelement array. The normalized input frequency from the theremin VI was checked against this
array using the threshold array operator to output an index rounded to the nearest integer. To get
the auto-tuned frequency, the base frequency was multiplied by 2n, where n is the index integer.
This frequency was then outputted to the main theremin VI.
Conclusion
The optical theremin successfully produced all the engineering requirements with usercontrollable light intensity, amplitude and frequency range, and auto-tuning capabilities. Our
design was limited by the sampling frequency of the NI myDAQ, which affects the continuity of
the output audio signal. Although the optical theremin auto-tunes to specific octaves, it is
possible to auto-tune to specific keys to produce a sound within a smaller frequency range. A
design that would be more user-friendly would be to combine these two approaches to create
octaves of full keys. After multiple design changes, the final solution successfully converts light
into an audio signal that the user can easily control.
Financial Page
Cost of Parts (Quantity)
NI myDAQ (1)
TL074CN (1)
OP906 (2)
Resistors (4)
Total Parts Est. ($)
$175.00
0.62
1.18
0.068
$176.97
Cost of Labor
Est. Labor ($) Engineering rate: $35/hr
Fringe ($) 15% of Est. Labor
Overhead ($) 40% of (Labor + Fringe)
Total Labor Est. ($)
420.00
63.00
193.20
$853.17
Contingency ($) 10% of (Adjusted Parts + Total Labor):
$85.32
Grand Total
$938.49
Download