Optical Theremin

advertisement
Lab 2: Optical Theremin
EE 300W Section 2
Team Hephaestus
10/16/13
ABSTRACT:
Using LabVIEW, a myDAQ, 2 photodiodes, and an op amp IC we created an Optical
Theremin. The photodiodes release a leakage current proportional to the amount of
light they detect. The op amp converts the currents into voltages that can be
measured with the myDAQ. The LabVIEW takes the input signals and generates a
sine wave for the myDAQ’s audio output.
The user controls the volume and pitch of the Theremin by adjusting the intensity of
light that reaches the photodiodes.
INTRODUCTION:
A Theremin is a musical instrument that is played without being in physical contact
with it. It produces a variation of frequencies at different volume levels based on
hand elevations.
Unlike the traditional Theremin with complex hardware, the optical Theremin
designed in this lab contains a simple circuit at the cost of complex software design.
There are 2 physical circuit portions each with only 3 main components; a
photodiode, a resistor, and an operational amplifier. One of the circuits will control
the volume of the Theremin while the other controls the frequencies based on the
amount of light detected by the photodiodes. The user will be able to “play” their
Theremin through adjusting the light seen by the diodes.
THEORY:
The circuitry of our Theremin contains 2 photodiodes, 2 resistors with a 1M value,
and 1 TL074CN operational amplifier from Texas Instruments. The photodiodes act
as current source by releasing a leakage current proportional to the light intensity
seen by the photodiode. The trans-impedance amplifier converts the diode current
into a negative signal voltage, whose magnitude will control either the frequency or
volume of the Theremin.
Figure 1. Photodiode / Op Amp Circuit
INITIAL BLOCK DIAGRAM:
Light
Power
Circuit
myDAQ
myDAQ
Sound
LabVIEW
User
Settings
Front Panel
Display
Figure 2. N=1 Block Diagram
Circuit:
The circuit contains the photodiodes, which act as a current
source, and op-amps, which convert the diodes leakage current
into a voltage.
myDAQ:
The myDAQ block on the left reads the output voltages of the
op-amps and generates a sine wave.
LabVIEW:
Light intensity level, range of frequencies, pitch, and volume
are controlled in LabVIEW. Normalized waveforms that control
pitch and volume and numeric indicators of the light intensity
is displayed on the front panel.
myDAQ:
The myDAQ block on the right takes the settings from
LabVIEW and outputs sound through the 3.5mm TRS
connector.
IMPLEMENTATION:
The physical circuit for the Optical Theremin was built on a breadboard using
photodiodes, resistors, an op amp, and jumper wires. The 2 photodiodes were
separated on opposite ends of the board so that the amount of light detected by each
could be different. The myDAQ’s AGND pin was used as the ground for the circuits
and the +15V and -15V were used to power the op amp. The AI0+ and AI1+ pins
were used to measure the op amp outputs for frequency and amplitude respectively.
The only design modifications we made in our physical circuit were the resistor size
to use. We tested resistors from 500k to 2M and decided to use a 1M resistor.
Figure 3a. Physical layout of circuit
TL074CN
Figure 3b. Multisim layout of circuit
In the LabVIEW VI, the myDAQ Assistant block reads the values measured by the
myDAQ AI0+ and AI1+ pins and then split into to separate signals. The average of
each signal is normalized and is able to be scaled individually based on the user
settings selected on the front panel. One of the user settings allows for the optional
auto tuning of the frequency by passing the signal through a true or false block. Auto
tune will adjust the frequency up or down to achieve a certain note in a specified
octave. A sine wave is generated from each signal using the simulate signal function
and passed to another myDAQ Assistant block where sound will output through the
myDAQ’s 3.5mm audio out port. Initially, there was clicking sound in the output. To
fix this problem we increased the sampling rate and the rate at which samples are
written. In our first attempt to create an auto tune feature, we tried to design our
system so that the frequency would adjust to a certain note in various octaves. This
design became very complex. We changed our design so that the frequency would
be auto tuned to a certain pitch in a selected octave.
In the DAQ Assistant block for the voltage input signals we set an Acquisition Mode
of N Samples with 2000 samples to read at 200kHz. The signal input range was set
at a max of 0V and a min of -10V. In the DAQ Assistant block for the audio output
signal we set an Acquisition mode of continuous samples with 8000 samples to
write at 80kHz. The signal output range was set from -1V to 1V. We observed that
the increased rate of sampling reduced the amount of clicking heard in the output.
BLOCK DIAGRAM ANALYSIS:
Figure 4a. LabVIEW Main VI
The main VI, seen in Figure 3a, uses a while loop to continuously read the input
signals from the myDAQ. These signals are then split between frequency and
volume, then averaged and converted to positive signals. These unaltered values are
displayed on the front panel to allow the user to adjust the maximum values to the
light intensity of the room. After normalizing these two signals, they are sent to the
signal builder, and then the signal builder outputs the audio waveform to the
myDAQ audio output block.
Figure 4b. Normalized Amplitude VI
The normalized amplitude block, Figure 3b, takes the user controlled maximum and
minimum volume values and the gain from the volume photodiode and normalizes
the signal to a value between 0 and 1 V. These are the values for a speaker signal.
Figure 4c. Normalized Frequency VI
The normalized frequency block, Figure 3c, compares the frequency signal from the
photodiode to the maximum and minimum signal values and adjusts the frequency
to a value either at or between the user specified frequency range.
Figure 4d. Pitch Setting VI
The pitch setting VI, Figure 3d, creates an array of frequency values that will be used
for the auto-tuning feature. The user can also control the number of octaves
(starting from the lowest) that the auto-tuner will use.
Figure 4e. Auto-tuning VI
The Auto-tuning block, Figure 3e, forces the frequency into a selected note in the
nearest octave by comparing it to the discrete values from the pitch setting array.
CONCLUSIONS:
Requirements Met:
 From the front panel, user can set light intensity range to match light in
