Hello, obviously im a newbie so go easy on me
but Is there a way to adjust the steps taken by the stepper when the bourn encoder is rotated?
long story short im wanting the stepper shaft to move at the same speed / rotation as the bourn encoder,
as in the tutorial the motor does move 1 step per encoder step, but the shaft of the stepper rotates less than the encoder,
im basically wanting to attach the encoder shaft via a coupling connector to another shaft controlled by a dc motor, i want the stepper motor to go at the same rotation as the shaft thats connected to the bourn encoder... reason being i don't want to touch any of the original electronics and basically piggy back them but instead of using the dc motor to drive, will use the stepper motor
hope that makes sense
/* Control Stepper Motor with 'Bourns EAW' encoder
Created by Yvan / https://Brainy-Bits.com
This code is in the public domain...
You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!
*/
#include <LiquidCrystal_I2C.h>Â // I2C LCD Library by Francisco Malpartida https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
#include <AccelStepper.h>Â // AccelStepper Library https://www.arduinolibraries.info/libraries/accel-stepper
#define I2C_ADDR 0x27Â // I2C address of typical I2C LCD Backpack
// LCD Pins to I2C LCD Backpack - These are default for HD44780 LCD's
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
// Create instance for LCD called: i2c_lcd
LiquidCrystal_I2C i2c_lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
const int pinSTEP=11;Â // STEP pin of EasyDriver connected to pin 11 of UNO
const int pinDIR=10;Â // DIRÂ pin of EasyDriver connected to pin 10 of UNO
AccelStepper stepper(1, pinSTEP, pinDIR);Â // Stepper setup
// Include the Bourns EAW Encoder library and maps
#include <ACE128.h>Â // https://github.com/arielnh56/ACE128
#include <ACE128map12345678.h> // mapping for pin order 12345678
// Pin x of UNO connected to pin x of Encoder (example: UNO pin 2 connected to pin 1 of encoder, etc...)
ACE128 myACE(2,3,4,5,6,7,8,9, (uint8_t*)encoderMap_12345678);
int16_t multiturn_encoder_value;Â // Variable to hold multiturn value of encoder (-32768 to 32767)
void setup() {
 i2c_lcd.begin (16,2); // our LCD is a 16x2, change for your LCD if needed
Â
 // LCD Backlight ON
 i2c_lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
 i2c_lcd.setBacklight(HIGH);
Â
 i2c_lcd.clear(); // Clear the LCD screen
 stepper.setCurrentPosition(0); // Set current position of stepper at startup to zero
 stepper.setMaxSpeed(1000.0);   // Set Max Speed of stepper
 stepper.setAcceleration(5000.0); // Acceleration of stepper
 stepper.setSpeed(1000.0); // Speed of stepper
 myACE.begin();  // initialize the encoder library
}
void loop() {
 multiturn_encoder_value = myACE.mpos(); // get multiturn value from encoder
 stepper.moveTo(multiturn_encoder_value); // set stepper new position to move to
 Â
 while (stepper.distanceToGo() != 0) { // if stepper hasn't reached new position
  stepper.runSpeedToPosition(); // move the stepper until new position reached
 }
// Display the encoder multiturn and stepper position on LCD
 i2c_lcd.setCursor(0,0);
 i2c_lcd.print("Encoder: ");
 i2c_lcd.setCursor(9,0);
 i2c_lcd.print(multiturn_encoder_value);
 i2c_lcd.print("   ");
 i2c_lcd.setCursor(0,1);
 i2c_lcd.print("Stepper: ");
 i2c_lcd.setCursor(9,1);
 i2c_lcd.print(stepper.currentPosition());
 i2c_lcd.print("   ");Â
}