<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hades.mech.northwestern.edu//api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lingyu+Xie</id>
	<title>Mech - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://hades.mech.northwestern.edu//api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lingyu+Xie"/>
	<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php/Special:Contributions/Lingyu_Xie"/>
	<updated>2026-04-20T02:40:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12876</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12876"/>
		<updated>2009-03-20T06:38:46Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Main frequency sweep code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|Three-Speaker Chladni Setup with User Interface Box|thumb|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833 by calling send_freq(), which is a function that shifts the frequency up or down by 1 Hz every 100 ms, and constantly updates the LCD to display the current and target frequency until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
void send_freq(int16 f_reg);&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               send_freq(ct); //send frequency to chip and display status on LCD&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               send_freq(ct); //send frequency to chip and display status on LCD&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void send_freq(int16 f_reg) //send frequency from f_reg to AD9833 chip and display frequencies on LCD&lt;br /&gt;
{&lt;br /&gt;
   spi_xfer(0b0010000100000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(f_reg); //set AD9833 frequency to f_reg, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
   spi_xfer(0b0100000000000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000);&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(f_reg - 16384); //convert to actual Hz value of frequency&lt;br /&gt;
   target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12871</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12871"/>
		<updated>2009-03-20T06:36:30Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Main frequency sweep code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|Three-Speaker Chladni Setup with User Interface Box|thumb|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
void send_freq(int16 f_reg);&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               send_freq(ct); //send frequency to chip and display status on LCD&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               send_freq(ct); //send frequency to chip and display status on LCD&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void send_freq(int16 f_reg) //send frequency from f_reg to AD9833 chip and display frequencies on LCD&lt;br /&gt;
{&lt;br /&gt;
   spi_xfer(0b0010000100000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(f_reg); //set AD9833 frequency to f_reg, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
   spi_xfer(0b0100000000000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000);&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000);&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(f_reg - 16384); //convert to actual Hz value of frequency&lt;br /&gt;
   target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12857</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12857"/>
		<updated>2009-03-20T06:17:30Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|Three-Speaker Chladni Setup with User Interface Box|thumb|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12854</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12854"/>
		<updated>2009-03-20T06:16:44Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|thumb|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12853</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12853"/>
		<updated>2009-03-20T06:16:33Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Chladni_complete_system&amp;diff=12852</id>
		<title>File:Chladni complete system</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Chladni_complete_system&amp;diff=12852"/>
		<updated>2009-03-20T06:16:15Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12851</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12851"/>
		<updated>2009-03-20T06:16:04Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_complete_system|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12850</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12850"/>
		<updated>2009-03-20T06:13:15Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker. +Vs is +12V and -Vs is -12V for the TDA2040 circuit.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12849</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12849"/>
		<updated>2009-03-20T06:12:08Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12848</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12848"/>
		<updated>2009-03-20T06:11:55Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Note: If the TDA2040 is to be used, connect the output of the unity gain buffer amps to the Vi input of the TDA2040 chip. The load at pin 4 of the TDA2040 chip is then the speaker.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12845</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12845"/>
		<updated>2009-03-20T06:09:14Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12844</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12844"/>
		<updated>2009-03-20T06:09:04Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12843</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12843"/>
		<updated>2009-03-20T06:08:44Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12842</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12842"/>
		<updated>2009-03-20T06:08:32Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|left|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:tda2040_circuit|left|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12841</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12841"/>
		<updated>2009-03-20T06:08:03Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Circuit Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
* Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
* Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
* We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
* The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
* We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
* We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
* The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
* The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
* Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.alliedelec.com/Images/Products/Datasheets/BM/MICROCHIP/383-0570.PDF PIC18F4520]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/analogdevices/129232781AD9833_prh.pdf AD9833 BRMZ-ND]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/fairchild/LM741.pdf LM741]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs JHD 162A]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf TDA2040]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.legacycaraudio.com/manuals/LA160.pdf Legacy LA160]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below as well.&lt;br /&gt;
&lt;br /&gt;
Also, using three separate function generator chips for each speaker was unfruitful. The fragility of the chips as well as the difficulty in transferring three different signals through SPI led us to resort to using only one of them.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|500px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Notes ==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Possible Future Improvements/Enhancements ==&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12292</id>
		<title>ME 333 final projects</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12292"/>
		<updated>2009-03-20T00:06:44Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Three-speaker Chladni Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the &amp;#039;&amp;#039;&amp;#039;[[ME 333 end of course schedule]]&amp;#039;&amp;#039;&amp;#039;.  &lt;br /&gt;
