Close



Results 1 to 9 of 9

Threaded View

  1. #1

    Z axis controlled by stepper motor

    I dont know any programming I just picked up a board and I am trying to learn to program it for this use.

    Arduino controlled stepper motor for z-axis
    (Trying to use arduino UNO)

    in short :
    1)in setup printer - setup options, turn on the serial driper feature
    2)Attach an arduino that listens on the serial port
    3)when the arduino recives a 1, turn the motor on and emulate drips on the mic line
    4)when the arduino recives a 0 stop the motor and the emulated drips. Maybe?


    1. Serial Communication (USB)
      1. 1 from serial communication causes stepper motor to move

    2. Motor Driver
      1. Big Easy Driver stepper (sparkfun)
      2. 1 to 1/16 microstepping

    3. Nema 17 motor. geared vs non-geareed
      1. http://www.phidgets.com/
      2. non geared 200 steps per revolution (1.8 degrees per step)
      3. or something in between
      4. 99.51:1 gearbox 20,000 steps per revolution (.018 degrees per step)

    4. Leadscrew and pitch
      1. Trapezoid leadscrew from openbuilds
      2. TR8*8, 8 mm travel distance per revolution of stepper motor
      3. Without microstepping 8mm/revolution, 200 steps/revolution, or 0.04 mm per step
      4. With 1/16 microstepping (200*16) or 3,200 steps/revolution, or 0.0025 mm/step
      5. With 1/16 microstepping and 99.51:1 gearbox 320,000 steps/revolution or 0.000025 mm/step
      6. Theoretical z axis travel distance 0.000025 mm to 0.04 mm per step
      7. Ideal travel distance would be 0.01 mm to .1 mm
      8. With 99.51:1 gearbox 400 steps to travel .01 mm
      9. With 99.51:1 gearbox 40 steps to travel .001 mm
      10. Movement would be down .1 mm pause than up .09 mm than pause or what every distance you would want.

    5. Audio output to peachy program to tell the program current z level is complete
      1. Use (mic in) on motherboard?
      2. 5V digital output from arduino board
      3. Fire laser for given z height than loop cycle

    6. May not require 0 output from program to restart the arduino


    Example Code for Serial Communication
    Void setup()
    {
    pinMode(13,OUTPUT); //initiates pin 13 to output digital siginal on or off
    digitalWrite(13,LOW); // sets the initial state of pin 13 to off
    Serial.begin(9600); //starts the serial communication at baud rate 9600 or whatever baud rate
    }

    Void loop()
    {
    If (Serial.available() >0)
    {
    Char letter = Serial.read();
    if(letter == ‘1’)
    {
    digialWrite(13,HIGH);
    }
    Else if(letter == ‘0’)
    {
    digitaWrite(13,LOW);
    }
    }
    }

    Instead of having the LED turn on and off it will be the stepper motor movement in its place

    // Stepper motor controller for Big Easy Driver
    //Declare pin functions on Arduino
    const int step_pin = 2; // This PIN pulses the Motor
    const int dir_pin = 3; // Tells you what direction to move the motor H or L
    const int MS1 = 4; // See Microstep Table
    const int MS2 = 5; // See Microstep Table
    const int MS3 = 6;// See Microstep Table
    const int EN = 7;// See Microstep Table
    // //
    //////////////////////////////////////////////

    //Microstep Select Resolution Truth Table
    // MS1 L, MS2 L, MS3 L = Full step
    // MS1 H, MS2 L, MS3 L = Half step
    // MS1 L, MS2 H, MS3 L = Quarter step
    // MS1 H, MS2 H, MS3 L = Eight Step
    // MS1 H, MS2 H, MS3 H = Sixtennth Step
    // EN H diable and the IC will not drive the motor
    // EN L enable allowing motor control


    int direction; // Variable to determine the sense of the motor
    int steps = 4000; // Number of steps that you want to execute (for 1/16 steps, movement down 0.1 mm)
    void setup() {
    pinMode(MS1, OUTPUT); // Configures "MS1" as output
    pinMode(MS2, OUTPUT); // Configures "MS2" as output
    pinMode(dir_pin, OUTPUT); // Configures "dir_pin" as output
    pinMode(step_pin, OUTPUT); // Configures "step_pin" as output
    digitalWrite(MS1, LOW); // Configures the steps division (see above)
    digitalWrite(MS2, LOW); // Configures the steps division (see above)
    digitalWrite(dir_pin, LOW); // Sense (HIGH = anti-clockwise / LOW = clockwise) - It can be also changed
    }
    void loop() {
    while(steps>=0) { // While the steps value is greater or equal zero
    digitalWrite(step_pin, HIGH); // Sends logic level 'high' to the steps pin of the motor
    delayMicroseconds(100); // 1ms = 1000 microseconds
    digitalWrite(step_pin, LOW); // Sends logic level 'high' to the steps pin of the motor
    delayMicroseconds(100); //100 microseconds = 0.1 ms
    steps--; // Decrements the "steps" variable

    }
    }

    I don’t know how to add the change of direction upward to this program and reset the count and to add the digital output to MIC in.

    I am assuming you can use a free digital pin and ground for this and pulse it like a LED for a unit of time. OUTPUT from digital pin would be at 5V might need a transistor in the circuit to drop the current.

    If anybody has suggestions it would be appreciated.
    Last edited by littleone; 06-21-2015 at 09:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •