Wired Stepping issue with Jameco: 56 steps makes 360°, 28 steps not making 180°

Hello, I am encountering a super wired issue with Jameco 2138812 unipolar stepper motor (datasheet https://www.jameco.com/Jameco/Products/ProdDS/2138812.pdf). The Attiny 1614 chip has been used as the controller.

According to the datasheet, each step of the motor should be 7.5°, and it should take 48 steps for a full revolution. But my motor behaves quite wired:

  • 48 steps make the motor rotate about 270 degrees.
  • It takes 56 steps to make a full revolution, while 28 steps do not make the half revolution.
  • -6 steps and 6 steps make the motor turn in the same direction, while larger numbers of steps do not have the same problem.

I have tried to power the board with a desktop computer, laptop, and external power supply (7 V) and the same problems occurred in all these conditions.

Have anyone solved or encountered a similar issue? What may be the problem? I know the solution may be too much to ask. I was just hoping to have a hint about which direction should I go for further research. For convenience, I have attached the code and the board and schematics with the thread. Grazie Mille~~~

const int T4_Blue = 3; 
const int T1_Black = 0; 
const int T3_Red = 2; 
const int T2_Yellow = 1; 
const int maxnumberofsteps = 48;

int currentstep = 0; // Indicates in which step I am (0,47)-> your motor do 48 steps in one rotation
int current_location = 0; // Indicates in which position I am (0 to 11)
int num_of_steps = 0;
String inString = "";

#define step_delay 100 

void stepMotor(int step_t) {
  switch (step_t) //
  {
    case 0:
    //Serial.println("Yellow/Red HIGH");
       digitalWrite(T3_Red, HIGH);
       digitalWrite(T2_Yellow, HIGH);
       digitalWrite(T4_Blue, LOW);
       digitalWrite(T1_Black, LOW);
    break;
    
    case 1:
       digitalWrite(T4_Blue, LOW);
       digitalWrite(T1_Black, HIGH);
       digitalWrite(T3_Red, HIGH);
       digitalWrite(T2_Yellow, LOW);
    break;

    case 2:
       digitalWrite(T4_Blue, HIGH);
       digitalWrite(T1_Black, HIGH);
       digitalWrite(T3_Red, LOW);
       digitalWrite(T2_Yellow, LOW);  
    break;

    case 3:
       digitalWrite(T4_Blue, HIGH);
       digitalWrite(T1_Black, LOW);
       digitalWrite(T3_Red, LOW);
       digitalWrite(T2_Yellow, HIGH);
    break;
    
  }
  Serial.print("step_t ");
  Serial.print(step_t);    
 }

// Move x steps (negative will move backwards)
void step(int steps_to_move)
{
  int steps_left = abs(steps_to_move);  // how many steps to take

  int direction = 0;

  // determine direction based on whether steps_to_mode is + or -:

  if (steps_to_move > 0) {
    direction = 1;
  }

  if (steps_to_move < 0) {
    direction  = 0;
  }

  // decrement the number of steps, moving one step each time:

  while (steps_left > 0)

  {

    // increment or decrement the step number,

    // depending on direction:

    if (direction == 1)

    {

      currentstep++;

      if (currentstep == maxnumberofsteps) {
        currentstep = 0;
      }
    }
    else // direction==0
    {
      if (currentstep == 0) {
        currentstep = maxnumberofsteps;
      }
      currentstep--;
    }
    // decrement the steps left:
    steps_left--;

    // step the motor to step number 0, 1, ..., {3 or 10}
    stepMotor(currentstep % 4);
  }
  Serial.print("Stepleft: ");
  Serial.print(steps_left);
  delay (step_delay);
}

void setup() {

  pinMode(T4_Blue, OUTPUT);
  pinMode(T1_Black, OUTPUT);
  pinMode(T3_Red, OUTPUT);
  pinMode(T2_Yellow, OUTPUT);
}

void loop() {

  step (28);
  delay(3000);
  step (56);
  delay(3000);
   

}

brd_and_sch.zip (22.5 KB)

Where is the orange wire connected? Which motor driver are you using? I can't view the .sch file, can you post a .png or .jpg version?

Thank you very much.

The orange wire is connected to an external power supply. I do not have driver, so I used 4 transistors to control the direction.

I have attached the image of the board, schematic, and the connection to the motor.

(mod edit)

schematic.jpg

schematic.jpg

What type MOSFETs? I don't see any kickback diodes to protect the MOSFETs.
Also your step pattern doesn't seem to match the datasheet.