Introduction: Hard Drive Persistence of Vision (HDPOV)
The system works by timing the slot in the platter. The Arduino uses an internal timer to clock each revolution. It achieves this using an infrared gate, which triggers a hardware interrupt on every full revolution of the platter. The Arduino uses the revolution time and phase to schedule a second internal timer. This second timer uses an interrupt to schedule the timing of the LEDs, firing tens of thousands times a second to build a stable, visible image.
This work is based on Ian Smith's version of the same. His work is excellent, and his website on this topic will help provide a complete picture for this instructable.
Step 1: Gather Materials
Hard Drives - You will need to gather a few unused hard drives. It's no problem if they no longer function, but it's imperative that the candidate hard drive can spin indefinitely when it's powered.
Arduino - If you don't have an Arduino board, this link will show you where you can buy one. I developed this with a Diecimila, but I would expect the code to work on a Duemilanove without changes.
ULN2803A - This is responsible for switching the high current 12V LEDs.
RGB LED Tape - The best source I've found for tricolor LED tape is from Super Bright LEDs. A single 19.5" strip costs $19.95.
Super Bright LEDs: NFLS-RGB15
270 Ohm Resistor - Limits current to your sensor source.
10K Resistor - Pull-up for your sensor output.
You can build the platter sensor from either an infrared gate or a Hall-effect sensor. The infrared gate uses the slot cut out of the platter to disrupt the beam. The Hall-effect sensor will require that you glue a small but strong magnet exactly 180 degrees from the slot in the platter.
If you decide to use an infrared gate, you can either build your own gate from scratch or you can buy a manufactured gate. If you choose to build your own, you can use any old pair of infrared emitter/phototransistors (mine are from Radio Shack), or you can purchase the following:
Infrared Emitter - Used to provide an infrared beam to time the platter.
Infrared Phototransistor - Provides a pulse on every platter revolution.
I did not build my rig with a Hall-effect sensor. I chose to use infrared because I had the parts lying around, but a Hall-effect sensor is less obtrusive. If you choose to go the Hall-effect route, you will need to adjust a few details in this tutorial. For example, you will need to glue a magnet directly opposite of the slot. This will require changing the code loaded onto the Arduino to account for the 180 degree change in phase.
I have not tested this Hall-effect sensor, but I would expect it to work fine:
Hall-Effect Sensor - Provides a pulse on every platter revolution.
Step 2: Deconstruct a Few Hard Drives
You will be destroying any hard drive you open. If you still intend to store or access data on a drive, it's a bad idea for this instructable.
Not all hard drives are alike, but they are remarkably similar. From brand to brand, they often have mechanically interchangeable parts such as platters, spacers, retaining collars and screws. In order to build my version, I had to take apart five hard drives to achieve the right configuration of parts and hard drive chassis.
The motor that spins the platter is known as the spindle. Most hard drive spindles are three terminal brushless motors. Driving this kind of motor is beyond the scope of this tutorial. To our advantage, most logic boards for hard drives will spin their spindle indefinitely.
Select a hard drive, and open the top case. Opening a hard drive requires a set of Torx screwdrivers. If you don't have any, you can pick up a set at any well stocked hardware store. Once you remove the top case, remove the entire read/write assembly. Be careful not to damage the underlying logic board, as it is required to drive the spindle.
Remove the platter retaining collar, and remove the platter stack. Make sure you save the collar, its screws, any spacers and any platters.
Here are a few important issues to be aware of as you proceed to select your candidate drive:
- The clearing of the platter over the LEDs is critical, and there is a very small space to fit them in. Once the LEDs are glued to the wall of the platter chamber, the platter must be able to freely spin. This means no part of the LEDs or its ribbon backing can touch the platter. It's important to test this before gluing anything to anything.
- The LEDs are too tall to hide below the first platter. The solution is to use a combination of spacers from various hard drive manufacturers to shim a single platter above the LEDs. This can be very tricky to achieve, and may have you tearing apart working computers in sacrifice to the cause.
- Once you have all of the above figured out, make sure you test the spindle driver! Screw it together (without the LEDs) and plug it in. Make sure the drive spins continuously! I had the perfect drive that would only spin for about a minute before quitting. I suspect it found the lack of a read/write head unsettling, and decided rest was best. The point is you don't want to carry out the remainder of this instructable with a drive that won't continuously spin for you.
Step 3: Cut Out Paper Platter
Most hard drives are finished with a black matte. It is not a conducive background for our LEDs, so we need to make a more reflective backdrop.
Grab a piece of thick, white paper and trace the outline of a platter (both the inside and outside). Cut out your paper platter, and widen the central hole a few millimeters. Slip this over the spindle, and push it down to the floor of the platter chamber. You might need to trim the paper a little so it doesn't rip. This will serve as a white, reflective backing, making the color in your LEDs shine more vibrantly.
Once the backdrop is positioned, make sure the spindle can still spin freely. If it can't, trim the center hole of your backdrop.
Step 4: Build LED Bridges
The gap created by the read/write head assembly will not allow us to fully encircle the platter with LED tape. In order to bridge the gap, you need two build two bridges. I made mine out of half-inch thick wood, but any material should work. It just needs to have a smooth surface, half an inch thick.
If you are building the bridges out of wood, you will want to use a band saw. The pictures will help guide you.
Using a platter as a template, mark out a half-circle from your material. Make sure there is ample material around your half-circle. Cut out your half-circle, and toss it. Use the remaining outline to build the bridge from.
Line up your circle outline with the platter chamber. Mark off extra material, and trim it. This might take a few iterations to get right. You should be left with a roughly 1" thin, 3.5" wide U-shape. Once you have this shape, measure the center, and mark half an inch on either side. Remove this center.
You now should have two curved pieces. Test fit them on either side of the chamber gap. You might find that knobby features of the chassis require further refining of a certain bridge. Continue to cut away material until they you have a snug fit. The chamber wall should be flush with your bridges, or the LEDs will mount askew. Make sure the platter can spin freely with the bridges in position, shaving down any excess material.
Grab some strong, quick setting glue and glue each bridge to their position. Make sure to hold the bridge down until the glue sets.
Step 5: Cut the LED Tape
In order to achieve the best effect, you will want to fully encircle the underneath of the platter with the LED tape. If you are using a standard 3.5" drive, then your platter chamber with bridges should accommodate nine LEDs.
The LED tape can be separated into groups of three. Cut out one section of three groups. Do not separate the tape into three groups. You want one piece of tape with nine LEDs. This should leave a reasonable gap for the platter sensor, where the read/write assembly used to sit. Make sure you cut the tape on the line between copper tabs, or else you may severe internal traces rendering the affected section useless.
Step 6: Solder Wires to the LED Tape
If you don't have wires pre-attached to the section you wish to use, you will need to solder on wires. Identify the red, green, blue and 12V lines, and solder four wires to the copper tabs. It's best if you tin the copper pads before soldering the wires. After you attach your wires, be mindful of the stress you apply to the solder joints, they can easily break. Test your work using a 12V supply.
Step 7: Glue the LED Tape in Place
When affixing the LEDs, you shouldn't trust the sticker backing provided by the manufacturer. It just isn't strong enough. Get some super glue, and slowly glue the strip to the chamber wall, pressing firmly as you proceed. It's imperative the LEDs are affixed as straight and flush as possible, so work slowly and carefully.
Step 8: Cut Slot in Platter
In order to cut the platter, you will need either a fine-toothed band saw or a dremel with a cutting wheel. Make sure to wear gloves and goggles, as the platter may shatter. It doesn't matter where you cut your slot, but make sure it is as perpendicular to the tangent of the point you picked. Make the cut as straight and narrow as possible. Begin the cut from the outside of the platter, traveling inwards. You may choose to cut all the way through, or leave a little material for stability. I cut mine all the way through without any issue.
Step 9: Build the Rotational Sensor Rig
The rotational sensor rig is a "U" shaped block that holds the infrared emitter and photo-transistor in place. I made mine out of wood, but any material should work fine.
My measurements are based on my hard drive chassis. Make sure to measure your platter height with respect to the floor of the chassis. Use a piece of paper, and mark the platter height with a pen. This way, you can accurately measure with a ruler.
The platter in my rig is 1/2" above the chassis. The design of my sensor rig is based on this height. Adjust as neccessary.
Grab a piece of 1/2" thick wood, and cut out a 1" by 1-1/2" rectangle. Cut out a notch from one side, 3/4" deep and 1/4" from the top and bottom. Mark a point on the top a 1/4" from the side and front. Use this point to drill a 3/16" diameter hole through the entire block. A drill press will keep the hole straight through both sections.
Once you have finished making the rig, test fit it within the chassis, making sure the platter can spin freely. Push the emitter and photo-transistor into either hole, and test fit the rig in the chassis again. Make sure the platter can spin freely. Once you are happy with your rig, proceed to glue the emitter and photo-transistor in place.
Step 10: Wire the Rotational Sensor
Be sure to keep track of the emitter versus the photo-transistor. The emitter is typically darkly shaded while the photo-transistor is clear.
Cut four equal lengths of wire, roughly a foot and a half in length. Two of the wires should be black, while the other two should be two different colors other than black (like red and yellow).
Solder a black wire to the anode lead of the emitter. The anode is the shorter of the two leads, while the cathode is the longer. Using your second black wire, do the same for the photo-transistor. Solder the third wire (red in my picture) to the cathode of the emitter. Solder the fourth wire (yellow in my picture) to the cathode of the photo-transistor.
Once you have your wires soldered on, use heat shrink or electrical tape to shield and protect the exposed leads.
Cut your ground wires close to the body of the sensor, leaving a few inches of wire from either lead. Strip about an inch of insulation from each ground wire, and tie them together. Use a third piece of black wire, and tie it to the same junction. Solder the junction, and insulate.
You should be left with three wires, which you can wrap together for stability.
Step 11: Mount the Rotational Sensor
Once you have your sensor ready and wired, test its position before you glue it to the hard drive chassis. An oscilloscope is ideal for this, but a volt meter can work just as well. You want to make sure that the sensor position provides a high fidelity signal when its index (slot or magnet) passes by. Once you are happy with its placement, tack it down with some strong glue, making sure to hold in place until the glue sets.
Step 12: Build Breakout Board
The breakout board is responsible for connecting the Arduino to the hard drive electronics. Use the schematic to guide your wiring. The labels for the various connections on the schematic are somewhat terse. Here is how to decode it:
D3 - Wire to Digital Pin 3 on the Arduino
D4 - Wire to Digital Pin 4 on the Arduino
D5 - Wire to Digital Pin 5 on the Arduino
GND - Wire to GND Pin on the Arduino
5V - Wire to 5V Pin on the Arduino
SOUT - (Sensor Out) Wire to Digital Pin 2 on the Arduino
12V - Wire to 12V supply
GND - Wire to ground of 12V supply
RED - Wire to red wire of LED tape
GRN - Wire to green wire of LED tape
BLU - Wire to blue wire of LED tape
12V - Wire to common wire of LED tape
GND - Wire to ground wires of platter sensor
SPWR - Wire to supply of platter sensor
SOUT - Wire to output of platter sensor
Step 13: Upload Firmware to Arduino
The Arduino sketch is provided below. Download the code, and compile it in your local Arduino environment. The code for the firmware is heavily commented, which should make it easy to hack.
Step 14: Serial Command and Python Extras
The firmware, as-is, only provides a few built-in visuals. In order to get more visuals, you either need to hack the firmware, or you need to communicate with the firmware via its serial protocol.
You can either communicate with the firmware using a terminal application such as hyperterminal or minicom, or you can use a programing language like Perl, Python or Java to orchestrate animations. The firmware sets the serial port's BAUD at 115200. Along with the code to the firmware, you will find a script called "clock.py". This python script will draw a clock face on the platter using the serial communication protocol.
The firmware sets up the display for 255 individual slices. It builds a double-buffered frame-buffer, allocating one byte to represent each slice. The double-buffer allows you to draw to the device without disturbing the current frame. Once you upload your frame, you must issue a page flip command (command f) to have it displayed.
r - Report on status
h - Write to the hidden page
v - Read the visible page
c - Clear the page
s - Set single slice number to a value
f - Flip page
1 - Setup test pattern 1
2 - Setup test pattern 2