&lt;br /&gt;
Final projects for ME 333 in years 2000-2007 can be found&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[http://lims.mech.northwestern.edu/~design/mechatronics/ here]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2009 ==&lt;br /&gt;
&lt;br /&gt;
=== [[Mozart&amp;#039;s Right Hand]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Persistence-of-Vision Display]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Rock-Paper-Scissors]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Three-speaker Chladni Patterns]] ===&lt;br /&gt;
[[Image:chladni_660hz|right|thumb|150px]]&lt;br /&gt;
This project uses three speakers to generate shapes on a circular aluminum plate depending on which frequency the speakers are playing at. Once the speakers hit a resonant frequency of the plate, salt migrates to the nodes (zero amplitude) regions of the plate to form distinct patterns.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Basketball]] ===&lt;br /&gt;
[[Image:Mechatronics2009Bball|right|thumb|150px]]&lt;br /&gt;
This project consists of a throwing arm propelled by a Pittman motor is mounted on a turntable and throws the ball into the &amp;quot;hoop.&amp;quot; The hoop is wrapped in reflective tape and an IR emitter, receiver pair is used to sense where the IR is reflected most (the hoop with highly reflective tape). An ultrasonic sensor then pings the hoop for the distance of the hoop. With this information, the arm is able to &amp;quot;make a basket.&amp;quot;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Drummer]] ===&lt;br /&gt;
The Robot Drummer is a device that demonstrates high-speed motor control by being able to drum when given commands.  Through an RS232 cable, Matlab sends commands to a &amp;quot;master&amp;quot; PIC.  The master then sends the commands to two &amp;quot;slave&amp;quot; PICs through I2C communication.  The slaves take the commands and implement PID control of the motors.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Fish Refuge]] ===&lt;br /&gt;
[[Image:Entire Fish Refuge|right|thumb|200px]]&lt;br /&gt;
The automated fish refuge allows for the controlled movement of a fish refuge with the goal of recording specific behavior.  The mechanical design is completely adjustable and allows adjustable degrees of oscillating movement and orientation of the refuge.  The program is primarily in MATLAB for ease of use and the velocity profile can be a sine, square, triangle, or any function that the user inputs. [http://www.youtube.com/watch?v=wGOKujMhN88 Check out the video!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Marionette]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Monkeybot]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[PPOD-mini:  6-DOF Shaker]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Automated Xylophone]] ===&lt;br /&gt;
[[Image:AutomatedXylophonePicture1.jpg|thumb|200x200 px|right|Automated Xylophone]]&lt;br /&gt;
The Automated Xylophone controls several solenoids which hit various pitches on an actual xylophone based on the note selected.  The device has two main modes: using the keypad, a user can choose to either play notes in real time or store songs to be played back later.  A video of the Automated Xylophone playing in real time mode can be found [http://www.youtube.com/watch?v=_ubpAEyq9kg here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vision-based Cannon]] ===&lt;br /&gt;
[[Image:SM_Gun_Camera_PIC_Setup.JPG|thumb|200x200 px|right|Vision-based Cannon]]&lt;br /&gt;
This project uses a webcam and Matlab to analyze an image and direct a modified USB Missile Launcher to fire at targets found in the image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2008 ==&lt;br /&gt;
&lt;br /&gt;
=== [[IR Tracker]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:IR_Tracker_Main.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The IR Tracker (aka &amp;quot;Spot&amp;quot;) is a device that follows a moving infrared light. It continuously detects the position of an infrared emitter in two axes, and then tracks the emitter with a laser. [[Media:MT_MS_AZ_TrackerVideo.mp4|See Spot Run.]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Chosen the OUTSTANDING PROJECT by the students of ME 333.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Snake]] ===&lt;br /&gt;
[[Image:HLSSnakeMain.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This remote control robotic snake uses servo motors with a traveling sine wave motion profile to mimic serpentine motion.  The robotic snake is capable of moving forward, left, right and in reverse.   &lt;br /&gt;
[http://www.youtube.com/watch?v=r_GOOFLnI6w Video of the robot snake]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Programmable Stiffness Joint]] === &lt;br /&gt;
&lt;br /&gt;
[[Image:SteelToePic2.jpg|thumb|200px|The &amp;#039;Steel Toe&amp;#039; programmable stiffness joint|right]]&lt;br /&gt;
&lt;br /&gt;
The Programmable Stiffness Joint varies rotational stiffness as desired by the user.  It is the first step in modeling the mechanical impedance of the human ankle joint (both stiffness and damping) for the purpose of determining the respective breakdown of the two properties over the gait cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Magnetic based sample purification]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Continuously Variable Transmission]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:CVT_system.JPG|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This prototype is a proof of concept model of a variable ratio transmission to be implemented in the 2008-2009 Formula SAE competition vehicle.  The gear ratio is determined by the distances between the pulley halves which are controllable electronically.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Granular Flow Rotating Sphere]] ===&lt;br /&gt;
[[Image:Team-21-main-picture.JPG|right|thumb|200px]]&lt;br /&gt;
This device will be used to study the granular flow of particles within a rotating sphere. The sphere is filled with grains of varying size and then rotated about two different axes according to a series of position and angular velocity inputs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vibratory Clock]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Vibratory_Clock.jpg|right|thumb|Vibratory Clock|200px]]&lt;br /&gt;
&lt;br /&gt;
The Vibratory Clock allows a small object to act as an hour &amp;quot;hand&amp;quot; on a horizontal circular platform that is actuated from underneath by three speakers.  The object slides around the circular platform, impelled by friction forces due to the vibration.  [http://www.youtube.com/watch?v=KhgTNCfdwZw Check it out!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[WiiMouse]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:HPIM1027.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The WiiMouse is a handheld remote that can be used to move a cursor on a windows-based PC, via accelerometer input captured through device movement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Intelligent Oscillation Controller]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:ME333_learning_oscillator.jpg|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This device &amp;quot;learns&amp;quot; a forcing function that is applied to a spring and mass system to match an arbitrary, periodic acceleration profile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Baseball]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Baseball_Playfield.jpg|Sweet Baseball Game|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive baseball game inspired by pinball, featuring pitching, batting, light up bases and a scoreboard to keep track of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Ball Balancing Challenge]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Ballbalancechallenge.JPG|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive game involving ball balancing on a touchscreen with touchscreen feedback and joystick action. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12290</id>
		<title>ME 333 final projects</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12290"/>
		<updated>2009-03-20T00:05:15Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Three-speaker Chladni Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the &amp;#039;&amp;#039;&amp;#039;[[ME 333 end of course schedule]]&amp;#039;&amp;#039;&amp;#039;.  &lt;br /&gt;
&lt;br /&gt;
Final projects for ME 333 in years 2000-2007 can be found&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[http://lims.mech.northwestern.edu/~design/mechatronics/ here]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2009 ==&lt;br /&gt;
&lt;br /&gt;
=== [[Mozart&amp;#039;s Right Hand]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Persistence-of-Vision Display]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Rock-Paper-Scissors]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Three-speaker Chladni Patterns]] ===&lt;br /&gt;
[[Image:chladni_660hz|right|thumb|150px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Basketball]] ===&lt;br /&gt;
[[Image:Mechatronics2009Bball|right|thumb|150px]]&lt;br /&gt;
This project consists of a throwing arm propelled by a Pittman motor is mounted on a turntable and throws the ball into the &amp;quot;hoop.&amp;quot; The hoop is wrapped in reflective tape and an IR emitter, receiver pair is used to sense where the IR is reflected most (the hoop with highly reflective tape). An ultrasonic sensor then pings the hoop for the distance of the hoop. With this information, the arm is able to &amp;quot;make a basket.&amp;quot;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Drummer]] ===&lt;br /&gt;
The Robot Drummer is a device that demonstrates high-speed motor control by being able to drum when given commands.  Through an RS232 cable, Matlab sends commands to a &amp;quot;master&amp;quot; PIC.  The master then sends the commands to two &amp;quot;slave&amp;quot; PICs through I2C communication.  The slaves take the commands and implement PID control of the motors.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Fish Refuge]] ===&lt;br /&gt;
[[Image:Entire Fish Refuge|right|thumb|200px]]&lt;br /&gt;
The automated fish refuge allows for the controlled movement of a fish refuge with the goal of recording specific behavior.  The mechanical design is completely adjustable and allows adjustable degrees of oscillating movement and orientation of the refuge.  The program is primarily in MATLAB for ease of use and the velocity profile can be a sine, square, triangle, or any function that the user inputs. [http://www.youtube.com/watch?v=wGOKujMhN88 Check out the video!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Marionette]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Monkeybot]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[PPOD-mini:  6-DOF Shaker]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Automated Xylophone]] ===&lt;br /&gt;
[[Image:AutomatedXylophonePicture1.jpg|thumb|200x200 px|right|Automated Xylophone]]&lt;br /&gt;
The Automated Xylophone controls several solenoids which hit various pitches on an actual xylophone based on the note selected.  The device has two main modes: using the keypad, a user can choose to either play notes in real time or store songs to be played back later.  A video of the Automated Xylophone playing in real time mode can be found [http://www.youtube.com/watch?v=_ubpAEyq9kg here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vision-based Cannon]] ===&lt;br /&gt;
[[Image:SM_Gun_Camera_PIC_Setup.JPG|thumb|200x200 px|right|Vision-based Cannon]]&lt;br /&gt;
This project uses a webcam and Matlab to analyze an image and direct a modified USB Missile Launcher to fire at targets found in the image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2008 ==&lt;br /&gt;
&lt;br /&gt;
=== [[IR Tracker]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:IR_Tracker_Main.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The IR Tracker (aka &amp;quot;Spot&amp;quot;) is a device that follows a moving infrared light. It continuously detects the position of an infrared emitter in two axes, and then tracks the emitter with a laser. [[Media:MT_MS_AZ_TrackerVideo.mp4|See Spot Run.]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Chosen the OUTSTANDING PROJECT by the students of ME 333.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Snake]] ===&lt;br /&gt;
[[Image:HLSSnakeMain.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This remote control robotic snake uses servo motors with a traveling sine wave motion profile to mimic serpentine motion.  The robotic snake is capable of moving forward, left, right and in reverse.   &lt;br /&gt;
[http://www.youtube.com/watch?v=r_GOOFLnI6w Video of the robot snake]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Programmable Stiffness Joint]] === &lt;br /&gt;
&lt;br /&gt;
[[Image:SteelToePic2.jpg|thumb|200px|The &amp;#039;Steel Toe&amp;#039; programmable stiffness joint|right]]&lt;br /&gt;
&lt;br /&gt;
The Programmable Stiffness Joint varies rotational stiffness as desired by the user.  It is the first step in modeling the mechanical impedance of the human ankle joint (both stiffness and damping) for the purpose of determining the respective breakdown of the two properties over the gait cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Magnetic based sample purification]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Continuously Variable Transmission]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:CVT_system.JPG|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This prototype is a proof of concept model of a variable ratio transmission to be implemented in the 2008-2009 Formula SAE competition vehicle.  The gear ratio is determined by the distances between the pulley halves which are controllable electronically.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Granular Flow Rotating Sphere]] ===&lt;br /&gt;
[[Image:Team-21-main-picture.JPG|right|thumb|200px]]&lt;br /&gt;
This device will be used to study the granular flow of particles within a rotating sphere. The sphere is filled with grains of varying size and then rotated about two different axes according to a series of position and angular velocity inputs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vibratory Clock]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Vibratory_Clock.jpg|right|thumb|Vibratory Clock|200px]]&lt;br /&gt;
&lt;br /&gt;
The Vibratory Clock allows a small object to act as an hour &amp;quot;hand&amp;quot; on a horizontal circular platform that is actuated from underneath by three speakers.  The object slides around the circular platform, impelled by friction forces due to the vibration.  [http://www.youtube.com/watch?v=KhgTNCfdwZw Check it out!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[WiiMouse]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:HPIM1027.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The WiiMouse is a handheld remote that can be used to move a cursor on a windows-based PC, via accelerometer input captured through device movement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Intelligent Oscillation Controller]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:ME333_learning_oscillator.jpg|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This device &amp;quot;learns&amp;quot; a forcing function that is applied to a spring and mass system to match an arbitrary, periodic acceleration profile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Baseball]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Baseball_Playfield.jpg|Sweet Baseball Game|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive baseball game inspired by pinball, featuring pitching, batting, light up bases and a scoreboard to keep track of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Ball Balancing Challenge]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Ballbalancechallenge.JPG|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive game involving ball balancing on a touchscreen with touchscreen feedback and joystick action. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12288</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12288"/>
		<updated>2009-03-20T00:03:10Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* One-Speaker Chladni */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;PIC18F4520&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;AD9833 BRMZ-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;LM741&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;JHD 162A&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;TDA2040&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Legacy LA160&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below too.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12287</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12287"/>
		<updated>2009-03-20T00:03:01Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;PIC18F4520&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;AD9833 BRMZ-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;LM741&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;JHD 162A&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;TDA2040&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Legacy LA160&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below too.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12286</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12286"/>
		<updated>2009-03-20T00:01:41Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_660hz|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;PIC18F4520&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;AD9833 BRMZ-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;LM741&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;JHD 162A&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;TDA2040&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Legacy LA160&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below too.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12277</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=12277"/>
		<updated>2009-03-19T23:56:30Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_setup|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PIC Microcontroller&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;PIC18F4520&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Function generator chip (surface mount)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;AD9833 BRMZ-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=AD9833BRMZ-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$9.42&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;10-Pin Adaptor for surface mount&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;33010CA-ND&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;amp;name=33010CA-ND Digi-Key]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$3.22&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;General Purpose Op-Amp&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;LM741&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Parallel LCD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;JHD 162A&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Audio amplifier chip&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;TDA2040&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Car audio amplifier (at least 3 channel)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Legacy LA160&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;  1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
