Run 3 Phase HDD Motor Using Arduino

Welcome to all technology science lover in this website.


Have you a HDD Motor and you can't use it ,so this post only for 3 Phase HDD Motor controlling using Arduino. I use a Arduino Nano. The full power HDD Motor is 12,000 RPM in 12volts ,3Amps
power but this is too much risky for Arduino MCU and notice only use 500mA to 1.5 Amps power. I am not show LM7805 in the circuit diagram but this voltage regulator is must important for Arduino power supply 5volts and connected with motor power 12volts power supply . This is very low cost project if you made this project for permanently so use ATmega328-PU .
How to burn bootload ATmega 328-PU using USBASP ? in my next post. HDD motor is one type stepper motor I am use for CNC Plotter by 4 phase and laser projector and etc.

Circuit Diagram
Please note if you have 4 phase HDD Motor so connect the power 12volts.


The Code
 You will need to plug your Arduino board into the computer with the USB connector first. Then, you can download the below program. After the program is downloaded, press the reset button on the Arduino before plugging the battery into the ESC. The motor will make a start up noise, then it will wait. After a few seconds, the motor will beep 3 times and then gradually move to the speed programmed. It will then gradually move back down to zero speed. You can edit the program for how fast the motors go and how long they stay on.

// TrueScience22.blogspot.com
//Facebook.com/true.science.22

int phase1 = 2;
int phase2 = 3;
int phase3 = 4;
int led = 12;

unsigned long stepLength = 40000;
int minStepLength = 1400;
int steps = 5;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(phase1, OUTPUT);
  pinMode(phase2, OUTPUT);
  pinMode(phase3, OUTPUT);
  digitalWrite(led, LOW);
}

void loop() {
  switchStep(1);
  switchStep(2);
  switchStep(3);

  if(stepLength > minStepLength)
  {
    stepLength = stepLength - steps;
  } else {
    // set the minimum pulse length
    stepLength=minStepLength;
  }

  if (stepLength < 39950) {
    digitalWrite(led, HIGH);   // second gear
    steps = 300;
  }
 
  if (stepLength < 20000) {
    digitalWrite(led, LOW);      // third gear
    steps = 50;
  }

  if (stepLength < 3000) {
    digitalWrite(led, HIGH);      // fourth gear
    steps = 2;
  }
}


void switchStep(int stage)
{
  switch(stage)
  {
  case 1:
    digitalWrite(phase1, HIGH);
    digitalWrite(phase2, LOW);
    digitalWrite(phase3, LOW);
    myDelay(stepLength);
    break;
 
  case 2:
    digitalWrite(phase1, LOW);
    digitalWrite(phase2, HIGH);
    digitalWrite(phase3, LOW);
    myDelay(stepLength);
    break;
 
  default:
    digitalWrite(phase1, LOW);
    digitalWrite(phase2, LOW);
    digitalWrite(phase3, HIGH);
    myDelay(stepLength);
    break;
  }


}

void myDelay(unsigned long p) {
if (p > 16380) {
  delay (p/1000);
  } else {
  delayMicroseconds(p);
  }

}
Thanks For Supporting Us.
Save Tree. Save Life

Comments