Output Device


#Stepper Motor


Trulli

I tried to control small 5V stepper motor with the board for D21E17A I designed.



The test is also for my final project: a modulaarized robotic arm system



Trulli

The way to connect the module TMC2208, D21E, and the 5V stepper Motor


Trulli

The following is the code I test the stepper motor


// Code for D21E17A
// defines pins
#define stepPin 4
#define dirPin 5 
 
void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}

void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction

  for(int x = 0; x < 250; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(700);    // by changing this time delay between the steps we can change the rotation speed
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(700); 
  }
  delay(1000); // One second delay
  
  digitalWrite(dirPin,LOW); //Changes the rotations direction

  for(int x = 0; x < 250; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000);
}



GROUP ASSIGNMENT


Nov 09 2022