The TDA2040 audio amplifier chip was first used instead of the car audio amplifier. This chip draws a lot of power, and to amplify three speakers, three chips were needed that drew 24V each. Results with these were inconsistent and hence the car audio amplifier was used instead. The circuit diagram for this chip is shown below too.&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip, such as using electrical tape to tape it down to the adapter. This shows how difficult making a solid connection can be. However, if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11744</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11744"/>
		<updated>2009-03-19T04:52:32Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* One-Speaker Chladni */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_setup|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11743</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11743"/>
		<updated>2009-03-19T04:52:13Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:chladni_setup|right|thumb|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11742</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11742"/>
		<updated>2009-03-19T04:50:25Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11740</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11740"/>
		<updated>2009-03-19T04:44:32Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Breakdown of Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw.&amp;lt;br&amp;gt;&lt;br /&gt;
For more information on how speakers work, click [http://electronics.howstuffworks.com/speaker6.htm here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11739</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11739"/>
		<updated>2009-03-19T04:42:25Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Chladni_zeros_circular_plate2&amp;diff=11738</id>
		<title>File:Chladni zeros circular plate2</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Chladni_zeros_circular_plate2&amp;diff=11738"/>
		<updated>2009-03-19T04:40:58Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11737</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11737"/>
		<updated>2009-03-19T04:40:46Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y to get the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate2]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11736</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11736"/>
		<updated>2009-03-19T04:37:28Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration. The following paragraphs summarize the equations that can be used to determine the shapes of nodes or the frequencies that cause the nodes, but additional websites such as [http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics] and [http://webphysics.davidson.edu/alumni/jimn/Java/modes.html Chladni Figures and Vibrating Plates] can be used to visualize the different modes of square and circular plates better.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y to get the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
Also we noticed that our patterns did not have perfect radial symmetry.  As the patterns rely heavily on the shape of the plate, imperfections in the plate can cause unsymmetrical patterns.  In addition to a few small dents and scratches, band-sawing the circle out of the large plate yielded jagged and crooked edges at several points.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the LA160 car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11732</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11732"/>
		<updated>2009-03-19T04:34:48Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y to get the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shapes of the nodes on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11731</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11731"/>
		<updated>2009-03-19T04:34:30Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y to get the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equation relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11729</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11729"/>
		<updated>2009-03-19T04:33:29Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Equations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y to get the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11728</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11728"/>
		<updated>2009-03-19T04:32:20Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project also includes a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
* Try sending different frequencies (by figuring out how to program multiple AD9833 chips with one PIC) to each speaker to see if they generate different patterns.&lt;br /&gt;
* Use different plate size or different amount of speakers.  For example, use 4 speakers and a large square plate to change the types of visible shapes at resonance.&lt;br /&gt;
* Figure out the power issue with multiple TDA-2040 audio amp chips so the project wouldn&amp;#039;t rely on the LA160 car amp.  &lt;br /&gt;
* Use a more rigid plate or construct one with less defects in shape.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11726</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11726"/>
		<updated>2009-03-19T04:24:52Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|150px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11725</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11725"/>
		<updated>2009-03-19T04:24:26Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|100px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Chladni_tda2040_circuit&amp;diff=11724</id>
		<title>File:Chladni tda2040 circuit</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Chladni_tda2040_circuit&amp;diff=11724"/>
		<updated>2009-03-19T04:24:02Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11723</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11723"/>
		<updated>2009-03-19T04:23:50Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right|TDA-2040 circuit|thumb|300px]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11722</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11722"/>
		<updated>2009-03-19T04:23:19Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_tda2040_circuit|right]]&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11721</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11721"/>
		<updated>2009-03-19T04:22:45Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Amplifier Chips &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
