Staf Van Gestel
Published © GPL3+


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

IntermediateShowcase (no instructions)5 hours3,904

Things used in this project

Hardware components

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

Hand tools and fabrication machines

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


Read more

Custom parts and enclosures

3D files

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



This is the code on the Arduino Nano Every

Device for flipping SMD-part.

created september 2020

By Staf Van Gestel

Based on program found on

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) {
   do {   
   while (; // turn first tool on top of the other.

   do {;
   while ( &&;  // here both steppers are moved to next position
   do {   
   while (; // 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;


Staf Van Gestel

Staf Van Gestel

5 projects • 20 followers
Thanks to Bas on Tech.