University of Portland School of Engineering 5000 N. Willamette Blvd. Portland, OR 97203-5798 Phone 503 943 7314 Fax 503 943 7316 Final Report Frequency Response Audio Visualizer Team Members: Jake Nylund (Fall Team Lead) Kevin Ratuiste (Spring Team Lead) Alex Arlint (Treasurer) Robert Rodriguez (Secretary) Industry Representatives: John Turner – Impinj, Inc. Faculty Advisors: Dr. Joseph Hoffbeck Clients: Will Taylor – Student FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 2 REVISION HISTORY Rev. Date Author Reason For Changes 0.9 21 Mar 2014 Team First draft submitted to advisor 0.95 28 Mar 2014 Team Second draft submitted to advisor 1.0 3 Apr 2014 Team Final draft submitted to advisor 1.1 7 April 2014 Kevin Ratuiste Updated Schematics (Figures 3 and 6) FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 3 TABLE OF CONTENTS REVISION HISTORY .................................................................................................................................................. 2 INTRODUCTION........................................................................................................................................................... 4 HIGH LEVEL ARCHITECTURE............................................................................................................................. 5 HARDWARE AND SOFTWARE DESIGN ......................................................................................................... 6 User Interface ............................................................................................................................................................. 7 Arduino Due Microcontroller .............................................................................................................................. 8 Software ........................................................................................................................................................................ 8 Electromagnet ............................................................................................................................................................ 9 Mechanical Components ...................................................................................................................................... 12 Miscellaneous Changes ......................................................................................................................................... 12 ASSUMPTIONS............................................................................................................................................................ 12 RISKS ............................................................................................................................................................................... 13 MILESTONES ............................................................................................................................................................... 13 CONCLUSION .............................................................................................................................................................. 14 GLOSSARY.................................................................................................................................................................... 15 FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 4 INTRODUCTION Frequency Beats, the name given to this project, is a frequency response audio visualizer. The overall goal of the device was to visualize the spectrum of an audio signal. The input is an analog line level audio signal connected via a standard 3.5mm headphone jack. This signal enters the microcontroller where it is processed and filtered to separate the various frequencies in the audio signal. Implementing the filters digitally allowed more flexibility in how the microprocessor processed the signal as well as the resulting action or response. Once the frequencies of the audio signal were separated, they were output to the electromagnets, which, in turn, manipulated the ferromagnetic fluid creating a visual representation of the audio signal. A front view of the final product is shown below in Figure 1, illustrating the front of the apparatus, consisting of three glass chambers partially filled with ferrofluid. Each glass chamber has a handmade electromagnet fixed to the top of it. Figure 1. Front of Apparatus Some highlights of the implementation phase were building electromagnets, designing and building a circuit that takes the Arduino’s PWM outputs and controls the electromagnets, and implementing a working program for the microcontroller that does the processing required and seeing that the project works in parts. FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 5 The two biggest challenges the team faced was implementing the Fast Fourier Transform (FFT) algorithm on the Arduino Due and to design a circuit that can be controlled by the Arduino’s PWM outputs. Another minor challenge was trying to produce three, mostly identical electromagnets that would generate a strong enough electromagnetic field to actuate the ferrofluid. The first attempts produced depressingly sub-par results and extra assistance was needed to produce electromagnets of proper quality. Each of these challenges were addressed according to the team’s list of anticipated challenges in the design document and was ultimately overcome. While the team noticed early in the Spring Semester that their milestones were overly ambitious and not in the ideal order for completion, the team did well at sticking to their basic original design, communicating with each other to anticipate, and plan for, any potential future challenges, and solving problems quickly as they arose in order to stay on schedule. The team could have done better in regards to testing individual components on a smaller scale as they were assembled and utilizing circuit simulation software, rather than testing larger sets of components towards the end and final assembly. The following sections of this document will address how the team handled the challenges mentioned above, as well as, detail the technical and process outcomes, including the differences between the team’s original designs and the final product, how the implementation was different than intended, and a discussion of assumptions, changes, milestones, and risks the team faced. Additionally, there is a glossary at the end of this document. HIGH LEVEL ARCHITECTURE The figure below shows the high level architecture of Frequency Beats. The three components to note are the Arduino, Low-Pass Filter (LPF), and the control circuit. First, the audio signal is processed by the Arduino and broken up into its low, mid and high frequencies. This is output as a PWM signal, which is then smoothed out to a DC signal by the LPF. This DC signal is then sent to the control circuitry, which turns the electromagnet on or off. FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 6 12V Power Supply Electromagnet (Low-Range) LPF Electromagnet (Low-Range) Electromagnet (Low-Range) Control Circuitry Low-Range Out Audio Inpu t Biasing Circuit Mid-Range Out Arduino LPF Control ControlCircuitry Circuit High-Range Out LPF Powered Speaker Control Circuitry Figure 2. High Level Architecture HARDWARE AND SOFTWARE DESIGN This section will go into the multiple components that make up the project. Both hardware and software designs will be discussed. Figure 3 below shows the overall final schematic of Frequency Beats. Electromagnet (Low-Range) BAT42 Electromagnet (Mid-Range) BAT42 BAT42 Electromagnet (High-Range) 3.3k 12V 3.3V 2.7k 2 LPF 100 33uF 1 2 10k 3 2N3904 4.7k 1 10k NC IRF3205 3 NC Audio Source Audio Input 100uF 1k Vcc 3.3V Arduino 11 Low-Range Out Mid-Range Out 12 13 High-Range Out 2 LPF 100 33uF 1k 1 3 2N3904 4.7k 2 10k 10k IRF3205 1 3 NC Powered Speaker 2 LPF 100 33uF Figure 3. Circuit Schematic 1 4.7k 2 10k 3 2N3904 10k IRF3205 1 3 FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 7 User Interface The user can plug in their audio signal via a 3.5mm standard line level audio cable on the back side of the project device. Once connected, the user presses play on the audio device (Ipod, Iphone, etc.) and watches the audio visualization of his or her music choice on the front side of the device. Additionally, the user will be able to hear the music, via external powered speakers, while viewing the ferrofluid displays with the aid of a 3.5mm headphone splitter; the user will not have to interact with this component as it is a passive piece on the back side of the device. Originally, the team had planned on using buttons on the face of the apparatus to manipulate the ferrofluid without music, but toggle switches were easier to incorporate. When looking at the front of the apparatus, having the switch to the left, forces the electromagnet on, to the right, the electromagnet is controlled by the audio input, and in the middle, the electromagnet is always off. Figure 4. Toggle Switches FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 8 Arduino Due Microcontroller The primary digital component that will be utilized in the design is the Arduino Due, which is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU. It is the first Arduino board based on a 32-bit ARM core microcontroller. It has 54 digital input/output pins, 12 analog inputs with 12 bits of resolution each, and 12 PWM output pins. This component will be used to digitally filter the input audio signal using a Fast Fourier Transform (FFT) algorithm, separating it into low-range, mid-range, and high-range frequency bands, averages the amplitudes to produce a single DC voltage representation of each band, and outputs those three signals to the electromagnets. Software The key software utilized in the design will be the Arduino integrated development environment (IDE), which is a cross-platform application written in java. The team will use this software to write the code necessary for filtering the input audio signal. An overview of the process to be implemented via code is shown below. Figure 5. Software Flowchart Figure 5 shows the general process that the signal will undergo as it is sampled by the Arduino. Simply stated the Arduino will continuously sample the input on one of the analog input pins using a loop. From there, using FFT, the signal will be separated as low FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 9 pass, band pass, and high pass filters. These frequencies will range from 20Hz - 160Hz for the low frequencies, 160Hz – 7.5kHz for mid-range frequencies, and 7.5kHz - 15kHz for the high frequencies. Each signal will be output to three different digital output pins. The Arduino will process the audio input with a buffer size of 1024 and a sample rate of 44100Hz. The Arduino output is a Pulse Width Modulation (PWM) signal between 1 and 3.3 volts. These outputs will be combined by taking the magnitude of each output, and then summed. This value will then be scaled to a number between – 85 and 255 (the PWM output which comes out around 500Hz). The following is a list of the functions the Arduino will be performing. Init Initialize I/O pins and variables for the sampling and output process sampleLoop This loop will continuously sample the audio input in Analog format. Using FFT it will split the signal and output onto three separate pins for high, low, and band pass frequencies. FFT will output several complex numbers, or rather a real and complex part of each number in the form of doubles. Each of the outputs will be sent to each of their corresponding output pins as a combine value, putting the real and complex portions into one value. The values will be continually recalculated in the loop to continually send to their respective pins, for example pins 22, 23, and 24 on the Arduino. The signal will then pass through a low pass filter in order to create the proper DC current output for the circuit. Electromagnet Power Supply The signal from the Arduino was not strong enough to drive the electromagnet. Thus, the electromagnets were powered by a 6.5A, 12V power supply. Control As seen in the figure below, the signal from the Arduino’s PWM output pins is passed through a LPF, which acts as a simple DAC, allowing the electromagnets to be powered to any level within a certain range. A 2N3904 BJT is controlled by the low-passed PWM signal from the Arduino, which in turn controls an IRF3205 MOSFET. Together they act as the “on/off” switch for the electromagnet. At 3.3V the IRF3205 begins to saturate and the electromagnet begins to turn on. At 5V or higher, the MOSFET is completely saturated and the electromagnet is fully on. However, since the maximum voltage of the PWM signal after the LPF is only approximately 2V and thus never high enough to saturate the MOSFET, the signal could not be input directly into the IRF3205. In order to provide enough voltage so that the MOSFET turns on, 6V is connected to its base and the 2N3904 controls when the IRF3205 base voltage is pulled high or low. This control was done by setting the base of the 2N3904 to 1.5V, so that when 2V or higher is seen at the emitter, in other words Ve is greater than Vb, the BJT turns off. With the 2N3904 FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 10 off, the IRF3205 is pulled high, thus turning the electromagnet on. As for when less than 1.5V is at the emitter, the 2N3904 is on, which pulls the base of the IRF3205 to below 3.3v, turning the electromagnet off. The team had to diverge from the original plan since the maximum current from the Arduino was less than the originally anticipated 40mA and could not trigger the TIP102. The team tried multiple fixes, including cascading another BJT in front of the TIP102, but none worked. In addition, it was difficult to observe the current coming out of the Arduino’s PWM outputs hindering debugging. Subsequently, the circuit was completely reworked to what it is now so that it was dependent on voltage level as opposed to current. Another small change that was made was the addition of a flyback diode. This protected the circuitry from the voltage spikes that occur when the electromagnet is suddenly turned off. 12V 3.3V (From Arduino) 3.3k BAT42 Electromagnet 2.7k NC From Arduino 2 LPF 100 1 33uF 3 2N3904 4.7k 2 10k IRF3205 1 10k Figure 6. Electromagnet Control Circuit 3 FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 11 Build Each electromagnet was made with of approximately 270 feet of 26 gauge magnet wire and wrapped around a 1/4” diameter iron core that is 5 inches in length. The internal resistance of the wire was approximately 13Ω (greater than the originally anticipated 5.7 Ω). The electromagnets were mounted above the ferrofluid display. After many unsuccessful attempts at hand wrapping electromagnets, the team finally found success using a lathe to slowly wrap each individual electromagnet. Each magnet took approximately 3 hours to manufacture. Figure 10 below illustrates a hand wrapped electromagnet, on the right, and one wrapped carefully using a lathe, on the left. Figure 7. Lathe vs Hand-Coiled Electromagnets FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 12 Mechanical Components The team’s project incorporates several simple mechanical devices. One of which was the casing that houses the Ferro fluid. For this, the team originally planned to use plexiglass cylinders, each with a diameter of approximately 2 inches and height of 5 inches. However, the ferrofluid stuck to the sides of the plexiglass, completely blacking out the display, and making it impossible to see inside the display. To address this, the team decided to use glass cylinders instead, since the ferrofluid did not stick to glass. The electromagnets were mounted above the cylinder. Additionally, a wood base was constructed to mount the three Ferro-fluid displays, control circuit, and Arduino. Miscellaneous Changes Most changes that occurred were explained in the above sections, but there were some other minor changes that the team also had to make during the semester. LEDs As of now, the team unfortunately was not able to incorporate LEDs to pulse with the music as stated in the Functional Specification Document. The setbacks caused by trouble with the FFT code, unexpected behavior of the ferrofluid display material, and the redesigning of the circuit ultimately resulted in final testing of the displays and Arduino not happening until 2 April. In addition to the need to complete the Final Report and presentation by 4 April, the team had to prioritize and abandon the implementation of the LEDs. ASSUMPTIONS The team originally made several assumptions (listed below) that all proved to be true throughout the construction, testing, and assembly process. No issues arose in regards to these assumptions, which are listed below. Alan Hansen will be available to help with the construction of the base and container for the ferrofluid All hardware will be available and function properly Some hardware components, such as resistors and capacitors, will be available from the University and are not necessary to purchase. There was, however, an assumption that was not listed in the team’s functional specifications that should have been, which was the assumption that the Arduino would output a sufficient current to switch the TIP102. This was not the case, and as a result, the entire control circuit had to be redesigned. FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 13 RISKS The risks for the project have been stated previously in the Functional Specifications Document and the Design Document. Please refer to that as there have been no changes in the risks. Documentation can be found at: http://wordpress.up.edu/egr13couchstreet/visualizer-status/. The only risk that became a reality was the potential for issues with the plexiglass containers, as discussed previously. The team’s contingency proved helpful. The team was able to effectively utilize their resources to find an alternative material (glass) to house the ferrofluid. There were not any risks that were not identified in the Functional Specifications. MILESTONES Task Order all parts Build base and get audio input Finish building one display Finish digital signal processing Test signal with one display Testing and debugging of first display Build other displays and add processing Final assembly and testing Final report Founder’s Day presentation Date Due 12/1/13 1/17/14 1/24/14 1/31/14 2/3/14 2/7/14 2/28/14 3/14/14 4/4/14 4/8/14 Date Complete 12/1/13 3/17/14 3/13/14 3/12/14 3/28/14 3/29/14 3/13/14 4/2/14 4/3/14 - Table 1. Milestones Due Date and Completion Dates As it can be seen in Table 1 above, many milestones were achieved late. This was due to three primary reasons. First, the milestone due dates were set back during the Fall Semester and ended up not being in the most efficient order. For example, the milestones called for the base to be built first and early in the semester. However, the base ended up being one of the last parts to be constructed because it made a lot more sense to build it after the displays to ensure that it is built appropriately. Second reason was due to the team’s overly ambitious goal setting at the beginning of the year. Despite a team’s best attempts to anticipate any and all potential problems, no team can foresee all issues that will occur. This was precisely the case with team Couch Street, which leads to the third reason. The team encountered several problems over the semester causing multiple setbacks and delays. These problems included difficulty developing a method of accurately manufacturing the electromagnets, the unexpected problem of the ferrofluid sticking to the plexiglass, and the team trying to create their own ferrofluid from the start rather than purchasing it. Another delay causing problem the team ran into was getting the Arduino to control transistors, which ultimately lead to a whole redesign of the control circuit. The FFT also took longer to implement than anticipated. These issues were all ultimately corrected, but resulted in the FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 14 team falling behind schedule. However in the end, most importantly, everything was completed on time for Founders Day. CONCLUSION The ferromagnetic fluid audio visualizer is a different way of seeing different frequencies used in different types of music. It visually represents the low, middle and high frequency ranges by digitally processing the sound from a standard 3.5mm headphone jack, and then uses the processed signal to control the electromagnets on and off, which manipulates ferrofluid. From the client’s perspective, the team’s final project was visually identical to the original design as outlined in the Design Document. However, there were a few schematic changes that were made, which are not noticeable to the end user, as outlined in this document. The team did a great job of communicating with each other, planning and adapting as issues arose, and keeping focused on the end goal. The team’s primary mistake was not anticipating more potential problems throughout the assembly and testing phases. FINAL REPORT TEAM COUCH STREET REV. 1.1 PAGE 15 GLOSSARY IC: (Integrated Circuit) is a microelectronic circuit manufactured on a thin substrate of a semiconductor material such as silicon. Microcontroller: is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Arduino: is a single-board microcontroller to make using electronics in multidisciplinary projects more accessible. Electromagnet: is a type of magnet in which the magnetic field is produced by electric current. Ferrofluid: is a liquid which becomes strongly magnetized in the presence of a magnetic field. LED: (Light Emitting Diode) A semiconductor diode that emits light when a voltage is applied to it and that is used especially in electronic devices (as for an indicator light).