Arduino Sketch:
//139:1 Stepper Motor Drive Sketch for Temporary Immersion Tilt Table #include// to motor port #1 (M1 and M1) AF_Stepper motor(100, 1); void setup() { motor.setSpeed(50); // 50 rpm } void loop() { motor.step(3500, BACKWARD, MICROSTEP); //Amount of rotation backwards. 3500 steps for 51:1 motor motor.step(3500, BACKWARD, MICROSTEP); //10500 total steps for 139:1 motor motor.step(3500, BACKWARD, MICROSTEP); //Steps must be broken into increments for large step numbers delay (60000); //Soak time motor.step(3500, FORWARD, MICROSTEP); //Amount of rotation forwards motor.step(3500, FORWARD, MICROSTEP); motor.step(3500, FORWARD, MICROSTEP); motor.release(); //shuts off power to motor delay (3500000); // 30min ~ 1500000 //Tilt time //This code down below is is for other step modes if you wish to experiment //Serial.println("Double coil steps"); //motor.step(100, FORWARD, DOUBLE); //motor.step(100, BACKWARD, DOUBLE); //Serial.println("Interleave coil steps"); //motor.step(100, FORWARD, INTERLEAVE); //motor.step(100, BACKWARD, INTERLEAVE); //Serial.println("Micrsostep steps"); //motor.step(100, FORWARD, MICROSTEP); //motor.step(100, BACKWARD, MICROSTEP); }
Connect your computer to the Arduino board with a USB cable, select the proper COM port and Board under the «Tools» tab. Select «Verify» and then select «Upload» to upload the sketch to your Arduino board. The motor should now begin to turn. Unplugging the USB chord will reset the sketch, so you can allow the wheel to rotate and unplug when the wheel and shelf are at their highest position. Adjust the «Soak time» and «Tilt time» to achieve your desired results and then re-upload the sketch.

