Introduction: Delay Line Memory With a Slinky
The first thing you may be curious about is what is a delay line memory? It is a very early method of storing information in computers that exploits the time it takes a wave to propagate from a transmitter to a receiver. Many of the early ones were filled with mercury and were later replaced by a torsion wire. These could store a few thousand bits of memory. With both of these technologies it is hard to visualize what is going on so we will be building one with the most common toy used to demonstrate wave phenomenon, a Slinky. Slinkys also have the added bonus of not being toxic like mercury. This tutorial will focus on not only constructing a simple 2-bit delay line memory but also explaining the technical challenges of constructing one. Those of you who are tenacious will likely be able to expand this to store even more but I highly suggest getting 2 bits working first.
- Through hole soldering (To assemble the relay shield for Arduino)
- Basic electronics (resistor networks, powering LEDs, connecting wires together)
- Basic C programming with Arduino (there are many wonderful tutorials online)
- Some mechanical aptitude including knot tying and affixing things with zip ties
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
- A slinky (I used an “Original Giant Slinky” but there are many brands and types that could work. The metal ones tend to be the best at transmitting waves but if you can’t find one then a plastic slinky may be sufficient)
- 4 large clamps (I found F-clamps to work nicely)
- 2 panels to tie things to (I used a wire shelving piece but peg board would also work)
- 1 large solenoid (sparkfun.com sells these https://www.sparkfun.com/products/10391 , if you use a different one make sure to size your power supply accordingly)
- photo-interrupt, I built one of these but you could easily substitute a pre built module(such as https://www.sparkfun.com/products/9299). Parts are listed below
led emitter and photo resistor (https://www.sparkfun.com/products/241)
10 k ohm resistor
330 ohm resistor X2
Indicator LED (optional)
Power supply, I highly recommend an adjustable current limiting bench supply. However a 12V computer power supply or even a 12V car battery would work here, just make sure it can supply at least an amp and a half. (This is to power the solenoid which is not particularly voltage sensitive so anything below 36 volts will work if you use the same solenoid I did)
Relay shield for Arduino (https://www.sparkfun.com/products/12093 )
Stack of textbooks (for weighting ends and holding sensor in position)
Zip ties (the small wire tie sized ones work great)
Blue tape (usually sold for painting but great for taping to things you don't want to damage)
Mason twine (Or really any small diameter rope or string as long as you can tie a reasonable taut-line on it)
A section of carpet at least 10 ft long to work on (the carpet helps dampen unwanted oscillations)
Step 2: Assembling the Slinky Support Structure
The purpose of this section is to explain the mechanical assembly of the support structure for the slinky. The overall goal here is to have two ends that are anchored well enough that they do not move during normal operation of the device. Also as you will see at the end it gives a convenient way to compress the slinky without removing it from the rigging.
The first step is to put the two clamps at the bottom corners of the panel in such a way that it can be leaned back slightly onto the extended ends as shown in the first photo. If your clamps don’t have rubber pads you may want to use some cardboard to pad it to hold onto the wire better. Assemble two of these.
Step 3: Affixing the Slinky
The second step is to affix the first end of the slinky to the bottom part of the panel using zip ties. This may need some adjustment up or down later but about 1/2 to 1 inch above the floor is a good starting place. This is also a good time to use a pair of textbooks to weight down the clamps.
Affixing the other end is more challenging since you need to dampen such that waves are not reflected. This step should be done more or less concurrently with the 4th step due to their interdependence.
Physics side note:
The original mercury delay line memory had to control reflections very carefully. The original system is set up such that there are two transducers on either side of a tube, as waves propagate down it is important that they are not reflected significantly since this can cause data corruption. In fact the reason they used mercury instead of something cheaper (and less toxic) is because the acoustic impedance matched the transducers very closely.
Continuing with the description of setting up the other end the main goal here is to attach it in such a way that it minimizes reflections. The reflection video shows what happens if you just zip-tie it like the first side. You will quickly see why this is such a problem since a lack of dampening at the end will make your slinky wiggle way too much to detect any meaningful information at the end. As you build the end dampener pluck the fixed end of the slinky and watch the wave reflect off the end, your goal is to minimize this reflection as much as possible.
The end piece affix to the top of the other end of the slinky via mason’s twine and the bottom with a piece of thread that extends to text books a foot or two beyond the end. In addition I found it necessary to build a dampener that consists of a piece of thread tied to either side of the slinky and looped around so it suspends a small weight. I used a bolt here but anything of similar mass will work. Below you can see my many attempts at alternative weights. This is a good place to experiment with the materials available to you.
Step 4: The Suspension Line
This is a piece of mason’s twine that extends from the top of one panel to the top of the other directly over the slinky with loops to suspend it. This serves a twofold purpose, the first is to allow the slinky to auto center as waves propagate and the second is to precisely control its height. Later on you will find that placing it so the bottom is just resting on the carpet is an easy way to adjust how much waves are dampened.
The taut-line hitch will be used extensively in this section due to its adjustability (http://en.wikipedia.org/wiki/Taut-line_hitch).
To install the suspension line itself run a length of twine between the tops of the panels and give your self an extra 3 ft. of line to tie a taut-line on either side. The taut-line is incredibly useful here; grabbing and sliding the knot can quickly adjust the length and tension.
After the suspension line is run affix loops around the line and the top of the slinky down the entire length. These should be placed every 6 to 8 inches or enough to keep the slinky from touching the floor when they are tightened. Again these should be tied with the taut-line knot mentioned earlier to allow precise adjustment of height.
Step 5: The Solenoid
The solenoid is the component that actually makes the waves in the slinky. The one I linked has a nice pair of holes to zip tie it in place, however the actuator itself has nothing but a plastic nub to affix anything to. A zip tie around the plastic end creates a nice pushing surface that can be in turn zip tied to the slinky.
Once this is done you will be able to connect your relay to the power source for a fraction of a second and it will send a wave down the length of the slinky. If you have trouble keeping the zip tie in place you may be able to use some hot glue to hold it in place but I did not find it necessary.
Step 6: Notes on Assembling the "Brains"
The more astute reader will notice at this point that we are using an Arduino, which has vastly more memory than the device we are trying to create. However it is important to note that all of the electronics for this system could be built using a very limited subset of components without a micro controller. Since building and debugging such circuitry is much harder than operating an Arduino this tutorial opts for the simpler solution which is vastly easier to debug.
This circuitry consists of a photo-interrupt and a relay. While the memory is storing information waves will propagate toward the end of the slinky where they will be read, shaped, amplified, and re transmitted at the beginning of the slinky. This corresponds to the transducer, pulse shaper, amplifier, and second transducer in the mercury delay line version. The photo interrupt will be how the waves are detected at the end. The relay will be used to switch the solenoid to create new waves at the beginning again. An indicator LED is also added to aid in seeing the state of the system with relation to the location of waves on the slinky.
Assembling the relay board is covered nicely in the instructions for the relay board on SparkFun’s web page. If this relay board is not available at some point in the future simply look for “power switching circuit for Arduino” and many alternatives will come up. All this needs to be able to do is turn on and off quickly enough to trigger the solenoid.
Step 7: Assembling the Photo Interrupt
The photo-interrupt is a circuit designed to detect when something passes between the infrared LED and the photo resistor. The emitter side is an always-on infrared led. The detector side is a voltage divider between a fixed 10K ohm resistor and a photo-resistor (marked by the red dot in the pair I linked), which scales the output into the desired range. I found mine outputs about 3.5 volts when triggered. This can be adjusted to trigger a digital pin but since we are not using much on the Arduino we may as well plug it into an analog input and adjust it in software.
Assemble this circuit on the breadboard, be sure that the photo resistor and infrared LED are pointing at each other and relatively close as pictured below. For both these devices the long lead is the positive side and the short is the negative. Since this circuit draws very little power you can use the 5V pin and ground on your Arduino to power it.
This is also a convenient place to put an indicator LED, which I assembled on the other side of the board with the second 330-ohm resistor and a wire to one of the digital IO pins on the Arduino.
Step 8: Testing the Photo Interrupt
I suggest testing the photo-interrupt by writing a simple loop in the Arduino to read the analog pin and print the value to the terminal; you should notice that the value goes up significantly when an object is in the sensor. The code listing below is slightly modified from the Arduino examples.
int analogPin = 5;
int val = 0;
val = analogRead(analogPin);
Step 9: Setting Up the Flag for the Photo Interrupt
In order to detect a wave on the slinky we need something to actually move into our sensor. For this we use a piece of tape and a piece of a zip tie. I found it easiest to just take a clipped end of one of the zip ties and tape it using blue tape to a coil of the slinky. Pictured, I have put a single piece of electrical tape in the middle and a longer trimmed piece on the bottom to smooth it out.
At this point you should be able to put the photo-interrupt on top of a textbook and have it be the perfect height to detect the slinky being slightly offset. I used two small guide wires to hold the extended end in place so it swings smoothly through the sensor. Be careful to not connect anything that shouldn’t be connected with these, they are there to guide the flag only.
Step 10: Connect the Power
The final construction step is to connect the relay to the power supply and the solenoid. If you notice there are three places to connect to this board, N.C., N.O., and common. We will use the N.O., which stands for “normally open”, and the Common. When the relay is activated these two are connected. Connect two long wires to these and run one to the positive on the power supply and the other to one of the solenoid leads. Finally connect a wire from the negative to the remaining solenoid lead.
Step 11: Testing, Tuning, and Timing
At this point you should have enough assembled that you can load the “GetVelocity” sketch onto your Arduino. This will trigger the solenoid for 40 milliseconds when the flag is detected. It will then rest for an extra 160 milliseconds, which ensures we create a nice consistent wave every time. If we simply triggered the solenoid when the flag is detected we would have a similar feedback loop to a poorly tuned public announcement system.
Step 12: System Tuning
To tune the system take the photo interrupt away from the flag and simply trigger it by moving your finger into it. This will send a single wave down the slinky. Your goal is to get the wave all the way from the solenoid to the flag without letting it reflect off the end.
If things appear to be too wiggly then adjust the suspension loops to gently rest the bottom of the slinky on the carpet. It can also be helpful to move the flag back from the end of the slinky, however don’t move it too far back or the wave won’t take long enough to travel down the length. Your wave should take at least half a second from when the solenoid triggers until it reaches the end. If it takes less than 1/5 of a second then the next step won’t work. Once you are satisfied with your wave move the photo-interrupt back into place.
At this point you should be able to move a piece of tape into the photo-interrupt and trigger a single wave. This wave should travel down the slinky moving the flag into the photo sensor again triggering another wave. Make sure that your system can happily circulate a wave before continuing. I found mine to be able to continuously circulate a single wave for over 5 minutes after which I got tired of waiting.
Step 13: Timing
While the wave is circulating go into the tools menu of the Arduino IDE and click on “serial monitor”. This will bring up a window that displays the serial output of the Arduino. Every time it triggers with the GetVelocity sketch it will print out the time since the last trigger. This gives you a precise measurement of the time it takes a wave to travel down your slinky. Watch this and get a mental estimate of the usual time it takes, it should not vary more than about 20 milliseconds on either side. If it does go back to the tuning steps. Mine consistently takes between 590 and 610 milliseconds.
Step 14: Configuring the Memory and Running
At this point you are ready for
the memory sketch. At the core this has the same functionality as the GetVelocity script. This script has four modes: WRITE, STORE, RECALL, DONE.
It starts in the WRITE mode where it waits for user input, as mentioned before this system is designed to store 2 bits meaning it can store 4 values.
Input consists of the numerical value (0, 1, 2, or 3) which can be entered in the serial monitor.
Once the value has been entered the solenoid will transmit the information. For example a 2 will cause it to delay half the propagation time and then pulse. A 3 will cause it to pulse wait then pulse again. A zero will make it do nothing. Finally it transitions into STORE.
In the STORE mode it will do exactly what you previously observed in the GetVelocity script only now it is keeping track of time to know where the bits are. After 10 cycles it will transition into the read state.
In the READ state it will start by waiting half the propagation time, if the sensor is triggered in this time it will set the first bit. Then it will wait half the propagation time again and set the second bit if the sensor is triggered. It will then write the two bits to the serial monitor and transition into the DONE state.
The DONE state does nothing except blink the LED, to run again reset the Arduino.
Videos of my build storing all 4 values are attached.
If you find this fun to build please pass the knowledge on and by all means try to improve it. This project certainly gave me an incredible respect for the hard working men and women who spent late nights punching holes in cards and removing moths from relays to develop the technology we use every day.
Step 15: A Note on Storage
The setup above can be conveniently stored by moving the two panels together clamps and all until the slinky is fully compressed to prevent damage from prolonged extension. By pulling the end of the suspension line as you bring them together you can slide the loops together and put a book on it to support the slinky in its natural position. To extend, grab the suspension line and slowly release as you move the panels apart. Storing it like this will also prevent annoying slinky-string tangles.