At first we planned to use the TDA-2040 audio amp chips.  Our original circuit is pictured to the right.  When working with one speaker the TDA-2040 chip worked beautifully.  It requires a lot of power - 24 volts - which was supplied using -12V to +12V.  The one speaker video was actually done with the TDA-2040 audio amp chip.  &lt;br /&gt;
&lt;br /&gt;
The next step was to have a TDA-2040 amplify the other two speakers.  Each of the audio amps would need 24 volts.  When we added the other speakers we noticed that this caused all the speakers to experience a drop in amplitude. Providing each audio amp with its own 24 volt power supply only yielded marginal improvements.  However the signal was still very inconsistent and noisy.  &lt;br /&gt;
&lt;br /&gt;
For the purposes of demonstration we decided to use the Legacy II car amp for a much cleaner signal and far more defined Chladni patterns.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11720</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11720"/>
		<updated>2009-03-19T04:21:54Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We had wanted to try to send three different frequencies, one to each speaker. This would require the use of three AD9833s, which we attempted to build a circuit for. From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11719</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11719"/>
		<updated>2009-03-19T04:17:59Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to three AD9833s, using the same connections for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11718</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11718"/>
		<updated>2009-03-19T04:16:23Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to the AD9833 three times for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11717</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11717"/>
		<updated>2009-03-19T04:16:11Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Experimental Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; AD9833 Waveform Generator &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While a tremendously versatile and useful chip, we found it extremely difficult to work with.  The chip itself is very small and as mentioned above needs to be soldered to an adapter.  Surface mount soldering this chip is not easy to do by hand and the connection may be weak even if you&amp;#039;ve tested with a multimeter.  We even found that performance of the chip can be improved simply by putting pressure on the chip which shows how difficult making a solid connection can be. However if working properly this chip can be very powerful.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; SPI communication with multiple AD9833 chips &amp;lt;/b&amp;gt;&lt;br /&gt;