location of Theremin
 User can independently adjust frequency and amplitude of audio tone based
on light intensity
 From the front panel, user can set range of audio frequencies generated
 Front panel displays normalized waveforms of both frequency and volume as
a function of time
 Front panel displays numeric indicators of the light intensities detected by
both photodiodes
 User can choose to auto-tune Theremin to discrete notes
With all these requirements met, the optical Theremin is complete.
APPENDICES:
Figure 5. LabVIEW Front Panel for Main VI
Using the Front Panel with the Theremin:
1. Start the program and leave the photodiodes open to the full light
2. Observe the unaltered pitch and gain levels, and type them into the
maximum pitch and gain levels, respectively
3. Cover the photodiodes to the lowest desired light level, observe the
unaltered pitch and gain levels, and type those values into the minimum
pitch and gain levels, respectively
Note: Completing steps 2 and 3 will give the user control over
the maximum range of volumes and frequencies, but the user
can change these limits to desired values (such as lowering the
total volume by increasing the Max Volume level control)
4. Adjust the maximum and minimum pitch to desired levels (range of typical
human hearing is from 20Hz to 20kHz)
5. Toggle the autotune button on or off to turn the autotune feature on or off.
6. Cover the left diode to adjust the pitch of the signal and the right diode to
adjust the volume to make music with the Theremin
Table 1. Bill of Materials
Item No.
Description
Quantity Total Price
1
TL074CN Operational Amplifier
1
$2.04
2
Photodiode
2
$1.10
3
2
$0.04
1M Resistor
4
National Instruments myDAQ
1
$175
5
LabVIEW Software (free student version with
1
$0
myDAQ)
6
Breadboard
1
$30
7
Jumper Wires (miscellaneous lengths)
Misc
$0.10
Total Cost………………………………$208.28
Table 2. Cost of Labor
Engineering Labor (3 Engineers)
Fringe
Overhead
Table 3. Gantt Chart
Task
Review Requirements
Design Circuit
Test Circuit
Generate Signal
Build Frequency VI
Build Amplitude VI
Build Auto Tune VI
Week 1
16 hrs/person at $35/hr
$1,680
15% of Labor
$252
40% of Labor + Fringe
$772.8
Total Cost…………………$2,704.8
Week 2
Week 3
Week 4
Week 5
Download