linear motion between switches

hi i am new to all this, i have built a slot mortise to create loose tendon mortise in wood and i want to automate the operation

i want to use a arduino uno and stepper motors to automate the machine

id like to program the machine to alternatively move left and right at a fairly steady rate, on the machine there is two slides that currently limit side to side movement used to set mortise width i would like to add limit switches to each side

the idea is to have a program run a stepper motor in one direction at steady rate until one limit switch is pressed then id like it to change the motor direction and run the other way unit the oppersite switch is pressed then again change direction act ect.

id also like to program a second stepper motor to move the router into the wood at a adjustable rate until that hits another limit switch.

i know how to add lead screw t and all the mechanical business to the jig i just need help buying the electric parts and setting it all up, I've tried to work it our for myself but i am lost

then would it be possible to do this without the need to have a computer alway attached to the machine

any help would be highly appreciated i feel i could get my head around this but i just need a leg up, thanks

possible to do this without the need to have a computer alway attached to the machine

Yes, the Arduino, properly programmed, could handle that easily.

I don't know how much that you know about steppers so here a couple of threads with basic stepper information (thanks to Robin2).
https://forum.arduino.cc/index.php?topic=284828.0
https://forum.arduino.cc/index.php?topic=277692.0

Running back and forth between two switches is basically, step toward switch, check the switch state, step, check, and so in until the switch reads closed, set direction to reverse, step, check other switch, step, check and so on.

What kind of switches are your limit switches?

Instead of stepper motors you may want to have a look at linear actuators, as it sounds like they do exactly what you're trying to do. If you have the correct actuator, you may not even have extra limit switches (as the actuator itself has a limited range).

wvmarle:
Instead of stepper motors you may want to have a look at linear actuators,

Do people use linear actuators in CNC machine control applications?

...R

groundFungus

thanks for the link cam going to have a read through both today
could i use these switches? http://uk.rs-online.com/web/p/microswitches/0517527/
I've just googled arduino switches and haven't come up with much, does any with work with arduino?

wvmarle

yes i could use linear actuators but i believe using them only without the switches would mean than i would have to go back to the programming every time i wanted to change the length of the mortise, i would rather put switched on the move-able stop and just move the stop to alter the set up.

Robin2

yes they are you are correct infact I've just purchased a cnc machine fro ooznest.co.uk the OX CNC MACHINE, i plan on using it to further improve and pruduce more interesting stuff like this machine using arduino, i am just dipping my toe in at the moment to test the water

ive purchase a starter kit off eBay that includes all sorts of bits,

can any one surguest what else i need to buy besides the stepper motors and switches , thanks

Pretty much any switch will work with Arduino if connected properly. The linked switch would work as a limit switch for your purpose.

Choose the steppers based on the torque required. Then you can choose the stepper drivers that will handle the required coil current of the steppers. Also, you will need a power supply for the steppers. It must be able to provide the current and voltage for as many motors as you will be using.

martynb:
yes they are you are correct

I'm not sure how I could be since I only asked a question :slight_smile:

...R

martynb:
yes i could use linear actuators but i believe using them only without the switches would mean than i would have to go back to the programming every time i wanted to change the length of the mortise, i would rather put switched on the move-able stop and just move the stop to alter the set up.

Not necessarily back to programming but indeed you'd need some kind of interface to set limits - adding a lot of complexity to your project. Limit switches are a simple way to do this indeed.
I was thinking of linear actuators as they give you the movement you want, a (stepper) motor would need some components to go from rotation to the linear you need.

robin i have no idea what you are trying to say, you have me confused with that last comment, i read the post linked in ground fungus first reply it was very well written and helpful thank you

wrmarle

I was thinking of linear actuators as they give you the movement you want, a (stepper) motor would need some components to go from rotation to the linear you need.

yes i have a coulee of lead screws timing gt3 belts, linear bearing to convert the rotational movement to linear movement. i can do that part, its more my thing, i carnt wait to get my arduino kit and start playing around now I've looked into the arduino i have to say it has got me very excited about what i might be able to do

I've been watch a tutorial on arduino coding by paul mawhorter on youtube this morning he is very good at explaining it all and i feel alot less overwhelmed now,

Thank you everybody for taking time to help me helping me

martynb:
robin i have no idea what you are trying to say, you have me confused with that last comment,

In your Reply #4 you said I was correct even though I had not said anything that could be either right or wrong. in Reply #3 I just asked a question which has not yet been answered.

In the absence of an answer I suspect that linear actuators are not normally used in CNC systems.

...R

ah ok robin2

in response i would like to revert back to you original statement and try again to respond

yes people do use linear actuators in cnc machines for x, y, z, axis movement

martynb:
yes people do use linear actuators in cnc machines for x, y, z, axis movement

Thank you. I had not realized they would have sufficient precision.

...R

yes heres one that incorporated int a popular hobby inc, just a lead screw at the end of the day and the are very accurate, much more than a belt driven system

sorry this is the link i was referring to

martynb:
sorry this is the link i was referring to

Thanks. I did not realize that is what you had in mind. It's just a regular stepper motor driving a screw - like on my small lathe.

I was thinking of things like this and this

...R

yes it is just a way of converting rotational movement to linear movement , i don't think they use the items in your link for cnc machines but i could be wrong

martynb:
i don't think they use the items in your link for cnc machines but i could be wrong

It was the same thought that prompted my Reply #3

I think we are now on the same page. :slight_smile:

...R

can i ask for coding help for my project, I've been trying to work it out for myself for days and i am getting nowhere. i concerns using user keypad input

ok guess nobody objects, so far I've manage to connect a lcd and a 4 x 4 keypad i can input digits from the keypad and display them on both on the lcd screen and in serial monitor. What i want to do after asking for a slot size i want to take the numerical input from the user through the keypad and place it in a variable called something like "slot size" which i can use later on to calculate the number of steps the a stepper motor. I could just use switches but i would rather do this, i been trolling the internet for days trying to get this to work but i just cart seem to get the digits off the screen

here is my code so far

#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <Keypad.h>

#define I2C_ADDR 0x27 //Define I2C Address where the PCF8574A is

#define BACKLIGHT_PIN 3

#define En_pin 2

#define Rw_pin 1

#define Rs_pin 0

#define D4_pin 4

#define D5_pin 5

#define D6_pin 6

#define D7_pin 7


//Initialise the LCD

LiquidCrystal_I2C lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

int slotsize; //declare slot variable 
char key;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
byte ledPin = 13; 

boolean blink = false;
boolean ledPin_state;


void setup() {


Serial.begin(9600);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
ledPin_state = digitalRead(ledPin); 

lcd.begin(16,4);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);  
lcd.setCursor(0,0); 
lcd.print("please enter");
lcd.setCursor(0,1);
lcd.print("slot size"); 
delay(3000);
lcd.clear();


    
}


 


void loop(){
char key = keypad.getKey();

if(key){
    Serial.print(key);
   lcd.print(key);
}
   
    

 
   
   
}

please help me, its driving me mad

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

I suggest you take out all the LCD stuff and leave that until you have everything else working as it just clutters up the code. Just use the Serial Monitor. It will also mean that we can focus on the real problem.

What does your program actually do?

If you have not already done so you should write a program that makes the stepper move a distance that is contained in a variable. Later you can add code to update that variable using your keypad.

...R