From the example code we used and edited from the [[Waveform_Generation_with_AD9833,_and_SPI]] page, we saw that the PIC could only use one pin A3 (digital output) of the PIC for communication with the chip, while the other two pins A1 and A2 were used as Enable and CLK. We tried duplicating the SPI connections from the PIC to the AD9833 three times for each chip, but after programming the PIC and running the program, we saw that the AD9833 chips were not responding in the correct way. We thought that the issue may be that the AD9833s could not be programmed at the same time, so we tried another method. We used three 2-input AND gates and fed the CLK line as one input to each AND gate, with the other input being a switch from the PIC that would go high if that certain AD9833 was to be programmed. The other two PIC outputs Enable and Digital Output would still go to each AD9833. The output of each AND gate would feed into SCLK (pin 7) of the AD9833 and go low if the CLK was low and the switch was high, signaling that the AD9833 should be programmed (AD9833 is programmed with SCLK is low). The AD9833s would then be programmed in series, as the switch for the first AD9833 would go high, then the second switch would go high while the first went low, and so on. However, this method did not cause the AD9833s to be programmed/output a signal at all. In the end, we found that just using one SPI connection to one AD9833 gave the best frequency output, so we decided to split that signal into three and send them through unity gain buffers (preventing undesired loading or interference). The output of the buffers would be sent to the LA160 car audio amplifer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Sending Different Frequencies to Different Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was difficult to experiment with because of our issues with SPI communication to separate AD9833 chips.  However throughout the project we experienced times when the speakers were operating at different frequencies.  From what we have seen all speakers must be operating at the same frequencies for any pattern to show.  Whenever there was a phase issue or difference in frequency the plate would exhibit buckling behavior throwing the salt several inches into the air.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Aluminum Plate &amp;lt;/b&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
When deciding how to space the speakers we had to consider the aluminum plate.  Too far apart and a thin plate might sag in the middle, while too close together and the plate might sag around the edges.  Sag would create artificial nodes and cause salt to accumulate in the wrong areas.  &lt;br /&gt;
&lt;br /&gt;
We decided early on to space the centers of the speakers 13&amp;quot; apart and began testing to see which size and shape plate would give us the least sag.  Ultimately 28&amp;quot; diameter circle plate allowed us the largest possible plate - so we could have larger patterns - without the plate sagging around the edges or in the middle.  We started with 36&amp;quot; x 36&amp;quot; plate and band sawed our circular plate out of it.&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11714</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11714"/>
		<updated>2009-03-19T03:54:15Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Three-Speaker Chladni */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11713</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11713"/>
		<updated>2009-03-19T03:50:24Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Three-Speaker Chladni */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=0qsijdgoGDc Click here for a video of our Three-speaker Chladni setup]&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11712</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11712"/>
		<updated>2009-03-19T03:48:23Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* One-Speaker Chladni */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  You can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
