* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Designing an Optical Theremin
Alternating current wikipedia , lookup
Public address system wikipedia , lookup
Sound reinforcement system wikipedia , lookup
Power inverter wikipedia , lookup
Mains electricity wikipedia , lookup
Ground loop (electricity) wikipedia , lookup
Utility frequency wikipedia , lookup
Buck converter wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Spectral density wikipedia , lookup
Chirp spectrum wikipedia , lookup
Power electronics wikipedia , lookup
Dynamic range compression wikipedia , lookup
Pulse-width modulation wikipedia , lookup
Oscilloscope history wikipedia , lookup
Analog-to-digital converter wikipedia , lookup
Wien bridge oscillator wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Designing an Optical Theremin EE 300W Lab2 Section 002 (Team Vee) Fei Bu, Zakkere McCartney, Matt Baranoski March, 7, 2014 Abstract The Theremin allows a user to play music without physically touching the instrument. Most Theremin’s use antennas to measure the distance from the players hand to the instrument which controls the frequency and gain of the sound played. Our design will be an optical Theremin which is controlled by how much light is exposed to two photodiodes. A typical Theremin uses hardware to condition the inputs and generate an output but our Theremin will use a simple physical circuit and extensive LabView code to generate the sound. Our design is two parts; the simple physical circuit and the more complex virtual LabView circuit. The physical circuit consists of two photodiodes which generate a current based on the amount of light they are exposed to. We will use a current to voltage op-amp circuit to generate voltage that the MyDAQ can sample. The MyDAQ functions as the bridge between our physical and virtual circuits. The virtual circuit samples the voltage waveforms from the physical circuit and uses them to control the amplitude and frequency of an audio waveform that becomes our output. Both signals are conditioned and scaled with user defined limits as well as an auto-tune feature with optional key select. Introduction The optical Theremin we designed needed to use the amount of light exposed to two photodiodes to control the amplitude or gain as well as the frequency of an output audio signal. Our design will include a physical circuit that transforms the current generated by the photodiodes to a voltage the myDAQ can read and sample. The myDAQ will sample the voltage from the physical circuit and then provide that to the virtual circuit as an input. The virtual circuit will be multipurpose; it will need to sample the signal from the myDAQ, condition that signal to remove noise, scale and coerce the signal based on user inputs, rescale the frequency output to a user defined range, auto-tune the frequency, provide a key select feature, generate a wave based on the conditioned frequency and amplitude signals and output that wave to the myDAQ where it can be played through speakers. The complex virtual circuit allows us to make the circuit much more complex and offer the user many more features to choose from while playing. Rationale The optical Theremin design we created uses a simple physical circuit to gather the input and make it readable for a more complex virtual circuit. A photodiode (P/N 365-1084-ND) is used to sense the light intensity which is our input and will directly control the frequency and amplitude of the sound played. The photodiode generates a current that corresponds to the light intensity exposed to it. We will use an op-amp current to voltage converter to transform the current produced by the photodiode to voltage signals that the myDAQ can read. We will use the TL074 Op-Amp in the configuration pictured below to convert the current to voltage. Op-Amp schematic and equations: Ie = RL Ie being the output current in photodiode, L being the optical power. Ua = -IR Ua is the output voltage of Op-Amp. The myDAQ will read the voltage from the physical circuit and provide a digitized signal to the virtual circuit. Our LabView code will condition the signals and use them to create an audio signal. The input signals will both be scaled to limits the user defines on the front panel and it will be coerced to a value between zero and one. This value corresponds to the output that will create the audio signal. At this point the amplitude can be used to control the amplitude of the output audio signal. The frequency signal will be scaled again based on limits the user defines for the output audio signal. We will also auto-tune the frequency signal to ensure it corresponds to a musical note. The tuned and conditioned frequency will control the frequency of the audio output. We will generate the audio signal using a wave generation vi and output it to the my DAQ where it can be played. Implementation The physical circuit is built by TL074 Op-Amp chip and two photodiodes (P/N 365-1084-ND). The Op-Amp chip is to convert the current through photodiodes to voltage that inputs into My-DAQ. Two outputs of Op-Amp chip is connected to Analog I/O ports 0+ and 1+ on My-DAQ. One side of audio wire is plugged into My-DAQ Audio port and the other is plugged into the speaker. Circuit Schematic: I Physical Circuit Schematic Amplitude and frequency sampling data are separated and processed in LABVIEW to generate the tune. We used a DAQ assistant vi to sample the input signal from the myDAQ and create a waveform we can condition in the virtual circuit. The signals were unbundled and filtered to remove noise using the mean function. This turned our input array into a variable which is much easier for us to condition. For amplitude, we unbundled the data from the user controlled slider and used that to scale the input signal. We used the In Range and Coerce function to scale the output of amplitude from 0 to 1. For frequency, we have to scale both input and output frequency limits. The input frequency limit is scaled from 0 to 1. The output frequency limit is scaled from 0 to 20k Hz. The scaled frequency can be written directly to the wave generator now but if the user wishes to use the auto-tune feature we must tune the signal. Our auto-tune feature builds a two dimensional array of the music notes and octaves we were supplied. The array is transposed into a one dimensional array which we compare our signal to using the thresholding vi. From this we can output the note our signal is closest to and control the frequency of the audio wave using it. The audio wave is generated with a sine wave generator vi. We use our conditioned amplitude and frequency signals as inputs to the vi. The output waveform is read by the myDAQ using a DAQ assistant vi which generates the wave on the audio out port. Our design also includes a key select feature the user can choose to use. The user selects the key they would like to play in and the key select vi picks out the corresponding notes from the two dimensional array of all possible notes and removes the rest. Our frequency signal is then auto-tuned to only the notes in that key. To generate a consistent audio signal we had to tune the sampling rates of each of the DAQ assistant vi’s and the wave generation vi. We based most of our settings off the Nyquist sampling theorem and made sure our sampling rate was at least twice that of the number of samples to write in a second. The settings we found to work best are listed in the table below. Frequency Settings in LABVIEW: LABVIEW Module DAQ Input Simulate Signal Value Samples to read Sampling rate Sine Timing DAQ Output Mode Samples to write Sampling rate Frequency Amplitude Samples per second Number of samples 10 200k Hz 5 Hz 1V 80,000 Hz 20,000 Hz Continuous Samples 20k Hz 80k Hz Block Diagram Analysis: The input to the system is the light that is exposed to the photodiodes. Our system uses this input to output an audible audio signal. The light exposed to the photodiode is translated into a voltage reading that can be sampled by the MyDaq. We will use the MyDaq device as our data acquisition device and convert the analog input voltage signal to a digital signal. The LabView code will scale and coerce the input signal based on user defined limits. The user will have the option to turn on an auto-tune function that will tune the frequency to one of the musical pitches. The conditioned signal will be transformed into a sine wave that is generated with controlled frequency and amplitude based on our input signals. We will use the MyDaq to sample the sine wave and output an audio signal. II Block Diagram Modifications: There were three major modifications we made during this project; auto-tune feature, frequency and sampling rates, and reversion of indicator range. Originally, we used a for-loop to build the frequency table, and compare our value to it in order to tune the frequency signal. This design was too complicated and difficult to adjust so we discarded the whole schematic and used the threshold 1D array function. We built a 2D array that contained all 121 notes from the table we were given and used the transpose array function to create a 1D array. Using the “threshold 1D array” function we compared our signal to the array of notes. This generated the index corresponding with the 1D frequency array. Finally, the index is fed into “index array” to output the closest note frequency. Originally, in DAQ Assistant and DAQ Assistant3 module we set the samples to read to 200 and the rate to 2k Hz. In Simulate Signal module we set the frequency to 2k Hz, amplitude to 1 V and the samples per second to 5k Hz (5k Hz > 2*2k Hz). We picked 5k Hz for the sampling frequency because it must be twice the signal frequency according to the Nyquist Sampling Theorem. Under these settings, the tune changed when we moved hands up and down but the sound was discrete beeps and the volume was low. To improve the sound quality we decided that we should minimize the samples to read in DAQ Assistant module to 10 and maximize the rate to 200k, the max rate of the myDAQ. This decreased the number of data points to be processed each second allowing the code to execute faster. In the Simulate Signal module, we set the frequency to 5Hz, samples per second to 80k Hz, and Number of Samples to 20k. In DAQ Assistant3 module, we set the samples to write to 20k, and the rate to 80k. Now the tune is more continuous and the volume is high enough. But the volume change corresponding to light intensity is not sensitive enough. We cannot achieve completely continuous sound because of the 200k Hz maximum limit of My-DAQ sampling rate. The amplitude and frequency limits were reversed at first. When we would move our hand closer to the diode the amplitude of the signals would increase. We reversed how we scaled our values in the main VI so the output decreased as we moved our hand closer to the photodiode. Value Statement: The optical Theremin we designed is unique because it uses a very simple physical circuit and a very complex virtual LabView circuit. Most Theremin’s use a complex physical circuit and little to no software component. Our design makes great use of the inexpensive photodiodes and op-amps that make up the physical circuit but the cost to implement the physical circuit is high. The necessity of the myDAQ and LabView program drive the cost up and make this an expensive design. The Theremin could be implemented much cheaper with more complex physical circuitry and inexpensive components. Conclusion: Through a design and development process, we created a circuit that used the leakage voltage from a photodiode to input a voltage to LabView code. The virtual LabView circuit sampled the output of the physical circuit, conditioned the signals, and used them to generate a single sine wave. The amplitude and frequency of the sine wave would vary based on the two inputs of the photodiodes. We have also designed a circuit that could pick specific keys from a short list of common keys. These keys will auto tune the input to specific frequencies. Through this lab we have proven you can build an optical Theremin with a physical circuit in combination with LabView. Appendicies: Screen Captures: III Fron tPanel of Theremin LabView code IV Block diagram of Theremin LabView code V Auto-Tune feature block diagram VI Key Select block diagram