Final Project Report E3990 Electronic Circuits Design Lab Wii-Lock Magic Wand Remote Unlocking Device MacArthur Daughtery Brook Getachew David Kohn Joseph Wang Submitted in partial fulfillment of the requirements for the Bachelors of Science Degree December 17, 2007 Department of Electrical Engineering Columbia University
Executive Summary The concept for the Wii Lock began with the discussion of a magic wand which would allow homeowners to control all functions of a house with intuitive movements and minimal physical exertion. The Wii Lock project emerged from this concept, with our primary goal being to prove the feasibility of the device in a single application, and its possible application to more complicated tasks. The project involved the conception and construction of a signature controlled lock capable of reading and comparing motion from a remote device. This project both served as proof of concept and provided the basic building block of a magic wand controlled house system. The project resulted in a device that, while not quite complete, represents a major step along the path to the ultimate goal. The finished product is able to recognize sharp motions, and match two signature movements (provided the signatures contain abrupt motions). Although the final result does not perform quite as hoped for, it still represents major progress towards the ultimate goal, both in what has been accomplished and in the rejection of alternative unfeasible methods. Given more time, it is highly probable that adjustments could be made to achieve our initially conceived objective.
System Block Diagram
Design Work Accelerometer (David) Our accelerometer takes an input of 3V DC and provides up to three axes of independent DC voltage outputs. Each output varies by about 500mV, depending on whether the accelerometer is waved forward or backward. We can manipulate both the range and offset of these outputs using op-amps as buffers and amplifiers. In our case, the accelerometer itself outputs a range of 1.8-2.5V, and then the signal is sent through a non-inverting amplifier with a gain of 2 to yield a total output of 3.6-5V. The output current of the buffers is negligible compared to the collector current (approx. 10mA) that runs into this system. We used u741 op-amps since they proved capable of eating the collector current without the output saturating. Vss x y
Sine Wave Generator (David) Our AM carrier signal consists of a 555-timer square wave filtered through a low-pass Sallen-Key filter. The 555 timer was wired in astable mode, using component values of 13nf, 1kΩ and 22kΩ for C, Ra and Rb respectively. The output is then sent to the filter shown below. The op-amps are run on the same voltage as the 555-timer. The first op-amp rides the square wave at a DC level of half the supply voltage so that when the lowest voltage is greater than ground (the negative power terminal supply). The second op-amp is a second order low-pass filter at a cutoff frequency equal to our carrier frequency. Values of 220kΩ, 11kΩ and 11kΩ were used for Rb, R1 and R2 respectively. Values of 13nF, 5nF, and 15nF were used for Cin, C1 and C2 respectively. To get the signal down to it s proper size, we attached a potentiometer to the output and turned the knob until we achieved the lowest possible sine wave.
AM Modulator (David) The output of the accelerometer (voltage source on bottom right) varies the amplitude of our carrier signal (voltage source on left), as an AM modulator would. The carrier is a high frequency, therefore the circuit functions as a common emitter amplifier. The gate and collector voltage are pinned, with very slight fluctuations caused by the accelerometer. The accelerometer manipulates the current pulled across the transistor, Ic, thus changing the gain of the common emitter amplifier. The ideal output V can be seen below:
The output is relatively linear. In real life the carrier frequency is not a perfect sine wave but rather a low-pass filtered square wave, so some non-linear effects are introduced to our output when the transistor amplifies the signal. A larger carrier signal also creates undesired non-linear effects, but we cannot reduce our signal past 100mV without losing its general form. As for our output, we can manipulate the amplitude by changing the load resistance. This amplitude will be determined by the specific needs of our FM transmitter input. Generally, the larger the load resister, the stronger a signal we transmit (but we still have to take the input parameters for our FM transmitter into account when picking this value). We use a second modulator to send the second signal, but we only need one carrier signal to input into both since our FM transmitter can send a single stereo signal comprising two separable signals at the same frequency. FM Transmitter (Brook) AM signal is passed through an FM transmitter which was built using FM transmitter kit. The kit was originally made for a wireless microphone which amplifies the sound input and modulates the frequency relative to the input using a frequency oscillator and finally transmits an amplified radio frequency through an antenna. The following block diagram shows the proposed circuit for our signal transmission. Amplified AM Signal Frequency Oscillator Radio Frequency Amplifier Antenna
To fit our needs, we modified the kit to have our AM signal passed through the audio input amplifier instead of the microphone output which. The amplifier is 2N3904 transistor which gives us a gain of 3 for our signal then this is sent to the input of the radio frequency oscillator. A 2N3904 transistor is used as oscillator where an inductor is used as the frequency tuner. By changing the position of the iron core in our inductor, we can vary inductance value thus changing the radio frequency of the transmitter. After tedious scanning of various frequencies, we found 89.40 to have less interference from other sources. We then used a signal created by wave generator to pass through the microphone input and when the frequency of our signal was in the audible range we were able to hear the transmitted wave on the radio. The signal received by the radio sounded stronger depending on the type of signal; with square waves of a certain frequency being more audible than triangular or sine waves of the same frequency. The radio frequency amplifier also serves as buffer between the oscillating signal and the antenna output. This way any interference or external load at the antenna will not affect the frequency oscillator signal. The antenna is a simple wire where the length can be adjusted for optimal power transmission. The schematic diagram for the transmitter circuit is given below. The part we have modification is instead of the MIC input at J1 and J2, the modulated signal which carries the accelerometer output is passed through. FM Receiver (Brook) The receiver is a simple FM radio tuned to the transmission frequency. The radio demodulates the signal and produce the AM signal. This AM signal is then taken from the radio output and passed into a PC audio input. This input is recorded as.txt file for the detection software to process. Antenna FM Radio AM signal Computer Audio Input
Software Filtering, AM Demodulation, and Matching (Joe) The output of the FM receiver connects to the microphone port of the soundcard on a PC. For ease of implementation, the software stages of the project execute in Matlab. The first step in the software process is reading the signal into memory via the soundcard, which has already been designed; the current setup involves manual activation of the function, which then records data for a predetermined length of time, sampling at 22050 Hz. The signal received by the computer is the AM modulated output of two channels of the accelerometer. The signal is demodulated by first removing negative values (Stage 1), followed by application of a moving average filter and then passed through a Butterworth lowpass filter with a cutoff frequency of 50 Hz (Stage 2). After AM demodulation, the signal is compared in one of two manners: either via correlation of the signal in the time domain or correlation of the signal in the frequency domain. In either of these techniques, the first step is eliminating the segments of the signal where there is no activity of interest (often times the recording starts before and ends after the motion because of the fixed length of recording length). To find the region of interest, the signal until the magnitude of the signal reaches 70% of the largest
magnitude from both the beginning and end is discarded. For comparison in the time domain, a vector of correlations is created (where each position represents a shift between the vectors). The maximum value of the correlation vector is found, and if it exceeds a preset success value, the test is considered successful. For comparison in the frequency domain, the peaks of the spectrums of the two signatures are compared, and if the locations of the peaks of the two spectrums are scaled multiples of each other, one of the samples spectrums is resampled so as to match peaks; after this, the correlation of the two spectrums is computed, and if this value is greater than a preset success value, the two signals are considered a match. This entire process is packaged in a graphical user interface to ease testing and use of the system. The interface first asks for a name or initials in order to attempt to find a reference signal if one has already been created. If no reference signal is stored under the given name, the system asks the user to create a new reference signal, and then automatically forwards the user to the main user interface. If a reference signal is found, the user is automatically forwarded to the main program. In the main graphical interface, the user is able to either attempt to match the reference signal or create a new signal.
Magic Wand case abandoned This is the casing for our accelerometer, modulators, and transmitter. We will assemble our design on breadboards and perhaps keeps the necessary voltage in a battery pack wearable on one s hip. Battery Pack abandoned Until we can shield the modulator, it is unfeasible to run our entire from a single battery pack. Also, we are transmitting our signal on a second harmonic, the power requirements exceed the capacity of a simple battery pack. Safety Issues Our device introduces no environmental or health hazards. The only safety concern with the current design is that broadcasting a signal via FM waves may infringe on FCC regulation if the signal power is too strong. In a similar vein, if the signal travels too far, the wand could potentially unlock someone else s lock should two people have the same signature (the likelihood of this occurring is entirely dependant on the level of precision the transmitter broadcasts and the margin of error the software allows).
Gantt Chart Sept Oct Nov Dec Brainstorming Group Formation Purchasing Accelerometer Testing Software Feasability Tested Accelerometer Performance Design Accelerometer Outputs Wire together accelerometer Finish AM Modulator Design Wire together AM Modulators Assembly of FM Transmitter Combine AM modulator with FM transmission Design Software Demodulator Design Signal Filter Design Recognition Software Wire together all electronics Troubleshooting 1-10 1-10 1-10 11-21 22-31 1-5 6-10 11-15 16-20 21-25 26-30 1-5 6-10 Historical Notes We considered transmitting our DC accelerometer output via a VCO, but could not achieve a wide enough range of frequency. The idea was quickly abandoned. The concept itself, given the appropriate VCO, might be much more feasible, and perhaps even preferable. We would also consider using a Gilbert Cell as a voltage controlled current source to regulate our modulator. We have been reluctant to try this, though we have not yet ruled out its potential necessity. In retrospect, the AM modulator adds a lot of noise to our system, and either this alternative or the VCO might reduce the noise. At first we considered using two AM transmitters set at different frequencies and sent through a single FM transmitter, but in the end we were able to accomplish an FM stereo signal without using different frequencies for the AM signals, which saved us a lot of trouble designing extra sine-wave generators. Also, the FM transmitter operates at a frequency of 44MHz, so although we can pick up the second harmonic (88MHz) on our FM radio, we are wasting a lot of extra power on our transmitter. We could really use a better FM transmitter.
Our FM transmitter also introduces considerable noise to our modulator circuit, so much so that we really can t recognize the waveform anymore on our oscilloscope.