5) Electronics and Software [ATD]

The electronics used in this device are very simple. The whole mechanism is driven with one motor, and we selected a stepper motor to have greater control over angular velocity. The stepper motor is controlled by a stepper motor driver, and both of these are powered from a 12V DC power supply. An Arduino Uno runs simple code to pulse the stepper motor through the driver.

Arduino Code

#define pulsePin 3
#define dirPin 4
#define optoPin 5
#define enablePin 6
#define pulseDelay 400


void setup() {
  pinMode(pulsePin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  digitalWrite(dirPin, HIGH);
  digitalWrite(optoPin, HIGH);
  digitalWrite(enablePin, HIGH);

}

void loop() {
  digitalWrite(pulsePin, LOW);
  delayMicroseconds(pulseDelay);
  digitalWrite(pulsePin, HIGH);
  delayMicroseconds(pulseDelay);

}

Download Code: rmd_project_stepper_code.ino