Hi guys,
I am new in here.I try to drive step motor with encoder.Encoder is 1000 pulse and has 2 output.I use only a output.I want to make treading system for dıy lathe.one revolution of the stepper motor 200 pulses.When arduino receives 25 pulse by the encoder,I want that step motor goes 1 pulse as way.The encoder turn 1 spin =1000 pulse, Step motor goes to 40 pulse that same as 2mm per revelotion
My mill 300 rpm ,step motor must be 60 rpm.
But I have a problem that code is so slow.
AND receiving fast that encoder, Arduino makes fault.
int counter = 0; #define dirPin 8 #define stepPin 9
void setup() {
Serial.begin (9600);
pinMode(2, INPUT_PULLUP); // Encoderden çıkan yeşil yada sarı kabloyu Arduinonun 2. pinine
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
digitalWrite(dirPin, HIGH);
attachInterrupt(digitalPinToInterrupt(2), Interrupt_function, RISING);
Before you get too far along in this project. Be aware that using a stepper motor anywhere in a lathe will cause "chatter" while cutting metal. ANY pulsing anywhere will cause the cutting force to vary plus and minus, which is the definition of chatter. Use a DC motor and control it.
Paul
Have you seem how many they must sell on home shopping channels.
There must be millions of them out there gathering garage dust.
Also they are a tough motor designed for high and very dynamic torque loads.