Jabberwocky CDR 9Mar14

17
1 LAB 2- OPTICAL THEREMIN DESIGN REVIEW DOCUMENT EE 300W SECTION 004 TEAM JABBERWOCKY 7 th March, 2014

Transcript of Jabberwocky CDR 9Mar14

Page 1: Jabberwocky CDR 9Mar14

1

LAB 2- OPTICAL THEREMIN DESIGN REVIEW DOCUMENT

EE 300W SECTION 004

TEAM JABBERWOCKY

7th March, 2014

Page 2: Jabberwocky CDR 9Mar14

2

Abstract:

An optical, labVIEW-based Theremin was designed and tested according to the criteria listed in the assignment handout. The frequency and amplitude of the Theremin are controlled using two photodiodes and op amps set up as transimpedance amplifiers. The voltage outputs from the transimpedance amplifiers are read by a myDAQ and sent to a labVIEW VI for further processing. In labVIEW, the voltage inputs are mapped to an intensity range, then frequency and amplitude ranges set by the user. The calculated frequencies and amplitudes are then used to produce a continuous sine tone that is available through the audio output on the myDAQ. The minimum and maximum light intensities, frequencies, and amplitudes can be adjusted on the Theremin VI front panel. The Theremin also features an auto tune feature that rounds the frequency output to the nearest semitone. This feature, and the key it plays in, can be controlled from the front panel.

Page 3: Jabberwocky CDR 9Mar14

3

Introduction:

The objective for this project was to design an optical Theremin using breadboard circuitry and

signal processing abilities of Labview. An optical Theremin is a musical instrument that is played

without physically touching it. An actual Theremin uses antennas or oscillators to sense a

person’s hand movement. We will instead use photodiodes to detect the change in light

intensity as a result of hand movement. The circuitry involves using a transimpedance

operational amplifier, two photodiodes as light detectors (one photodiode for controlling

frequency and the other for amplitude) and a 1.3 MΩ resistor. The op amp that acts as a

current to voltage converter has its output fed to the myDAQ that acquires data from the circuit

in order to output an analog audio signal.

The Labview code produces an output signal that varies in frequency and amplitude in

proportion to the incident light intensity on the photodiodes. The front panel is designed to

allow user-select options for controlling the audio tone, light intensity range, frequency and

amplitude. It displays an auto tune feature and a feature that allows user to select the key they

want the Theremin to play.

Rationale:

Page 4: Jabberwocky CDR 9Mar14

4

Since the music notes generated by the Theremin device are based on hand movement, we

need to design a ‘movement sensor’. Using a traditional sensor or RF circuit will be expensive to

achieve this goal. For the purpose of our project, we will utilize a useful property of

photodiodes that they produce leakage current proportional to incident light intensity. We used

two photodiodes to control the amplitude and frequency of the output by detecting the light

intensity variation caused by the hand movement. The light intensity incident on amplitude

photodiode and frequency photodiode will control the volume and pitch of the audio tone

respectively. The leakage current produced by the photodiode is very small (in microamperes).

Therefore, we use transimpedance amplifiers that act as current to voltage converters and

amplify the voltage for both photodiodes so that the myDAQ analog input channels can read

the value.

The transimpedance amplifier has the following governing equation:

V out=−Rfb∗I ¿

The photodiode produces current Iin as a current source and we choose the feedback resistor Rfb

to convert the input current to voltage. Then the output signal is connected to the myDAQ

system as analog input and is input to LabVIEW for further signal processing.

The user sets the voltage ranges for frequency and amplitude on the LabVIEW front panel. Once

LabVIEW receives the inputs, it will map the input to the user-defined range. For the frequency

control signal, LabVIEW will also find the nearest half tone that corresponds to the normalized

input if the auto tune function is enabled. We use the LabVIEW sinusoid wave generator with

the normalized amplitude and frequency input to generate output wave and send to myDAQ

system. Finally, the audio channel of myDAQ system will output the waveform to the speaker.

Page 5: Jabberwocky CDR 9Mar14

5

Implementation:

The external components of the Theremin consist of 2 tranimpedance amplifiers constructed

from TL074CN quad op amp chip, two photodiodes, and two resistors (see appendix A). The

voltage gain of the tranimpedance amplifiers are determined by the feedback resistors. The

output of each amplifier is read by a NI myDAQ and sent to labVIEW for further processing. The

output voltage range of the transimpedance amplifiers are roughly 0 (darkness) to 10.7 V

(photodiode saturation).

Main VI diagram:

The main VI for the theremin consists of a while loop that executes once every 80 seconds.

During each loop iteration, the DAQ assistant acquires 1000 voltage samples from the

transimpedance amplifiers. These samples are then averaged to attenuate noise and improve

accuracy. The average values for each amplifier are then sent to amplitude and frequency sub

VIs, where they are mapped to the amplitude and frequency ranges set by the user. The

calculated amplitude is output directly to the DAQ assistant signal generator, while the

calculated frequency is sent to either an autotune subvi or directly to the DAQ assistant signal

