Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
Anthony Garofalo
Published © GPL3+

3D Printed Stepper Motor

I designed this stepper motor with eight electromagnets, six neodymium magnets, with a 3d printed rotor and stator housing.

IntermediateFull instructions provided22,929
3D Printed Stepper Motor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
1/4" neodymium magnets
×6
8d 2-3/8" nails
×8
Transistors
×4
608zz Bearing
×1

Story

Read more

Custom parts and enclosures

Octagon Stator.stl

Dodecagon Rotor.stl

Schematics

Schematics

Code

Printed_Stepper_Motor.ino

Plain text
/*
01010000011100100110111101110100011011110010000001000111

3D Printed Stepper Motor

Created August 15, 2015
Modified August 15, 2015
by Anthony Garofalo (Proto G)

Visit my YouTube channel here: https://www.youtube.com/channel/UCpTuKJrXFwybnpOG7HpTpZw
Visit my Instructables page here: http://www.instructables.com/member/Proto+G/

  _____   ______  _____  _______  _____        ______
 |_____] |_____/ |     |    |    |     |      |  ____
 |       |    \_ |_____|    |    |_____|      |_____|
  
01010000011100100110111101110100011011110010000001000111
*/



int Delay;
int reverseSwitch;

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  
  pinMode(13, OUTPUT);   //led pin for visual
  pinMode(6, INPUT);     //toggle switch is connected to digital pin 6 for reversing direction
  
}


void loop() {
  
  
  

  reverseSwitch = digitalRead(6);
  
  if(reverseSwitch == HIGH){//if the reverse switch is high, spin the rotor counter clockwise
   
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
    
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);     
  delay(Delay);           
  digitalWrite(12, LOW);
  digitalWrite(13, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(11, HIGH); 
  delay(Delay);           
  digitalWrite(11, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(10, HIGH); 
  digitalWrite(13, HIGH);  
  delay(Delay);           
  digitalWrite(10, LOW);
  digitalWrite(13, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(9, HIGH); 
  delay(Delay);           
  digitalWrite(9, LOW); 
  delay(5);
    
  }
  
  else{//if the reverse switch is not high, spin the rotor clockwise


  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
    
  digitalWrite(9, HIGH);
  digitalWrite(13, HIGH);     
  delay(Delay);           
  digitalWrite(9, LOW);
  digitalWrite(13, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(10, HIGH); 
  delay(Delay);           
  digitalWrite(10, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(11, HIGH); 
  digitalWrite(13, HIGH);  
  delay(Delay);           
  digitalWrite(11, LOW);
  digitalWrite(13, LOW); 
  delay(5);
  
  Delay = analogRead(0);
  Delay = map(Delay, 0, 1023, 60, 2000);
  
  digitalWrite(12, HIGH); 
  delay(Delay);           
  digitalWrite(12, LOW); 
  delay(5);
  
  }
  
  
  
  
  
}

Credits

Anthony Garofalo

Anthony Garofalo

2 projects • 27 followers

Comments