After taking some time away from the problem (school, you know), I’ve come back to have another look at the hard drive controller. The idea was to open a hard drive, and use the interior disk platters as a controller for a computer, being able to, for example, scroll through movies, or songs, or even use it as an impromptu DJ desk.
When I left the problem last time, I was despairing over the innate complexity of the motors in hard drives – they wouldn’t just output a nice, proportional power signal when the platters are spun, they would output three sinusoidal waves. I found a tutorial on turning the three sine wave outputs into usable inputs for, say, an arduino. At first I thought it looked very complex, but on a second inspection, it’s actually quite simple.
Essentially, when you set the platters rotating, you get an output like this:
Three overlapping sine waves. The biggest problem here is that the waves are way too small for a standard micro controller to read – they need to be amplified. The resulting output of a single wave will be a square wave like this:
I’ve shifted the wave up one so you can see it in totality. The idea is, it’s a lot easier to amplify the wave into this square wave form than to keep the entire sine wave. You might think this would cause a loss of information, but that’s not actually the case – only two pieces of information are needed. Firstly, the speed of the rotation is determined by the period of the square wave, how wide it is. The other piece of information is the direction of rotation, which is determined by how the waves are staggered against each other.
So, how do we create this signal out of the sine wave? Well, we use a component called an op amp, as a comparator. A comparator is a simple component – it takes two inputs, and tells you which one is larger. In a standard comparator, it would just output whichever of the two signals is larger – we don’t want that, we want to amplify the signal as well. This is where the op amp comes in handy, as instead of outputting the larger of the two signals, we can attach power to it from another source, so that if the positive signal is larger, it outputs, say, 5 volts, and if the negative input is larger, it outputs 0 volts.
A nice chip with 4 op amps in one can be found here. You need at least 3 op amps for this, one for each sine wave, so this gives you a spare.