Cutting thin sleeves at circlesaw using step motors and Arduino to move fence

Steadily under construction.

Introduction:

Cutting thin sleeves on a circlesaw MAY be dangerous doing it the wrong way :Link1

Here's a good handling to minimize danger:Link2

Problem solved :slight_smile: .......if You like puzzle with motors,programming, uC, its not :slight_smile:

PROJECT IDEA:

To make a jig that moves a saw fence a distance (input from a keypad) each time you press a button showing input distance on a display

This way, You won't be dependant of a single point contact with object to be cut and the sawblade.
You will (hopefully) get an accurate movement of fence movement without need of new measurements every time You need to change width of the object. (piece of wood).

You will also get a larger area to glide the object to,entering the sawblade (not a single point as You get from i.e. a featherboard.

MECHANICAL CONSTRUCTION IDEA:

ELECTRICAL CONSTRUCTION:

WIREING:

All red wirestubs from each module ends up at breadboard + line.
All black wirestubs from each module ends up at breadboard -- line

PROGRAMMING:

#include <AccelStepper.h>
#include <MultiStepper.h>
#include <Keypad.h>
#include <Wire.h>
#include <Stepper.h>
#include <utility/Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

#define STEPS 100
// define display instance
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// define step motor instances and driver pins
// AccelStepper stepperx(AccelStepper::DRIVER, 12, 13);
Stepper stepper(STEPS, 10, 11, 12, 13);

// define variables for motordriver
byte sXpin_s=12;  // stepmotor x-retning stepp
byte sXpin_d=13;  // stepmotor x-retning direction

// define keypad variables
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
        {'1','2','3'},
        {'4','5','6'},
        {'7','8','9'},
        {'*','0','#'}
        };
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

// define switches/buttons variables
boolean nodstop = false;
boolean motorstart= false;

int number=0; // distance, as integer, to move fence
String inpnumber=""; //numbers,as characters, input from 3x4 keypad
String dummy="";
int numberlength=0;
char key;
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  keypad.addEventListener(keypadEvent); // Add an event listener for this keypad
  pinMode(9,INPUT); // input true, start moving fence
  
  pinMode(sXpin_s, OUTPUT);
  pinMode(sXpin_d, OUTPUT);

  stepper.setSpeed(30);

  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("Avstand i mm ?");
  delay(3000); 
  lcd.clear(); 

  

  }

void loop()
{
  
 key = keypad.getKey();
 if(motorstart==true)
                    {
                    lcd.print("motor running");
                    delay(30);
                    stepper.step(number);
                    motorstart=false;
                    }
  
    
    // lcd.print(number);         
}  // end loop function

// events

void keypadEvent(KeypadEvent key)
{
  
    switch (keypad.getState()){
    case RELEASED:
        if(key=='#' && number<401)
        {
          motorstart=true;
        }
        
        
        if(key == '#' && number>400)
        {
                                            
                                         
        lcd.setCursor(0,0);
        lcd.print("Nummer > 400");                              
        // write to lcd display :number must be less than 401 mm
        // blink tekst twice
        // write number to display, blink twice
        number=0;
        inpnumber="";
        delay(3000);
        lcd.clear();
        }

        if(key == '*')
        {
          lcd.clear();
          inpnumber="";
          number=0;
        }
        
        
        break;
     
  
   case PRESSED:
  
    if (key== '1' || key=='2' || key=='2'|| key=='3'|| key=='4'|| key=='5'|| key=='6'|| key=='7'|| key=='8'|| key=='9'|| key=='0')
        {
          inpnumber=inpnumber+key;
          number=inpnumber.toInt();
          lcd.setCursor(0,0);
          lcd.print(inpnumber);
          lcd.print(" mm");
        }

   break;

   case HOLD:
     if(key=='0')
               {// move fence back to startposition
                lcd.setCursor(0,0);
                lcd.print("initpos");
                number=0;
                inpnumber="";
                delay(3000);
               }
   break;
        
    }
}

TESTING OUT MODULES with function snippets:

PARTLIST:

Electronics:

1 pcs Arduino uC. i.e.: Arduino Uno uC
1 pcs LCD display. i.e.: LCD display
1 pcs I2C shield i.e.: I2C shield
1 pcs 3x4 Keypad i.e: 3x4 keypad
1 pcs stepmotor driver i.e.: Stepmotor driver breakout board
2 pcs NEMA-17 type stepmotor i.e.: NEMA-17 Stepmotor
X pcs signalwires i.e.: Signal wires
i.e.: Signal wires
1 pcs breadboard i.e.: Breadboard
1 pcs communication cable i.e.: USB cable A-B
1 Pcs 12vdc powersupply (for motordriver) i.e.: I=3Ampere

All others: