Driving 28byj-48 with A4988

I am having trouble driving 28byj-48 with A4988. I want it to have more torque since standard-driven 28byj-48 with ULN2003 cannot sometimes start my device and needs a push to start going. I have read that if you remove the red wire from the motor and swap the pink wire with the yellow one it becomes bipolar and can produce more torque. The motor was working fine with ULN2003 but after rewiring and with the A4988 it does not even move.

This is the schematic I have applied:

Arduino nano:
pin 5 to DIR pin on A4988
pin 6 to STEP pin on A4988,
pin 27 to 5v from LM2596
pin 29 to GND from LM2596

A4988 driver ( current was set to 0,15V):
SLEEP 6 and RESET 5 pins bridged together
pin 7 STEP to pin 6 on nano
pin 8 DIR to pin 5 on nano
pin 9 GND to GND from LM2596
pin 10 VDD to 5v from LM2596
pin 11 1B to orange on 28byj-48
pin 12 1A to pink on 28byj-48
pin 13 2A to yellow on 28byj-48
pin 14 2B to blue on 28byj-48
pin 15 GND to GND from the power supply
pin 16 VMOT to 12v from the power supply

28byj-48
LM2596

This is the code:

#include <Arduino.h>
#include "A4988.h"

#define MOTOR_STEPS 200

#define DIR 5
#define STEP 6


A4988 stepper(MOTOR_STEPS, DIR, STEP);

void setup() {
    stepper.setRPM(120);
    stepper.setMicrostep(2);
}

void loop() {
    stepper.move(1);
    stepper.move(-1);
}

With all of the above motor does not even budge not even a sound.
I will appriciate any suggestions at this point.

Hmmm, let me think about that. :thinking:

Given that you have wired and coded it correctly - I have no idea about that - you now have two coils in series, thus twice the resistance and half the current.

Half the current through twice the turns = exactly the same magnetic field and thus torque. Twice the inductance means slower response. Can't see any benefit really other than conserving current.

Most certainly for a 5 V motor - apparently you have the 12 V version - the obsolete ULN2x03 wastes of the order of 1.5 V and it is important to get rid of that. Less significant for a 12 V motor.

A TPIC6B595 is pretty much a perfect driver for this motor, even the 5 V version IIRC, in unipolar mode but cannot do the "bipolar" trick to conserve current - which appears to be the only advantage.

You have something wrong, but without fully examining your setup I cannot see what it is. :face_with_raised_eyebrow:

The Fritzing might have come from this site.
Leo..

Double check your pinouts. The stepper coils go A-C-B-D IIRC and not A-B-C-D as you would expect.

@Paul_B for this torque reasereach I referenced those videos:

From what I have understood by cutting the red wire/trace we are doubling the torque. But I understand nothing from the since of this so I just as well might be wrong. One way or another I want to give this a try - if nothing else just to debunk it :slight_smile:

I have cut the trace and checked the resistance and it was like on the video (come to think of it unplugging red the wire would probably do the same trick)
The motor is a 5v version.

@madmark2150 for the pinouts I referenced this video and specs

from that 28byj-48 pinout should be
Blue Coil 1A
Yellow Coil 1B
Pink Coil 2A
Orange Coil 2B

I checked and I have 45ohm resistance between yellow and blue and between pink and orange.

pin 11 1B to orange on 28byj-48
pin 12 1A to pink on 28byj-48
pin 13 2A to yellow on 28byj-48
pin 14 2B to blue on 28byj-48

Is this connection correct?

And yes I referenced mentioned guide by Wawa but I painted in my nano and how I have connected it. To be honest I am not sure if the 5V is even needed and if all the connections are correct.

So I am not sure if I messed up something with the pins or maybe the code is incorrect?

Hi,
The stepper you are using has five wires and is called a unipolar stepper.

You are trying to use it like a bipolar motor, here is a very interesting link;

28BYJ-48-5V-Stepper-Motor-pinout
You do no have two separate isolated coils as in a bipolar stepper, but 4 coils connected to a common point.

Tom... :smiley: :+1: :coffee: :australia:

@TomGeorge hey if by the common point you mean the red wire than as mentioned i have cut the trace that led to the red wire and desolder it from the motor.

I checked the resistance and only pairs blue + yellow and orange + pink has now the resistance as per video below:

Hi,
So you now have a stepper with two isolated windings.
By removing the centre connection you will end up with a 10V stepper, as the two windings that make each new winding are in series.

Note that these steppers are actually used in AC wall mounted systems to move the output vanes and in ice making machines to tip the water/ice tray.
In both cases usually mechanically balanced devices that don't need much torque.

The steppers that give you "decent" torque are the very low coil resistance steppers that are current driven.

Torque is a product of current, so you may not be able to pass the amount of current you require through the 28BYJ windings.

Good try to see what they can do, but unless you can increase the current through them you will not get an increase in torque, the relatively high resistance of the 28BY indicates fine gauge coil windings, so not a lot of high current capability.

Tom... :smiley: :+1: :coffee: :australia:
PS, It would be interesting to increase the powersupply voltage to get more current to see when they self destruct, (let the smoke out).

First I would have to move them but so far no luck

Guess what - the A4988 driver was effin faulty from the get go...

I changed the code to this

const int EN=2;         //ENABLE PIN
const int Step=3;       // STEP PIN
const int dir=4;        // DIRECTION PIN
/*----------------------------SETUP FUNCTION--------------------------*/
void setup() 
{
  pinMode(EN,OUTPUT);     // ENABLE AS OUTPUT
  pinMode(dir,OUTPUT);    // DIRECTION AS OUTPUT
  pinMode(Step,OUTPUT);   // STEP AS OUTPUT
  digitalWrite(EN,LOW);   // SET ENABLE TO LOW
}

/*----------------------------LOOP FUNCTION--------------------------*/
void loop() 
{
  digitalWrite(dir,LOW);        // SET DIRECTION LOW FOR FORWARD ROTATION
  for(int x = 0; x < 1000; x++) // LOOP 1000 TIMES FOR 1000 RISING EDGE ON STEP PIN
  {
    digitalWrite(Step,HIGH);    // STEP HIGH
    delay(1);                   // WAIT
    digitalWrite(Step,LOW);     // STEP LOW
    delay(1);                   // WAIT
  }
  delay(10);                    // DELAY BEFOR SWITCH DIRECTION
  digitalWrite(dir,HIGH);       // SET DIRECTION HIGH FOR BACKWARD ROTATION
  for(int x = 0; x < 1000; x++) // LOOP 1000 TIMES FOR 1000 RISING EDGE ON STEP PIN
  {
    digitalWrite(Step,HIGH);    // STEP HIGH
    delay(1);                   // WAIT
    digitalWrite(Step,LOW);     // STEP LOW
    delay(1);                   // WAIT
  }
  delay(10);                    // DELAY BEFOR SWITCH DIRECTION
}

I changed the pins on the arduino repectivly ofcourse - but still no luck. Then I started swapping motors -still nothing.

Finally I started swapping A4988 - I bought 5 of them and out of those five one that I started with was giving me the reading on current limiter screw and I was able to set up the limit but I did not drive the motor.
One other was not even giving me the reading on the limit screw.
So out of 5 only 3 worked...

I used this video as a guide for setting the VCC

Well, that is rather interesting, as it is in fact, complete nonsense!

So I am wondering why your initial diagram shows it powered by 12 V?

OK, so I have watched the videos posted by a couple of delightfully delusional people. :face_with_raised_eyebrow:

Quite par for the Internet of course! Shades of Dunning-Kruger. :rofl:

My post #2 remains a complete explanation of the situation. The substantial increase in torque for a 5 V motor is the result of dispensing with the 1.5 V drop of the obsolete ULN2x03 driver (that is to say, ULN2003 or ULN2803), so if you use a proper driver such as the A4988 which uses power FETs instead of BJTs you are powering the motor with 5 V instead of 3.5 V. And that is what explains the substantial difference in torque, not how the motor is wired.

Not sure from your earlier post what you had done exactly, the videos refer to cutting the trace to separate the two main coils so the red wire - if you leave it in place - connects to only one.

As it turns out however, that modification is completely unnecessary! :astonished:

Why? Because in bipolar mode, one end of the coil will be switched to one supply and the other end to the other supply, so the middle will be halfway between. But this applies simultaneously to both windings, so if your driver is operated correctly - which is to say it either applies voltage one way round, the other way round, or applies no voltage to either end - there will be no problem if the centre taps remain connected. The driver should not switch both ends to the same supply voltage as that would tend to slow the stepper operation.

Doesn't matter - no need to modify it.

No, you still have a 5 V stepper.

Two windings in series have twice the resistance. Half the current but through twice as many turns, so same magnetic field/ pull/ torque.

However powering with 5 V instead of 3.5 V or less - that makes a difference. :+1:

Paul thanks for the reply.
I think I am powering the A4988 with 12V since it requires min 8v to run the motor per its data sheet.

As for the stepper it is significantly more powerfull but also gets crazy hot - I guess I need to lower the VCC.

Thanks for the help !

Didn't check the detail as to what voltage that driver requires, but an interesting point - putting both halves of the winding into use as I said, halves the current drawn and therefore the power dissipation so while it does not require twice the voltage, you can actually drive it at 1.4 times the voltage - and get more torque that way - to match the original (unipolar) power dissipation.

Note I said 1.4 times the voltage as the power dissipation corresponds to the square of the voltage for a given resistance. Doubling the voltage will cause more heating.

In short, operating in a bipolar mode is twice as efficient as unipolar mode because unipolar mode makes use of only half of each winding.

You're not connecting from the Arduino DIRECTLY to the motor WITHOUT a driver?! You MUST use a driver - typically ULN2003A - card to give you sufficient current to run the motor.

I did NOT suggest cutting a trace. I said to switch the RED WIRE in the USB cable, not to permanently alter the Arduino itself.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.