t i me f ra me f i n a l r e p o rt - mit · 2019. 5. 16. · 6.101 1 . t a b l e o f c o n t e n t...

17
TimeFrame Final Report Ben Rowley and Luis Torres 6.101 1

Upload: others

Post on 09-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

TimeFrame Final Report Ben Rowley and Luis Torres

6.101

1

Page 2: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Table of Contents

Table of Contents 2

Abstract 3

Introduction 4

Project Overview 4 Goals 4

Design 5 Block Diagram 5 Audio Input 6 Beat Filter 7 Frequency Adder 8 Color Signal Generator 10 Magnet Signal Generator 12 Audio Amplifier 14

Implementation 15 Challenges 15

Conclusion 16

2

Page 3: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Abstract This project is based on a commercially available product that takes advantage of the

slow refresh rate of the human eye to create the illusion that an object is moving in slow motion

due to strobe effects. We extended this concept to interact with music in order to provide a

more immersive experience for the user. The overall effect is the rhythmic swaying of a feather

in time with the beat of music, the tempo with which the feather sways changing proportionately

between songs with different tempos. The effect is created through a system composed of

op-amps, mosfets, BJTs, and simple RC components to isolate the beat, add it to a generated

signal, and output a slightly different frequency at which the LED lights flash. This frequency

offset is in time with the beat of the music input into the system.

Introduction

Project Overview

If we move an object under lights that are flashing at a high enough frequency, not only

will the lights will appear to be constantly on, but also our brains will highlight the object during

the intervals in which the lights were actually on. We can take advantage of this effect in order

to highlight specific frames from the movement of an oscillating object.

Using this idea, we can vibrate a lightweight object at a certain frequency and flash it

under a strobe at a slightly different frequency in order to create the illusion that the object is

moving in slow motion. Depending on how much we offset the two frequencies, we can control

the speed at which the object appears to be moving.

3

Page 4: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Goals

Commitment

LED Control: Control the frequency of LED flashing with a potentiometer

Magnet Control: Control the frequency with which the electromagnet switches

polarity with a potentiometer.

A working system that shows the object attached to the small arm moving in slow

motion

Goal

Match the beat of the audio input to the side-to-side sway of the lightweight

object. This will require some signal analysis to extract the beat from the song

and effectively alter the frequency that the LED’s are being flashed in order to

synchronize with the song.

Stretch

Speaker Amplifier: Add an amplifier to drive a speaker in order to listen to the

music that the object is dancing to.

Add colors to the LEDs, so that they change as the music plays.

4

Page 5: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Design

Block Diagram

Figure 1: The Block Diagram of the Circuit

The system is composed of a three main systems, divided by their general purpose

within the system, as shown in Figure 1 by the organization of the smaller modules into rows.

These three modules, the LED module, the electromagnet module, and the speaker module.

These main modules were further divided further based on their behavior and how they

contribute to the overall functionality of the system. These individual modules will be discussed

in detail in the following sections. We chose to follow this general division with the sectors

across our breadboard (see Figure 2).

5

Page 6: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Figure 2. The Completed Circuit. The bottom two breadboards are devoted to the LED

module. The top half of the top breadboard is divided between the speaker module and the

electromagnet module.

6

Page 7: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Audio Input

The first step in analyzing the input signal from the headphone jack is to couple the two

channels (left and right) into one input channel to allow for a stereo input source. There are

some musicians that produce music with different sounds played through different sides of a

speaker setup. One solution to combine the divided inputs with potentially different signals is to

use a resistive divider, like the one used in Figure 3. This signal was then fed into an op-amp

buffer in order to isolate this input voltage splitter from the following audio amplifier.

Figure 3: Converts stereo input to mono audio input

7

Page 8: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Beat Filter

Figure 4: The Beat Filter Module

This portion of the circuit focuses on filtering out any of the higher frequency signals

present in the music while amplifying the lower frequency sounds. The cutoff frequency for the

first low pass filter/gain stage in Figure 4 is Hz. This is to filter 10612 π 15000Ω .0000001 F* * *

=

out any frequencies that are not related to the rhythmic low-frequency bass beats to improve the

beat detection of the filter. The gain applied to the signal is times the 2.961 + 510010000 =

original amplitude to provide some leeway further down the signal processing pipeline. After

this, a half-wave rectifier was used in order to isolate the positive portions of the signal as a

further step towards creating a sine wave at the beat frequency of the input music. This allows

us to use a low pass filter with a very low cutoff frequency to create a signal that resembles a

sine wave that corresponds to the beat of the song. The cutoff frequency of this second low