generator, depending on whether the user has enabled auto-tuning. Once the DAQ assistant

signal generator has acquired both values, it generates 8200 samples at 41 kHz, which are then

output to the DAQ assistant output VI. The 8200 samples correspond to the time it takes the

while loop to execute, which prevents the output buffer on the DAQ assistant, set to run

continuously with a buffer size of 12.8k samples, from overflowing or emptying. The DAQ

assistant then makes this continuous output available on the audio output of the myDAQ .

Frequency sub VI:

The frequency sub VI maps the output of one transimpedance amplifier to the frequency range

and light intensities set by the user. The inputs for this sub VI are the minimum frequency,

maximum frequency, minimum light intensity, maximum intensity, and number of discrete

frequency levels the VI can output. First, the minimum and maximum frequencies are mapped

to the maximum and minimum light intensities set by the user. If the measured light intensity is

Page 6: Jabberwocky CDR 9Mar14

6

out of range, the frequency is coerced to the maximum or minimum value. The light intensity

range is then mapped to the frequency range specified by the user, with the number of levels

selected by the user determining how many distinct frequencies the VI will output within this

range.

Amplitude sub VI:

The amplitude sub VI functions in the same manner as the frequency sub VI, mapping the

voltage from the amplitude sensor onto a range specified by the user. The myDAQ audio

channel is limited to a maximum peak output voltage of 2 V, so the amplitude controls on the

front panel were normalized to this value. The output of this VI therefore is a value ranging for

0 to 2, representing the amplitude of the desired sine wave.

Array generate sub VI:

The array generate sub VI creates a 2D array consisting of the first 8 octaves in the scientific

pitch scale, with each row being an octave of 12 semitones. To generate this array, a seed array

consisting of the first octave is multiplied by 2 to create the second octave. The second octave

is then multiplied by 2 to create the third, and so on. The output of this sub VI is then fed into

the auto-tune sub VI.

Auto-tune sub VI:

The auto-tune sub VI, when enabled, takes the output of the frequency sub VI and compares it

to the array generated by the array generate sub VI. To accomplish this, the generated octave

array is converted to a 1D array, then the interpolate function is used to find the fractional

index corresponding with the input frequency. This fractional index is rounded to the nearest

whole index and the frequency in the array corresponding with that index is then output to the

signal generator. A feature was added that was intended to allow the user to select which key

the Theremin plays in by applying a shift to the index returned by the interpolate function,

meaning that the entire octave array would be shifted depending on the selected key. While

this worked, it did not allow the Theremin to be played in a different key, due to a

Page 7: Jabberwocky CDR 9Mar14

7

misunderstanding of what the musical concept of “key” actually meant, which is not a simple

shifting of frequencies, as our group took it to be.

Value Statement:

We were able to adapt a complex instrument design into a rather simpler realization of the

Theremin using LabVIEW programming and myDAQ, breadboard circuitry and readily available

electrical components.

Our project was consciously developed based on a systematic design phase process as a route

to problem solving. Scrutinizing project design phases and team dynamics over the span of the

project was an essential exercise that we learnt from in preparation for our 403W project. The

most important lesson was that a team of diverse personalities and skills can perform to the

fullest if they can learn to bring out the best of each other’s competencies in harmony.

Therefore, the hours and resources allocated to this design project were worth the teamwork/

collaboration skills learnt and increased LabVIEW experience gained.

Conclusion:

With the use of a methodical design process, we were successfully able to create an optical

Theremin consisting of a detector circuit and signal acquisition and processing capabilities of

LabVIEW and myDAQ. In addition to being a fairly simple design, an added advantage of

LabVIEW involvement is the ease of improving, adding and removing the various features of the

Theremin. In conclusion, the technical skills and art of well-balanced communication among

team members will be beneficial for the success of any future project.

Page 8: Jabberwocky CDR 9Mar14

8

Appendices:

Appendix A- Gantt Chart

Task NameTime

week 1 week 2 week 3 week 4 week 5Initial block diagramCircuit Design Initial circuit design Final circuit designLabview Design Build sub Vis for frequency and amplitude Main VI Auto tune feature Key-select functionImplementation and testing

Page 9: Jabberwocky CDR 9Mar14

9

Appendix B-Bill of Materials

Bill of Materials

Item Amount Price

NI MyDAQ 1 $200

TL 074CN 1 $0.60

1.3Mohm resistor 2 $0.20

OP906 photodiode 2 $1.10

Total Parts Est. $202

Cost of Labor 23 hrs. $25/hr.

Sub Total $575

Total $777

Appendix C-Block Diagram

Page 10: Jabberwocky CDR 9Mar14

10

Appendix D- Schematic

Page 11: Jabberwocky CDR 9Mar14

11

Appendix E- LabVIEW Screen Captures

Page 12: Jabberwocky CDR 9Mar14

12

Page 13: Jabberwocky CDR 9Mar14

13

Page 14: Jabberwocky CDR 9Mar14

14