CDR_004_RIG_2014-10-21

advertisement
Lab#2: Photo Theremin Design
EE300W
Section 004
Team RIG
Abdulla AlHashmi
Huake Li
Bruno Perles
1
Table of Contents
Abstract....................................................................................................................................... 3
Introduction................................................................................................................................. 3
Rationale...................................................................................................................................... 3
Implementation........................................................................................................................... 5
Part 1: ......................................................................................................................................... 5
Part 2: ......................................................................................................................................... 8
Conclusion .................................................................................................................................. 9
Appendices ................................................................................................................................. 10
2
Abstract
A theremin was created using photodiodes and LabVIEW. A human user can control the
pitch and volume of an audio wave from 20Hz to 20kHz. The user can adjust the intensity range
seen by each photodiode, and set the range of audible tones. A myDAQ outputs an audio wave,
created by a LabVIEW program. Additionally, the output waveform could be displayed on
LabVIEW front panel in order to demonstrate.
Introduction
Professor Leon Theremin created the “ theremin”; the first electronic musical instrument,
where the amplitude and frequency were varied when the user hovered their hands over the two
antennas. The objective in this lab is to create an optical theremin that replaces the antennas with
a photodiode. It is controlled by varying the intensity of light around the photodiode, which
produces a current.
The design interface requirements with NI myDAQ and LabVIEW include the ability to
generate a sinusoidal audio signal from the myDAQ. The circuit is able to adjust the amplitude
and frequency maximum or minimum value of the audio signal through LabVIEW’s front panel
window. Additional the project requirements include having an adjustable maximum and
minimum light intensity level for each detector, a front panel, user-adjustable range of
frequencies that the Theremin produces, the front panel displays for the normalized pitch
waveform as a function of time, and the normalized volume waveform as a function of time.
For the second part of this lab, one has to create an auto-tune feature for the optical
Theremin that will tune a specific pitch to a tone in the equal-tempered scale. This auto-tune
feature can be turned on or off by the user on the LabVIEW front panel. Auto-tuning is the
process of taking raw frequency data, and rounding it to the nearest musical note.
Rationale
To produce the optical theremin we were given certain requirements, so based on these
requirements we established the following initial block diagram Fig.1.
Fig.1 Initial Block Diagram
3
Later on the process of executing the LabVIEW code we made some changes to our block
diagram as seen below in Fig.2.
Fig.2 Final High Level Block Diagram
The inputs provided to the optical theremin are two varying light levels and the output is
a sound wave produced by the myDAQ. Since photodiodes utilize light to produce current and
the myDAQ can only read voltages; an op amp in transimpedance configuration with a 1
MΩ resistor in the feedback loop converts the current source into a voltage ranging from 0V to
5V which is sufficient for the myDAQ to read. The myDAQ samples the two signals,
manipulates them and sends them into a sine wave generator. The sine wave is sent to the audio
out port on the myDAQ, where speakers can play the audio tone.
The signal processing subsystem is processed by the myDAQ. The national Instruments myDAQ
cooperates with Labview virtual instruments circuit to sample and encode multiple signal
simulations. This subsystem uses high-low frequency noise average filter to replace analog light
to digital signal.
The front panel is designed as graphical user interface for controlling the optical
theremin. It could be cut off into two parts, input and output. For input graphical user interface
part, users are able to input the maximum or minimum value for both amplitude and frequency.
In order to avoid non-ideal light condition, the graphical user interface could set up maximum or
minimum value for light intensity. For output front panel part, it has functionality to display
amplitude and frequency signal. Additionally, waveform diagram is displayed on front panel for
testing.
4
Implementation
1. Part 1
For time-varying current resource provider, OP 906 could be modeled as small resource
signal. By testing the current provided by OP 906, it should be measured in an amplifier circuit
because the current produced by OP 906 is too tiny to indirectly measure current. As a result, OP
906 connected with a 1Mohm resistance and a TL074 op-amp as below figure shows as like. The
current produced by OP 906 should be measured by testing voltage between 1 Mohm resistance
and dividing by resistance. From initial testing, under daylight without any light provider, the
photodiodes output around 75 nA. Under iPhone flashlight, the photodiodes output around 1.5
uA. Our initial multisim calculations required a 1.5 Mohm resistor, however after testing, the
output voltage signal magnitude was above 2V under flashlight provider.
Fig.3 Physical photodiode circuit with amplifiers diagram
To utilize MyDAQ and LABVIEW well, sub VI’s were used for amplitude and frequency. The
first DAQ Assistant has a voltage input which feeds into a split signals block. From there the
input runs into two dynamic data type blocks where the inputs are then averaged. Then, we
designed an equation that converts the signals into binary 0 or 1 because otherwise the Simulate
Signal block will not accept the inputs. The Simulate Signal block will simulate the amplitude
and frequency to then be passed on to the output DAQ Assistant which will output the audio
signal to the speakers. With this code, both amplitude and frequency of the audio signal can vary
by increasing and decreasing the light intensity experienced by the photodiodes.
(Pictures provided in Appendices)
The myDAQ Assistant parameters are shown in the screen shot below:
5
Fig.4 myDAQ Assistant input parameters
6
Fig.5 myDAQ Assistant output parameters
7
Below is the front panel before adding the AutoTune code. Frequency and amplitude controls are
shown and graphical presentations of the input signals and output signals.
Fig.6 Front Panel part 2
2. Part 2
The first part of implementing the autotuning feature is to create a lookup array that has every
valid frequency that can be outputted as a sine wave. These frequencies correspond to 11 octaves
each of the 12 half-step notes on the musical scale. The AutoTune sub-VI first creates 1D array
and populates the first 12 elements with the base frequencies of each half-step note in an octave.
Then, for each half-step note, each successive octave is twice the former. The sub-VI populates
8
each octave in the 1D array and then moves to the next half-step note. This is repeated until all
half-step values are populated in the lookup array. This sub-VI then outputs the array as a
constant for the main VI to use for autotuning. It takes in the scalar frequency and looks for the
closest frequency in the lookup array. If the input scalar frequency is between two frequencies in
the lookup table, it chooses the upper frequency. The sub-VI then outputs the autotuned
frequency to the main VI.
The figure below is the front panel after adding the AutoTune, where a toggle switch was added
to turn on and off the autotuning.
Fig.7 Front Panel part 2 (AutoTune)
Conclusion
After four weeks designing and implement, the combination of two photodiodes, a
myDAQ, and LabVIEW, we were successful in creating an optical theremin. It generated a usercontrolled audio tone, allowed the user to adjust the frequency and amplitude of the audio tone,
set the range of audio tones generated, and configures the intensity range the sensors measured.
9
The output frequency, amplitude and waveform could be displayed on front panel. RIG group’s
optical theremin fully satisfied both customer and engineer requirements. Overall optical
theremin circuit design was a good experience. All group members of RIG, gained valuable
knowledge on the potential working uses of LabVIEW and the engineering design process.
Appendix
1.
Gantt Chart
Task
Week 1
Week2
Week3
Week4
Week5
Block Diagram
Implementation of Detector Circuit
LabVIEW VI Frequency
LabVIEW VI Amplitude
LabVIEW Front Panel
Bill of Material
Design Review Document
Demonstrate
2.
Bill of Materials
Description
Quantity
Per Price($)
Total Price
TL074 OP AMP
3
2.04
6.12
1M ohm Resistor
2
0.02
0.04
Photodiode
2
0.55
1.1
myDAQ
1
175
175
Breadboard
1
40
40
Labor Cost
11
35*3
1155
Total Cost:
1377.26
3. LabView Part 1
Fig.8 Amplitude VI
10
Fig.9 Frequency VI
Fig.10 Main VI Part 1
4. LabView Part 2 (AutoTune)
Fig.11 Marker VI
11
Fig.12 AutoTune VI
Fig.13 Main VI Part 2
12
Download