pass filter is Hz. 3.3912 π 470000Ω .0000001 F* * *

=

The amplitude of the output of this second low pass filter is small (approximately 1 volt

peak to peak) and so we added a separate gain stage in order to minimize any effect from this

gain stage with the very low pass filter. After this gain stage, we use a comparator to create a

square wave from this sine wave, and then low pass the square wave again to get an even

cleaner sine wave. The comparator compares the first sine wave to a reference voltage of

4.23 volts to get reasonably close to a 50% duty cycle. This value was chosen experimentally.

The last low pass filter has a cutoff frequency of Hz. This last 2.3412 π 680000Ω .0000001 F* * *

=

8

Page 9: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

filter and comparator stage was added after deciding that a cleaner sine wave would be the best

input for the frequency adder.

Frequency Adder

Figure 5: The operations of the Frequency Adder

Figure 6: Frequency Adder circuit

9

Page 10: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

In order to generate a signal that has a frequency equal to the sum of two other

frequencies, we needed to multiply the signals in the time domain or equivalently, convolve

them in the frequency domain, a process displayed in Figure 5. We used this analog multiplier

to combine the signals and leave us with a convolved signal at the output of the final op-amp.

The two input op-amp sections are logarithmic circuits. The outputs of these two circuits are the

inputs to an adder circuit and that output is then raised to the exponential power in order to get

the final result as the multiplication of the two signals. The final adder circuit seen in Figure 6

acts to get rid of the carried offsets from the two input signals.

LED Signal Generator

Figure 7: A high-Q band-pass filter to isolate the desired LED frequency from the magnet’s

switching frequency.

After multiplying the signal generated by the beat filter and the magnet signal generator,

we are left with a signal that contains the desired flashing frequency, along with many other

unwanted frequencies. The main challenge in filtering out any unwanted signals is that they are

very close in frequency to our desired signal. In order to manage this, we designed and built a

very high Q band pass filter, shown in Figure 7. We first attenuate the signal using an inverting

amplifier configuration with a gain of . Then, we run the attenuated signal through 0.011 3.3k330k =

our high Q bandpass filter where the desired frequency is amplified and all other frequencies

are filtered out. This filter, originally designed to have a Q factor of approximately 200, had an

experimentally measured Q value of about 300. Finally, we compare this signal to ground in

order to generate a square wave at the same frequency of oscillation to drive the flashing of the

10

Page 11: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

LEDs. Since the gate output needs to be from ground to 15 volts, we rectify the signal and cut

off any negative voltages.

Color Signal Generator

Figure 8: A ring oscillator provides a waveform that can then be low-passed to create a smooth signal to transition between colors.

11

Page 12: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

In order to generate the color fading effect for our project, we used the ring oscillator

shown in Figure 8 composed of 3 RC circuits and 3 MOSFETS with a large oscillatory period

and large time constant. The charging and discharging time constants for each RC circuit is

and respectively. The ring oscillator generates2uF 181.8kΩ .99s 2 * = 3 2uF 180 kΩ .96s 2 * = 3

three square waves that we then low pass to create the voltage at which we will drive each color

on the LED strip. Since we can not source enough current from these nodes, we can only use

them as reference values. We therefore feed each of these signals into an op amp that we can

then use to correctly bias a BJT in order to drive the LEDs.

The anode of the LED strip is connected to 15 volts through a MOSFET which has a

gate that is being driven by the output of the LED Signal generator. Each of the three cathodes

are connected to the collector of a power NPN transistor. This same collector is connected as

positive feedback to the op amp driven by the filtered ring oscillator output in order to supply

enough current to the base of the transistor to maintain the collector at the same voltage as the

output of the ring oscillator.

12

Page 13: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Magnet Signal Generator

Figure 9: The signal generator to control the Electromagnet and to use as the carrier frequency for the musical input’s beat frequency

The magnet signal generator module shown in Figure 9 is responsible for generating the

signal used to control the electromagnet that drives the feather. For our project, configured a

555 timer to have a fixed frequency of oscillation of Hz and a 50% 24.810.693 290000Ω 0.1uF* *

=

duty cycle. The square wave output is then passed to both the color signal generator module

and a low pass filter to generate a sine wave at the same frequency to be used by the frequency

adder module.

13

Page 14: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Electromagnet

Figure 10: The current source used to drive the electromagnet

In order to drive the electromagnet, we use an N-channel Power MOSFET to apply

15 volts across the electromagnet, as shown in Figure 10. The gate of the mosfet is connected

to the square wave output of the magnet signal generator which switches the electromagnet on

