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?
- Serial Communication (USB)
- 1 from serial communication causes stepper motor to move
- Motor Driver
- Big Easy Driver stepper (sparkfun)
- 1 to 1/16 microstepping
- Nema 17 motor. geared vs non-geareed
- http://www.phidgets.com/
- non geared 200 steps per revolution (1.8 degrees per step)
- or something in between
- 99.51:1 gearbox 20,000 steps per revolution (.018 degrees per step)
- Leadscrew and pitch
- Trapezoid leadscrew from openbuilds
- TR8*8, 8 mm travel distance per revolution of stepper motor
- Without microstepping 8mm/revolution, 200 steps/revolution, or 0.04 mm per step
- With 1/16 microstepping (200*16) or 3,200 steps/revolution, or 0.0025 mm/step
- With 1/16 microstepping and 99.51:1 gearbox 320,000 steps/revolution or 0.000025 mm/step
- Theoretical z axis travel distance 0.000025 mm to 0.04 mm per step
- Ideal travel distance would be 0.01 mm to .1 mm
- With 99.51:1 gearbox 400 steps to travel .01 mm
- With 99.51:1 gearbox 40 steps to travel .001 mm
- Movement would be down .1 mm pause than up .09 mm than pause or what every distance you would want.
- Audio output to peachy program to tell the program current z level is complete
- Use (mic in) on motherboard?
- 5V digital output from arduino board
- Fire laser for given z height than loop cycle
- 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.