Lab 2 Report of TeamAte

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Optical Theremin Design

Team Ate
March 6, 2014
Electrical Engineering Department
Penn State University

Submitted to
Professor Timothy F. Wheeler
Electrical Engineering Department
Penn State University

Abstract
The purpose of this document is to introduce an optical theremin, a musical instrument with the ability to
be played by varying the light intensity to photodiodes in combination with LabVIEW programs instead
of antennas and oscillators. The required equipment includes LabVIEW program, MyDAQ, two
photodiodes, two 15 M resistors, OP Amps TL074ACN, wires and a breadboard. Two photodiodes are
used to provide leakage current proportional to the light intensity. Using the TL074ACN and the
transimpedance amplifier circuit, the current signal is converted to a voltage signal, which will be
collected by the MyDAQ. Through the LabVIEW code we built, users can control the volume, frequency,
tone and the type of clipping of the notes.
Introduction
A theremin is a kind of electronic musical instrument controlled by the performer without physical
contact. Since its invention in 1928, the theremin is widely used in the production of movie soundtracks,
concert music and popular music genres. Early theremins consisted of two metal antennas that use the
performer's hands as a grounded plate of a variable capacitor in an LC circuit to control the frequency and
the volume of the output sound. Since a metal antenna is highly affected by the electrical field nearby, this
project replaces the metal antenna with photodiodes and lets the LabVIEW program analyze the data and
generate the audio. This new design simplifies the design of the former theremin device while reducing
static with the exclusion of antennas and oscillators.
Rationale
Team Ate has designed LabVIEW code that converts the analog voltage outputted by a transimpedance
amplifier into a digital value representing either frequency or amplitude of a sinusoidal wave. In
correspondence with this code we have designed a circuit that utilizes the leakage current emitted from
two photodiodes in correlation with an operational amplifier to form two voltage signals. These signals
will be the input that is filtered through our LabVIEW code. Using the output voltage from the circuit,
multiple sub VIs, user controlled values and signal generating functions, we were able to scale the inputs
to the necessary range of frequency and voltage needed for our desired output wave. Along with this, we
were able to create an Auto-tune and Tone Tune switch option. When activated the auto-tune only allows
the output to read a certain pre-defined set of frequencies. This makes it so there is a defined and audible
step differentiating each frequency, or note, in the set. The Tone Tune feature allows you to choose
between a number of musical octaves in which you want your sound to appear.
Implementation
The conversion from the current given from the OP906 photodiodes into voltages going into the MyDAQ
was done on the circuit board. To convert the currents to voltages we used a trans-impedance amplifier as
seen in Figure 1.1 (page 3). The operational amplifier used in the circuit is a TL074. It was decided we
would use this op amp because its low harmonic distortion and low noise make the TL07x series ideally
suited for audio preamplifier applications based on the TI specifications sheet. The auto-calibration of
ambient light, tone tuning, creating the signal and clipping was fabricated in LabVIEW. The DAQ
assistant read input values. We auto-calibrated the ambient light by taking and storing the double array
values when the photodiode was receiving no light and max ambient light by using feedback nodes and
the select function as seen in SC4 (page 6). Using these maximum and minimum values we can scale any
future values to a percentage and scale these values to a voltage range we desire for amplitude and

frequency (-2 to 2 V and 20 Hz to 23 kHz). The frequency was then tone tuned using the threshold 1D
array function to choose a fractional index for each the chosen tones as seen in SC6 (page 7). The input
frequency would then be compared to each tone and be coerced to the closest tone. For example, if the
input frequency was 18 kHz and the scale was C, the frequency would be coerced to 16.744 kHz or C10.
Creating the signal was done by using the simulate signal function as seen in SC8 (page 8). By connecting
the frequency and amplitude to its corresponding inputs and setting offset and phase to zero we were able
to output a sine wave with a range of -2 2 V and a frequency of 20 Hz 23 kHz. Hard clipping was
accomplished by using the coerce function to coerce the amplitude to the chosen clipping value (.6 - 1.8
V) when the amplitude is above the clipping voltage. Soft clipping used the same approach as hard
clipping with the addition of adding the coerced value to the soft clipped percentage of the inputted
amplitude subtracted by the coerced value as seen in SC11 (page 10). Finally, we have to convert the data
type from a double array type to a dynamic data type so that the DAQ assistant can read the values and
output it to the audio jack on the MyDAQ.
Conclusion
Our approach to the problem of using photodiodes to act as the amplitude and frequency controls of a
sound wave and mimic a theremin is both compact and efficient design solution. The combination of our
minimized hardware design to limit potential error from environmental factors, along with our LabVIEW
code compacted with sub-VIs and defined functions allows for the least potential for error. Although our
design may be compact, it still allows for extensive user interaction and control over the overall outcome
of their generated sound wave. This design accounts for and exceeds all design requirements presented,
while also providing a unique interface for the user to interact with the program in order to achieve their
exact desired sound.

Lab 2 Deliverables
Bill of Materials
Item

Price per unit

Quantity

Total Cost for Item

TL074 Op-Amp

$3.29

$3.29

OP906 Photodiode

$0.59

$1.18

myDAQ

$179.00

$179.00

Small Bag of Wires

$3.95

$3.95

Circuit Board

$9.99

$9.99

Total Cost

-------------

-------------

$197.41 +tax

Schematic
Our final design schematic, seen in figure 1.1, used 2 transimpedance amplifiers. Our original
calculations told us that we should use a resistor valued around 250 k, but during testing we found that
we needed a much higher resistor value, 15 M, to make the circuit output a voltage in the desired range,
between 0 and 10 volts.

Figure 1.1

myDAQ Assistant
For our DAQassist that read the input from the circuit, we decided to use continuous sampling to get the
most fluid sound out of the theremin. The DAQassist takes 500 samples at 10 kHz. All of these setting
match the output DAQassist exactly, allowing them to work in harmony and not have the input
overproduce or underproduce samples for the output to write to the audio port.
While testing our LabView code, we tried many different combinations of sample types, sample amounts,
and frequencies. We found that setting the sample amounts too high leads to the code executing very
slowly and not making a high quality sound. If sample amounts were too low the code executed as
expected, but the output made waveforms that were a series of straight lines in the general shape of a sine
wave, rather than making a smooth sine wave. We originally tried using N-sampling rather than
continuous sampling, but we quickly realized the error when the output resulted in a series of beeps as the
output rather than a continuous note.
Block Diagram
Figure 1.2 shows the block diagram used in the design of the optical theremin. As shown, the theremin
itself can be broken up in to two main components, the circuit and the LabVIEW code. The circuit is a
pair of transimpedance amplifiers, while the code is more complex. The LabVIEW code has many
different portions as seen in figure 1.2. Breaking the theremin down into these 5 small tasks helped us to
set short-term goals while making sure that we meet all of the requirements for each of the 3 parts of lab
2.

Figure 1.2

LabView Screen Captures


sc1 - Front Panel

sc2 - Main VI

sc3 - DAQassist input

sc4 - Max and Min subVI

sc5 - Note Generation subVI


7

sc6 - AutoTune subVI (Trues)

sc7 - AutoTune subVI (Falses)

sc8 - Simulate Signal

sc9 - Clipping subVI (None)

sc10 - Clipping subVI (Hard)

sc11 - Clipping subVI (Soft)

10

sc12 - DAQassist Output

11

You might also like