and off at a fixed frequency. We added a diode across the electromagnet to maintain a path for

current to flow when the MOSFET is off.

14

Page 15: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Audio Amplifier

Figure 11: The audio amplifier used to drive the external speaker

The audio amplifier shown in Figure 11 was an added stretch goal that enabled us to

visually check and see if the feather was in fact moving with the beat of the input music. This

amplifier works by using a band pass filter tuned with cutoff frequencies of 4.74Hz for the lower

cutoff and 30kHz for the upper. This frequency band is set to encompass all audible ranges for

humans. The output of the amplifier is sent to the biases of the transistors, with the diodes in

series between the two bias pins to significantly decrease the crossover distortion, which then

provide current to drive the speaker at the chosen gain of from the op-amp. 201 + 22000200000 ≃

15

Page 16: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

Implementation

Challenges

Some of the challenges that we encountered from the start included figuring out just how

to isolate the beat from the music input, how to add the really low beat frequency to the

generated magnet oscillation signal, and how to filter the generated strobe frequency. For the

first challenge, we decided to work iteratively by analyzing the output of our filters in order to

figure out the next needed step needed in order to get the best output waveform that we could,

slowly working towards our end goal of a sine wave at the frequency of the music.

The second obstacle was much more challenging. This step involved some research

into the relationship between the frequency and time domains of signals and how you can relate

changes in one to the other. From that point, we realized that we needed an analog multiplier in

order to convolve the signals in the frequency domain and therefore, generate a signal with a

frequency equal to the sum of the original two frequencies.

The third obstacle was perhaps the most difficult. The output of the frequency adder

was a signal composed of both the carrier signal from the magnet signal generator and the new

frequency that was the sum of the signal generator frequency and the beat frequency. We

realized that we needed a very high quality band pass filter to isolate this desired frequency

from the carrier frequency, with a very large power attenuation at only 2 Hz below the desired

signal. We were hoping to be able to tune the band pass filter more accurately, but we found

that the filter topology we chose worked very well at approximately 1 Hz than our original

planned frequency. As a result, we realized that it was much easier to tune the resonance of

the arm and lightweight object to match the bandpass filter’s center frequency than to slightly

adjust the band pass filter itself.

Another difficulty was figuring out how to create the color signals for the RGB LEDs.

This itself raised two more challenges. The first part was in creating a signal that would vary the

intensity of each LED color. We realized that the ring oscillator from LPset 5 would do exactly

what we needed, and so built a ring oscillator with a large time constant to slowly fade through

different colors. After that, we realized that low passing the square wave output would give us a

great fade between colors. The second challenge was a little more complicated. The LED

16

Page 17: T i me F ra me F i n a l R e p o rt - MIT · 2019. 5. 16. · 6.101 1 . T a b l e o f C o n t e n t s T a b l e o f Co n te n ts 2 ... f re sh ra t e o f t h e h u ma n e ye t o cre

strips that we acquired had a common anode instead of the planned common cathode

configuration. As a result, we had to figure out a way to provide enough power to the LED strip

for each LED color in order to cycle through the colors as desired. We eventually decided to

implement the circuit described in the color signal generator module.

The process of tackling these challenges was interesting. Being presented with these

problems and working to find a solution gave both of us confidence in our electrical engineering

abilities. It cemented a number of concepts in our minds, as well as enhanced our physical

debugging skills and provided many insights into the behavior of low frequency signals and their

interactions with physical circuit components. One of the things that we are proudest of based

on this project is how we were able to work together and devise practical solutions to the

problems we faced.

Conclusion This project was a really cool experience for both of us. It presented its fair share of

challenges and ended up being more difficult than we initially thought it would be. As a result, it

was even more rewarding once it was completed. We were able to complete not only all of the

proposed goals, but were also able to tackle all of our stretch goals. We plan on keeping it

around and having it on display whenever we want a nice, relaxed evening with a rainbow LED

optical illusion to keep us company.

A potential future extension for this project would be to add a second electromagnet that

would work in the opposite direction of the original electromagnet of this project. This would

allow us to push the object from both directions, leading to more amplitude in the swing of the

object. Another extension would be to halve the beat frequency being added to the carrier

signal in order to have the object complete a full back and forth over two beats, rather than one.

This would provide a smoother sway for the viewer, and would be more in line with how a

person would sway to the music as well.

In the end, we are happy that the circuit behaves as we expected. There were a few

tricky situations that we did not anticipate, but we were able to tackle them. The resulting

project is the culmination of a lot of hard work, and it is proudly displayed on our hall.

17