Staf Van Gestel
Published © GPL3+

SMD-flipper

Two stepper motors and an Arduino to turn around an SMD part.

IntermediateShowcase (no instructions)5 hours4,253
SMD-flipper

Things used in this project

Hardware components

stepper motor 28BYJ-48 5VDC
×2
Arduino Nano Every
Arduino Nano Every
×1
micro switch
×1
9V 1A Switching Wall Power Supply
9V 1A Switching Wall Power Supply
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Dremel multitool

Story

Read more

Custom parts and enclosures

3D files

These are the files that are created for our 3D-printer

Code

SMD-flipper

Arduino
This is the code on the Arduino Nano Every
/*
SMD-flipper

Device for flipping SMD-part.

created september 2020

By Staf Van Gestel

Based on program found on https://arduino-lessen.nl

the position of the two tools must be correct before starting the device
*/

#include <AccelStepper.h>           // Gebruikt AccelStepper bibliotheek

#define motor1Pin1  4               // IN1 pin op de ULN2003A driver
#define motor1Pin2  5               // IN2 pin op de ULN2003A driver
#define motor1Pin3  6               // IN3 pin op de ULN2003A driver
#define motor1Pin4  7               // IN4 pin op de ULN2003A driver
#define motor2Pin1  8               // IN1 pin op de ULN2003A driver
#define motor2Pin2  9               // IN2 pin op de ULN2003A driver
#define motor2Pin3  10              // IN3 pin op de ULN2003A driver
#define motor2Pin4  11              // IN4 pin op de ULN2003A driver
#define StartSwitch 2               // D2 for switch.
int stepsPerRevolution = 64;        // stappen per omwenteling - steps per rotation
float degreePerRevolution = 5.625;  // graden per omwenteling - degrees per rotation

AccelStepper stepper1(AccelStepper::HALF4WIRE, motor1Pin1, motor1Pin3, motor1Pin2, motor1Pin4);
AccelStepper stepper2(AccelStepper::HALF4WIRE, motor2Pin1, motor2Pin3, motor2Pin2, motor2Pin4);

void setup() {
  pinMode(2,INPUT_PULLUP);           // activation switch
  stepper1.setMaxSpeed(1000.0);      // max motorsnelspeed
  stepper1.setAcceleration(200.0);   // acceleration speed
  stepper1.setSpeed(1000);           // rotation speed
  stepper2.setMaxSpeed(1000.0);      // max motorspeed
  stepper2.setAcceleration(200.0);   // acceleration speed
  stepper2.setSpeed(1000);           // rotation speed
}


void loop(){ 
if (digitalRead(StartSwitch) == false) {
   stepper1.moveTo(degToSteps(-180));
   do {   
   }
   while (stepper1.run()); // turn first tool on top of the other.

   stepper2.moveTo(degToSteps(-180));
   stepper1.moveTo(degToSteps(0));
   do {   
   stepper1.run();
   }
   while (stepper2.run() && stepper1.run());  // here both steppers are moved to next position
   stepper2.moveTo(degToSteps(0));
   do {   
   }
   while (stepper2.run()); // second tool is moved to his initial position, smd-part is turned around.
   }  
}

// calculate the # if degrees to # of steps
// f.e. 45° = 64 / 5,625 = 1024 stappen
 */
float degToSteps(float deg) {
  return (stepsPerRevolution / degreePerRevolution) * deg;
}

Credits

Staf Van Gestel

Staf Van Gestel

5 projects • 20 followers
Thanks to Bas on Tech.

Comments