X27 Stepper guidance

Joulz

Member
Hi,

i am building a Project with multiple X27 steppers (datasheet) and im having trouble controling the steppers.
The problem is, that the stepper i am testing with is loosing steps and sometimes not reacting at all.

Wiring of the test rig:
1757076585487.png


Code of the test:
Code:
#include <SwitecX25.h>
#include <Metro.h>

// standard X25.168 range 315 degrees at 1/3 degree steps
#define STEPS (315 * 3)

// For motors connected to digital pins 21, 20, 23, 22
SwitecX25 motor1(STEPS, 21, 20, 23, 22);

// Metro for timing 1 sec
Metro testMetro = Metro(1000);

void setup(void) {
  // run the motor against the stops
  motor1.zero();
}

bool toggle = false;

void loop(void) {
  motor1.update();

  if (testMetro.check() == 1) {
    if (toggle) {
      motor1.setPosition(100);
      toggle = false;
    } else {
      motor1.setPosition(900);
      toggle = true;
    }
  }
}

My questions are:
  • Can i drive the X27 stepper with the Switec library? (github) It is meant for the X25 stepper (datasheet) and that one seems to have a different step pattern(?), but everyone online is using this library for other X27 projects.
  • Is my choice of the L293D H-Bridge a problem?
  • Did i make a mistake wiring it?

Thanks already to anyone who tries to help me with my mess :D
 
Solved.
The test setup and code was correct.

Turns out, it is not possible to use the SwitecX25 lib for the X27 because of the different pin states.

My solution was to steal the code from the SwitecX25 class and change the stateMap[] to
Code:
// State  3 2 1 0   Value
// 0      1 0 0 1   0x9
// 1      0 0 0 1   0x1
// 2      0 1 0 0   0x4
// 3      0 1 1 0   0x6
// 4      0 0 1 0   0x2
// 5      1 0 0 0   0x8
static byte stateMap[] = {0x9, 0x1, 0x4, 0x6, 0x2, 0x8};

I will create a PR for the library to include X27 support. (If i have time)
 
Back
Top