[http://www.youtube.com/watch?v=Sz1AuS-qA1c Click here for a video of our one-speaker Chladni setup]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see from the previous video, the one-speaker setup gives more distinct patterns than our three-speaker setup. This may be because there is no other interference with the vibration that more speakers connected to the same plate may cause. The patterns are all very different from each other, indicating the different diametric and radial modes of the square plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Experimental Notes ===&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11707</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11707"/>
		<updated>2009-03-19T03:41:05Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Breakdown of Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  However if you were to replicate this you can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|Dust cap removal|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
-add video of one-speaker config&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11705</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11705"/>
		<updated>2009-03-19T03:40:33Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Breakdown of Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  However if you were to replicate this you can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
-add video of one-speaker config&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11704</id>
		<title>Three-speaker Chladni Patterns</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Three-speaker_Chladni_Patterns&amp;diff=11704"/>
		<updated>2009-03-19T03:40:18Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: /* Breakdown of Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:chladni_team|right]]&lt;br /&gt;
* Christopher Chow (Mechanical Engineering, Class of 2010)&lt;br /&gt;
* Anup Tapase (Electrical Engineering, Class of 2010)&lt;br /&gt;
* Lingyu Xie (Electrical Engineering, Class of 2009)&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to build on the past projects that have been seen on Youtube and other sites involving vibrating a metal plate using one speaker or violin bow. This project uses three speakers separated by 120 degrees which vibrate a circular plate to generate patterns with salt. These patterns are created because when the speakers hit the resonant frequency of the plate, nodes are created on the plate and the salt migrates to these nodes because they are vibrating the least. The project should also include a user interface which the user can use to select different patterns or frequencies for the plate.&lt;br /&gt;
&lt;br /&gt;
== Theory ==&lt;br /&gt;
=== Equations ===&lt;br /&gt;
As explained in the overview, the Chladni plate generates patterns when the frequency of the plate oscillation is at a resonant frequency for the plate. At resonance, the plate has portions where it has non-zero amplitude during oscillation, which is where the salt moves away from toward areas of zero amplitude. Areas of zero amplitude are called nodes or zeros of vibration, and salt collects at these regions on the plate at resonance. The nodes of vibration of a circular or square plate can be mathematically calculated for different modes of vibration.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation [[image:chladni_zeros_square_plate]] solves for the zeros of the standing wave for a square plate constrained at the center, such as the one we used for our one-speaker configuration. The variable L is the side length of the plate, m is the number of diametric nodes and n is the number of radial nodes. Solve for x and y for the zero locations.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The equation to find the zeros for a circular plate is [[image:chladni_zeros_circular_plate]]. The Jn(K*r) term is using the n-th order [http://en.wikipedia.org/wiki/Bessel_function Bessel function].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following equation is Chladni&amp;#039;s Law: [[image:chladnis_law]]. This equations relates the modes of vibration to the frequency of the modes for circular plates with a fixed center, similar to the one used by our three-speaker system except that our plate is fixed at three points away from the center. In the equation, C and p are defined based on the properties of the plate. For circular plates, p is approximately 2. The values of m and n are chosen based on the diametric and radial modes which can be determined by the shape of the salt on the plate, then converted to the frequency of the plate that made that shape.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
&lt;br /&gt;
The Chladni pattern generator setup is pretty straightforward.  There were three major areas of design we had to account for.  One was how to adapt the speakers to attach to the metal plate, the second was the speaker housing, and the third was the user interface/circuit box.  These are detailed with pictures below.  &lt;br /&gt;
&lt;br /&gt;
If you are trying to replicate this project, note that many of these specifications can change and still yield interesting, but different results.  Another thing to note is all the specifications are for our particular speakers.  Dimensions and materials can change according to what you&amp;#039;re working with and what is available.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
The parts and prices below are specific to the project we did.  However if you were to replicate this you can change many of the parts to suit different components.  We were fortunate to have most of the materials in supply so we could save money for the aluminum plate and electronics.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Part&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Part No.&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Vendor&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Price (Total)&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PYRAMID 8&amp;quot; Originals 300W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;WX85&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Lab&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AL 6061) .032&amp;quot; THICK, 36&amp;quot;X36&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;89015K71&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[http://www.mcmaster.com McMaster]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$53.23&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Wood stock&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~40&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polystyrene Sheets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;quot;X40&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;PVC tube 1.5&amp;quot; Dia&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~ 1 ft&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Polycarbonate sheet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~6&amp;quot;X6&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nuts, Bolts, Washers&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Foamcore&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2 Sheets 36&amp;quot;X28&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;EDC Supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;L Brackets&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;~20&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Shop supply&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breakdown of Components ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[image:chladni_speaker_cover|left|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker|left|Speaker box|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Adapting Speakers &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; First we cut away the dust-cap as pictured to the right  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Glued onto the diaphragm of the speaker and over the dustcap is a 2 inch long PVC pipe that covers the hole.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Over the PVC pipe we glued a 2&amp;quot; x 2&amp;quot; piece of polycarbonate.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We screwed a hole into the center of the polycarbonate and put in a screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The screw is fastened with nuts and washers.  The flexible aluminum plate will ultimately be attached to the speaker through this screw. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Speaker-boxes and Base &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Cut a hole into the top of the speaker box to seat the speaker.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We planned the base so that the speakers would be radially separated by 120 degrees and the centers of each speaker to create a 13&amp;quot; equilateral triangle with each other.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; We lined the bottoms of the speaker boxes and the base with Velcro for convenience and accessibility.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The speaker set up sits in a 32&amp;quot; x 32&amp;quot; foamcore box reinforced with L-brackets.  This is to catch the salt that spills off of the aluminum plate. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_3speaker_setup|left|Three-speaker setup|thumb|300px]]&lt;br /&gt;
[[image:chladni_speaker_bottom|left|Bottom of speaker box|thumb|300px]]&lt;br /&gt;
[[image:chladni_3speaker_base|left|Three-speaker wooden base with velcro|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; User Interface and Circuit Box &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; A simple box with a hinged top that can be made out of anything, we chose to use a black Polystyrene material that was available.  &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The user interface panel needs to have slots cut for the two power switches, and LCD screen, and a knob.  The laser printer and mill were both used to make these cutouts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_UI_box|left|User interface box|thumb|300px]]&lt;br /&gt;
[[image:chladni_UI_underside|left|Underside of cover|thumb|300px]]&lt;br /&gt;
[[image:chladni_la160_car_amp|left|Inside box with car amp|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_plate|Chladni plate made from aluminum|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Putting it Together &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; The last piece needed is a metal plate.  We cut down the 36&amp;quot; x 36&amp;quot; aluminum plate into a 28&amp;quot; diameter circular plate.    &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;gt; Pictured to the side is the complete set up.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
[[image:chladni_ad9833_adapter|AD9833 on adapter|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The primary components required to implement the circuit include:&lt;br /&gt;
&amp;lt;br&amp;gt;1) PIC 18F4520&lt;br /&gt;
&amp;lt;br&amp;gt;2) AD9833 BRMZ-ND Function Generator chip *&lt;br /&gt;
&amp;lt;br&amp;gt;3) LM 741 Op Amp (x3)&lt;br /&gt;
&amp;lt;br&amp;gt;4) JHD 162A Parallel LCD&lt;br /&gt;
&amp;lt;br&amp;gt;5) Car audio amplifier, at least 3-channel (Legacy LA160 4 Channel 300 Watt used here)&lt;br /&gt;
&lt;br /&gt;
Alternative components that are needed if car amplifier is not available:&lt;br /&gt;
&amp;lt;br&amp;gt;1) TDA 2040 audio amplifier chip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;*Note: The AD9833 is a surface mount chip, and needs a 10-pin adaptor, 33010CA-ND onto which it is soldered. A picture of this is shown on the right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Notes ===&lt;br /&gt;
&lt;br /&gt;
[[image:chladni_circuit_plugged|Circuit board with components plugged in|thumb|300px]]&lt;br /&gt;
[[image:chladni_circuit_unplugged|Circuit board with components un-plugged|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;The PIC communicates with the AD9833 function generator chip through SPI interface. Refer to [[Waveform_Generation_with_AD9833%2C_and_SPI|Waveform Generation with AD9833, and SPI]] for how to use this chip. The Master Clock is connected to the CLK of the PIC, and the three SPI communication lines are connected to the three I/O pins A1, A2 and A3 on the PIC. Through the code described below via SPI, information about the wave to be generated is transmitted and the function wave is generated accordingly.&lt;br /&gt;
A 10K potentiometer is used as input from the user in the form of a knob to set the frequency. It is connected to pin A0 of the PIC, and its use is described in detail under the Code section.&lt;br /&gt;
&lt;br /&gt;
The output of the AD9833 chip is connected to the non-inverting inputs of three LM741 Op Amps. These op-amps are not used to amplify the signal, but to serve as a unity gain buffer for the signals. They are connected to a +/- 12V power supply. This buffer essentially makes a copy of the input at the output, without drawing any current from the source of the input, i.e., the function generator chip, which gets its power from the PIC supply. Instead, the output signal draws power from the op-amp itself. The goal is to ensure that doing the measurement of a voltage does not disturb the circuit producing the voltage to be measured.&lt;br /&gt;
&lt;br /&gt;
The outputs of the op-amps are then connected to the car amplifier using standard RCA input cables. The car amplifier, which is connected to a 12V supply, amplifies the signal to audible amplitudes and the outputs are connected to the three speakers. The speakers draw power from the car amplifier.&lt;br /&gt;
&lt;br /&gt;
The D0-D6 outputs of the PIC are connected to the Parallel LCD. To learn more about how to get the LCD working, refer to [[C_Example:_Parallel_Interfacing_with_LCDs|C Example: Parallel Interfacing with LCDs]]. The LCD is made to display the target frequency that the user inputs using the knob (which is on the potentiometer), and also the value of the frequency of the wave that is being generated at the moment.&lt;br /&gt;
&lt;br /&gt;
For easier and more convenient use, sockets were made for header pins from the power supplies, potentiometer, RCA input cables and the parallel LCD. This way, the components can be plugged in and out easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Circuit Diagram ===&lt;br /&gt;
[[image:chladni_circuit_actual|Circuit schematic of circuit used for demonstration 3-speaker Chladni|thumb|600px]]&lt;br /&gt;
[[image:tda2040_circuit|TDA-2040 Audio Amp Circuit[http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1460.pdf&amp;#039;]|thumb|300px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NEED TO INCLUDE STUFF ABOUT&lt;br /&gt;
- WARNING ABOUT HOW DELICATE THE AD9833 CHIP IS&lt;br /&gt;
- USE OF MORE THAN ONE AD9833&lt;br /&gt;
- AUDIO AMP CIRCUITS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
=== Main frequency sweep code ===&lt;br /&gt;
[[media:chladni_code.c|Full code here]]&lt;br /&gt;
&lt;br /&gt;
The first thing that this code does is that it initializes the variables target_freq_reg and old_target_freq_reg to the register value of 298 Hz, which is a non-resonant frequency. See [[Waveform_Generation_with_AD9833,_and_SPI]] to find out how to convert between frequency and register value for commands sent to the AD9833 function generator chip, and sending commands to the AD9833 using SPI.&lt;br /&gt;
After this, the analog port pin is set up and the lcd_init() function is called to set up the LCD display. The LCD displays the current frequency that the AD9833 is currently outputting and the target frequency that the chip is supposed to sweep up/down to. See [[C Example: Parallel Interfacing with LCDs]] to learn about how to interface and send information to the LCD.&lt;br /&gt;
&lt;br /&gt;
Once the initial set up information is finished, the code sends the first frequency command to the AD9833, starting it at a frequency of 298 Hz by giving it the target_freq_reg register value (initialized at 298 Hz). This allows the speakers to sweep up to the first resonant frequency and oscillate the salt into the first resonant shape when the system is turned on. The register values are then converted to Hz and displayed on the LCD. From there, the code goes into a while() loop which continuously checks the input from the user interface knob which indicates the target frequency that the AD9833 should go to. After getting the target frequency from check_input(), the code compares this new frequency information to the old frequency information (old_freq_reg). If they are different, then the knob was switched to a new frequency and the AD9833 needs to sweep up or down to the new frequency. Depending on whether the new frequency is above or below the old frequency, a for-loop will keep sending new frequency register commands to the AD9833, shifting up or down by 1 Hz every 100 ms, constantly updating the LCD to display the current and target frequency, until the actual frequency is equal to the target frequency. The function check_input() is called for each iteration of the for-loop to check if the target frequency was changed. The old_target_freq_reg is then set equal to the target_freq_reg and the program then holds at this one resonant frequency until the knob sends a different target_freq_reg.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Chladni Code&lt;br /&gt;
Lingyu Xie, Anup Tapase, Chris Chow&lt;br /&gt;
ME333 Winter 2009&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;18f4520.h&amp;gt;&lt;br /&gt;
#DEVICE ADC=8                   // set ADC to 8 bit accuracy&lt;br /&gt;
#use delay(clock=40000000)&lt;br /&gt;
#include &amp;quot;flex_lcd.c&amp;quot;             //must include in order to output to LCD&lt;br /&gt;
#use spi(DO = PIN_A3, CLK = PIN_A2, ENABLE = PIN_A1, BITS = 16, MASTER, ENABLE_ACTIVE = 0, MSB_FIRST, IDLE = 1)&lt;br /&gt;
&lt;br /&gt;
int16 freq,target_freq;&lt;br /&gt;
int16 target_freq_reg, old_target_freq_reg;&lt;br /&gt;
int8 knob_val=0;&lt;br /&gt;
&lt;br /&gt;
void check_input();&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   int16 ct;&lt;br /&gt;
   &lt;br /&gt;
   target_freq_reg=2000+16384;         // initialize starting frequency of speakers to 298 Hz (non-resonant)&lt;br /&gt;
   old_target_freq_reg=2000+16384;     // set old target freq variable to equal target freq&lt;br /&gt;
&lt;br /&gt;
   setup_adc_ports(AN0);               // Set up analog input port as pin A0&lt;br /&gt;
   setup_adc(ADC_CLOCK_INTERNAL);&lt;br /&gt;
   &lt;br /&gt;
   lcd_init();  // Always call this first.&lt;br /&gt;
   &lt;br /&gt;
   //INITIAL FREQUENCY FOR AD9833&lt;br /&gt;
   spi_xfer(0b0010000100000000); //format command, output sine wave&lt;br /&gt;
               &lt;br /&gt;
   spi_xfer(target_freq_reg);    //1st set of bits, 14 LSB, this range is good enough for our use&lt;br /&gt;
                                 //send the target frequency register value (freq + 16384) to AD9833 chip&lt;br /&gt;
   spi_xfer(0b0100000000000000); //2nd set of bits, 14 MSB&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b1100000000000000); //phase register: 0 phase shift (B0-B13)&lt;br /&gt;
   &lt;br /&gt;
   spi_xfer(0b0000000000000000); //unformat&lt;br /&gt;
   &lt;br /&gt;
   freq=(float).149011 * (float)(target_freq_reg - 16384);  //convert the target freq register value to actual freq value&lt;br /&gt;
   target_freq=freq; // initialize target freq as current freq&lt;br /&gt;
&lt;br /&gt;
   printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
   printf(lcd_putc,&amp;quot;Target: %Lu H\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
   &lt;br /&gt;
   while(TRUE)&lt;br /&gt;
   {&lt;br /&gt;
      check_input(); //check the knob input to see if target frequency has changed&lt;br /&gt;
      &lt;br /&gt;
      if(old_target_freq_reg != target_freq_reg) //go in here if target freq changed after calling check_input()&lt;br /&gt;
      {&lt;br /&gt;
         if(target_freq_reg &amp;gt; old_target_freq_reg) //sweep up to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;lt;=target_freq_reg; ct=ct+7) //ct+7 approximate increases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping up by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384);&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384);&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
               &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
               &lt;br /&gt;
         }&lt;br /&gt;
         else if(target_freq_reg &amp;lt; old_target_freq_reg) //sweep down to target freq&lt;br /&gt;
         {&lt;br /&gt;
            for(ct=old_target_freq_reg; ct&amp;gt;=target_freq_reg; ct=ct-7) //ct+7 approximate decreases frequency by 1 Hz&lt;br /&gt;
            {&lt;br /&gt;
               spi_xfer(0b0010000100000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(ct); //set AD9833 frequency to ct, which is freq register that is sweeping down by 7 each time loop is run&lt;br /&gt;
               spi_xfer(0b0100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b1100000000000000);&lt;br /&gt;
               &lt;br /&gt;
               spi_xfer(0b0000000000000000);&lt;br /&gt;
               &lt;br /&gt;
               &lt;br /&gt;
               freq=(float).149011 * (float)(ct - 16384); //convert current freq register value (ct) to frequency value&lt;br /&gt;
               target_freq=(float).149011 * (float)(target_freq_reg - 16384); //convert target freq register to target freq value&lt;br /&gt;
         &lt;br /&gt;
               printf(lcd_putc,&amp;quot;\fFreq: %Lu Hz\n&amp;quot;,freq); //display current freq&lt;br /&gt;
               printf(lcd_putc,&amp;quot;Target: %Lu Hz\n&amp;quot;,target_freq); //display target freq&lt;br /&gt;
               &lt;br /&gt;
               check_input(); //see if knob position has selected different target freq&lt;br /&gt;
               delay_ms(90);  //delay to allow speakers to play freq for 90 ms + 10 ms (in check_input() function)&lt;br /&gt;
            }&lt;br /&gt;
   &lt;br /&gt;
            old_target_freq_reg = target_freq_reg; //reached target freq, set both variables equal until knob position changed&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking user input ===&lt;br /&gt;
This function is used to check the knob/potentiometer position at certain points during the changing of frequencies in the main function. It sets the ADC channel to 0 and takes the analog input from pin A0 on the PIC using read_adc(). This input, set to the variable knob_val, is an integer between 0-255 which corresponds to the voltage coming out of the knob/potentiometer, which is 0 if the output is at 0V and 255 if the output is at 5V. By checking if knob_val is between a certain integer range corresponding to the different numbers on the knob (numbered 0-10), the target frequency can be set by the user. Nine target resonant frequencies were programmed in this function based on the good clarity of the shapes they produced on the plate, but more resonant frequencies exist and can be added to the if-statement in this function. The target frequency registers should be adjusted depending on the plate shape and size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void check_input() //check knob position to see if target freq has changed&lt;br /&gt;
{      &lt;br /&gt;
      set_adc_channel(0);     // Set the analog input channel to 0&lt;br /&gt;
      delay_us(10);           // wait 10uS for ADC to settle to a newly selected input&lt;br /&gt;
      knob_val = read_adc();  // Read in knob user input to tell speakers what resonant freq to sweep up to&lt;br /&gt;
      &lt;br /&gt;
      delay_ms(10);           // delay 10 ms to allow reading of analog input&lt;br /&gt;
      &lt;br /&gt;
      //check and set target_freq_reg according to knob position (0-255 values split into 9 discrete levels)&lt;br /&gt;
      if (knob_val &amp;gt;= 0 &amp;amp;&amp;amp; knob_val&amp;lt; 22 )&lt;br /&gt;
         target_freq_reg = 2281+16384; //339 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 22 &amp;amp;&amp;amp; knob_val&amp;lt; 54)&lt;br /&gt;
         target_freq_reg = 3308+16384; //493 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 54 &amp;amp;&amp;amp; knob_val&amp;lt; 86)&lt;br /&gt;
         target_freq_reg = 3778+16384; //563 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 86 &amp;amp;&amp;amp; knob_val&amp;lt; 117)&lt;br /&gt;
         target_freq_reg = 3986+16384; //594 Hz&lt;br /&gt;
      else if(knob_val &amp;gt;= 117 &amp;amp;&amp;amp; knob_val&amp;lt; 147)&lt;br /&gt;
         target_freq_reg = 4207+16384; //627 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 147 &amp;amp;&amp;amp; knob_val&amp;lt; 178)&lt;br /&gt;
         target_freq_reg = 4362+16384; //650 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 178 &amp;amp;&amp;amp; knob_val&amp;lt; 209)&lt;br /&gt;
         target_freq_reg = 5006+16384; //746 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 209 &amp;amp;&amp;amp; knob_val&amp;lt; 239)&lt;br /&gt;
         target_freq_reg = 5308+16384; //791 Hz &lt;br /&gt;
      else if(knob_val &amp;gt;= 239 &amp;amp;&amp;amp; knob_val&amp;lt; 255)&lt;br /&gt;
         target_freq_reg = 5872+16384; //875 Hz &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Three-Speaker Chladni===&lt;br /&gt;
The following images show the results of the Three-Speaker Chladni system at six different resonant frequencies. Some of these frequencies have clearer patterns than others, such as 424 Hz, 554 Hz, and 660 Hz. The less-clear ones might be due to imperfections in the plate or the speakers not hitting the exact resonant frequency. Some frequencies shown in these results are different than the ones in the code displayed above. The ones displayed below were chosen for their clarity and contrast from each other because some frequencies in the displayed code do not shift in pattern as much.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_339hz|Three-Speaker Configuration at 339 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 339 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_424hz|Three-Speaker Configuration at 424 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 424 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_554hz|Three-Speaker Configuration at 554 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 554 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_632hz|Three-Speaker Configuration at 632 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 632 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_660hz|Three-Speaker Configuration at 660 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 660 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:chladni_734hz|Three-Speaker Configuration at 734 Hz|300px]]&amp;lt;br&amp;gt;Three-Speaker Configuration at 734 Hz&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== One-Speaker Chladni ===&lt;br /&gt;
-add video of one-speaker config&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
-Try sending different frequencies (by figuring out how to program multiple AD9833 chips) to each speaker to see if they generate different patterns&lt;br /&gt;
&amp;lt;br&amp;gt;-Use different plate size or add 4th speaker and use large square plate to change the types of visible shapes at resonance&lt;br /&gt;
&amp;lt;br&amp;gt;-Figure out issue with TDA-2040 audio amp so the project wouldn&amp;#039;t have to rely on car audio amp&lt;br /&gt;
&amp;lt;br&amp;gt;-Use more rigid plate or construct one with less defects in shape&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[http://local.wasp.uwa.edu.au/~pbourke/geometry/chladni/ Chladni Plate Mathematics]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Chladni&amp;#039;s_law Chladni&amp;#039;s Law]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.phy.davidson.edu/StuHome/derekk/Chladni/pages/menu.htm A study of vibrating plates]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Chladni_speaker_cover&amp;diff=11703</id>
		<title>File:Chladni speaker cover</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Chladni_speaker_cover&amp;diff=11703"/>
		<updated>2009-03-19T03:40:02Z</updated>

		<summary type="html">&lt;p&gt;Lingyu Xie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingyu Xie</name></author>
	</entry>
</feed>