Thursday, February 4, 2010

Using a hard drive spindle motor for projects

I was recently staring at a pile of 15K RPM SCSI drives that had gone bad at work. I have always admired the build quality of these drives, the fact that they can spin at 15000 rpm without failure for years is amazing. I was curious if the platter spindle motors would be useful to use in any type of projects, so I tore a couple drives apart and pulled the spindle motors out of them.

These spindle motors are basically a small three phase motor. My initial assumption to drive them was that you would need to provide each phase a voltage pulse in sequence to create rotation. Looking at a drive with my scope I could see that this was definitely not the case. The waveform on each pin was extremely complex, actually so complex that all of my Agilent and Tektronix digital scopes had a hard time capturing the waveform. My best success in capturing was with my Tektronix analog scope. The waveform to one of the phases can be seen here:


This shows again how as awesome as digital scopes are, sometimes an analog scope can provide a better picture of the waveform you are trying to see. :)

To drive this motor, I wanted to see if I could get it spinning as fast as possible with the minimum amount of circuitry simply by pulsing the three phases in sequence. I chose a pic 18F4520 as the controller and was driving each phase using a TIP31C power transistor. Initially I was using a ULN2003 to drive the phases, but found the current consumption from the motor was higher than I would have liked risking damage to the ULN2003. This motor is definitely harder to drive than a typical stepper motor.



When initially starting up the motor, you need to start the pulses at a slow rate. I found that pulsing each phase at about 20Hz (1200 rpm) was slow enough to get the spindle rotating.



Once initial rotation is established you can begin decreasing the delay between pulses to increase the spindle rotation speed. Driving the motor with a square wave, I am able to reach speeds just over 100Hz (6000 rpm) before the motor begins decreasing speed.

At this point my pulses begin to overrun each other causing speed to decrease as each phase is on consecutively. Decreasing the pulse width doesn't help either as the decreased pulse width doesn't provide enough current to each winding to keep the motor running. I would like to try driving it with sine waves, or that complex waveform that the original controller generates, but 6k rpm is pretty good for the minimal circuitry required. Not bad for about an hour worth of work anyway.


I found that placing the platters back on the spindle acted as a flywheel which helped the motor maintain smoothness being driven by the pulses. To control the speed, I used an adjustable resistor to provide input into one of the adc inputs on the pic. This in turn adjusted the pulse width of the motor. Here is the code to make it spin:



#pragma config WDT = OFF

void delay1(int result1)
{
result1 = result1 / 20;
if (result1 <= 30)
{
result1 = 30;
}
Delay1KTCYx(result1);
}
void delay2(int result1)
{
result1 = result1 / 12;
Delay1KTCYx(result1);
}

void main (void)
{
int result1;
TRISB = 0x00;
while (1)
{
OpenADC( ADC_FOSC_4 & ADC_RIGHT_JUST & ADC_4_TAD, ADC_CH0 & ADC_INT_OFF, 15 );
ConvertADC();
while( BusyADC() );
result1 = ReadADC();
CloseADC();


PORTB = 0b00000001;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
PORTB = 0b00000010;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
PORTB = 0b00000100;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
}
}




Next I plan creating a simulated sine wave with the pic to try to obtain higher speeds and smoothness replicating what the hard drive controller circuity does. I would like to look into the pulses generate by the actual hard drive controller as well to get a better understanding of how it can reach speeds of 15000 rpm.

8 comments:

  1. i'd love to know how you progress(ed) with this. i'm attempting a project of my own that involves a hdd motor, and having issues getting it spinning. not tried your code yet, but i intend to. any luck with the sine wave from a PIC yet?

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Hi, your web site is great!
    I would like to know how you will go on with the project.
    I have built the driver with 4017 (?) and 4018 (OK!), I am also trying Arduino and MOSFET transistors.
    I use the following sources:

    http://home.clear.net.nz/pages/joecolquitt/0hdd.html
    http://wingzero.ath.cx/index.php?page=schematic
    http://letsmakerobots.com/node/2898

    How have you get on with the next plan?
    How are your results?
    E.Bartosek

    ReplyDelete
  4. If you are not already bored with this project, you might look at this: http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf

    ReplyDelete
  5. Hi, Good Job, will you please post schematic of your circuit for better understanding.

    ReplyDelete
  6. You can use the magnets from inside your HDD and a 75 cent reed switch to get that stepper motor spinning super fast.

    Here's the video tutorial: http://jaytube.org/share/PueF3b3XXBo

    ReplyDelete
    Replies
    1. UPDATE : The URL for my instructional video above is changing, I'm dropping the Jaytube domain in March 2014. The new URL is:

      http://spottedmarley.com/share/PueF3b3XXBo

      :)

      Delete
  7. I tried driving one of these with my experimental BLDC driver... no luck. Jumpy. I left the center? ground open, then drove the 3 leads that had most resistance WRT each other, thinking they were the edges of a Y configuration. Perhaps try grounding the center, then just pulsing the other 3 wires in sequence? That would be much simpler than the 6 transistor bridge I have for BLDC. (Actually 9 transistors, since the high side transistors each have another transistor to switch them.)

    ReplyDelete