Loading
Lehaiver

Linear motion guide 3030

by Lehaiver Jan 15, 2015
Download All Files

Thing Apps Enabled

Please Login to Comment

Is there a way to adjust the belt tension?

Sweet, my g/f is gonna love this ;-)

For everyone that has made this linear motion, here is a arduino code which I made. You are able to move the table via serial-monitor. Just upload this code and open the serial-monitor. Set the monitor to ''new line''. The table will first home to the end switch, after that enter step value. Which is max 21250 in my case. You might change this max value for your particular device. Feel free to customize the code for your needs.

const int dirPin = 2;
const int stepPin = 3;
const int endSwitch = 4;

int homing = 0;
int maxSteps = 0;

boolean endSwitchstate = 0;
void setup() {

// Sets pins to output/input
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(endSwitch, INPUT);
digitalWrite(dirPin, HIGH);

Serial.begin(9600);

}

unsigned int steps = 0; // Max value is 21250
char incomingByte;

void loop() {

if (Serial.available() > 0) { // something came across serial
//integerValue = 0; // throw away previous integerValue
while (1) { // force into a loop until 'n' is received
incomingByte = Serial.read();
if (incomingByte == '\n') break; // exit the while(1), we're done receiving
if (incomingByte == -1) continue; // if no characters are in the buffer read() returns -1
steps *= 10; // shift left 1 decimal place
// convert ASCII to integer, add, and shift left 1 decimal place
steps = ((incomingByte - 48) + steps);
}
Serial.println(steps); // Do something with the value
}

endSwitchstate = digitalRead(endSwitch); // Homing loop
if (endSwitchstate == 0 && homing == 0) {

digitalWrite(dirPin, HIGH);
digitalWrite(stepPin, HIGH);
delayMicroseconds(100);
digitalWrite(stepPin, LOW);
delayMicroseconds(100);
}
else
{
homing = 1; // Set homing to true if reached
}

if (homing == 1) // If home position has reached do steps filled in via serial-monitor

if (steps > 0 && maxSteps != 21250) {
digitalWrite(dirPin, LOW);
digitalWrite(stepPin, HIGH);
delayMicroseconds(100);
digitalWrite(stepPin, LOW);
delayMicroseconds(100);
steps --; maxSteps ++;
}
}

For everyone that has made this linear motion, here is a arduino code which I made. You are able to move the table via serial-monitor. Just upload this code and open the serial-monitor. Set the monitor to ''new line''. The table will first home to the end switch, after that enter step value. Which is max 21250 in my case. You might change this max value for your particular device. Feel free to customize the code for your needs.

const int dirPin = 2;
const int stepPin = 3;
const int endSwitch = 4;

int homing = 0;
int maxSteps = 0;

boolean endSwitchstate = 0;
void setup() {

// Sets pins to output/input
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(endSwitch, INPUT);
digitalWrite(dirPin, HIGH);

Serial.begin(9600);

}

unsigned int steps = 0; // Max value is 21250
char incomingByte;

void loop() {

if (Serial.available() > 0) { // something came across serial
//integerValue = 0; // throw away previous integerValue
while (1) { // force into a loop until 'n' is received
incomingByte = Serial.read();
if (incomingByte == '\n') break; // exit the while(1), we're done receiving
if (incomingByte == -1) continue; // if no characters are in the buffer read() returns -1
steps *= 10; // shift left 1 decimal place
// convert ASCII to integer, add, and shift left 1 decimal place
steps = ((incomingByte - 48) + steps);
}
Serial.println(steps); // Do something with the value
}

endSwitchstate = digitalRead(endSwitch); // Homing loop
if (endSwitchstate == 0 && homing == 0) {

digitalWrite(dirPin, HIGH);
digitalWrite(stepPin, HIGH);
delayMicroseconds(100);
digitalWrite(stepPin, LOW);
delayMicroseconds(100);
}
else
{
homing = 1; // Set homing to true if reached
}

if (homing == 1) // If home position has reached do steps filled in via serial-monitor

if (steps > 0 && maxSteps != 21250) {
digitalWrite(dirPin, LOW);
digitalWrite(stepPin, HIGH);
delayMicroseconds(100);
digitalWrite(stepPin, LOW);
delayMicroseconds(100);
steps --; maxSteps ++;
}
}