Stepper Motor->Motorknob Example Sketch Bug Reporting -> Where?

Hello,

There's a defacto "bug" in one of the example sketches (s. below) that's delivered in the standard arduino software. Where can I report it?

Problem:

The file->examples->stepper motor->motorknob example sketch uses the pin ordering (8,9,10,11), which is fine in itself, of course, but needs to be (8,10,9,11) so that the stepper library works with the standard driver board without crossing wires, or should at least have a comment to this extent as this is otherwise highly confusing.

Numerous tutorials on the net have the correct pin ordering, e.g. this one (In-Depth: Control 28BYJ-48 Stepper Motor with ULN2003 Driver & Arduino) , which states:

"The step sequence of the 28BYJ-48 unipolar stepper motor is IN1-IN3-IN2-IN4. We will use this information to control the motor by creating an instance of the stepper library myStepper with the pin sequence 8, 10, 9, 11.

Make sure you do it right; otherwise, the motor won’t work properly."

This cost me personally a couple hours of time to figure out and can be found multiple times in the forum (e.g. MotorKnob Tutorial problems) without a direct resolution.

cheers,

I'm not a super expert, but as far as I can tell, the official arduino stepper tutorial on this page https://docs.arduino.cc/learn/electronics/stepper-motors/

is also wired incorrectly. You need to cross the wires on pins 9 and 10 for the standard Stepper.h library to work.

Please correct me if I'm wrong...

Report the problem where you found it. That is everywhere you found it.

There is a lot of rubbish out there on the net, like the way you are supposed to wire a RFID reader to an Arduino Uno.

Sadly there is no internet police, just people misunderstand things because of pure ignorance.

you mis-understand me. I refering to an example sketch that's part of the arduino software, not some random example from the internet! The examples I've found in the internet (like the one I cite) actually have the pins correct!

Switch the wires on the ULN2003 from 1,2,3,4 to 1,3,2,4.
Sadly, the internet is a humongous trash pile with a few rare nuggets scattered thinly.

Thanks for the tip. I already figured that out. In this case, it's not the internet being full of trash, it's the official example sketch and stepper tutorial page from arduino that's incorrect. I'm trying to get somebody's attention who can fix it in the arduino distribution and in the official stepper docs.

The tutorial you posted shows a ULN2004 bare IC, not a ULN2003 module that has a socket for the 28BYJ-48's plug, maybe the wires are crossed on the module between the ULN and the socket.

No, they are definitely not crossed.
I assume the wiring of the 28BYJ-48 is different from the wiring of the unipolar stepper in this picture. The picture is not specific to the 28BYJ-48. There is no standard wiring for the connectors of unipolar steppers.

All the 28BYJ-48s I've ever seen required 2 wires be crossed to work with Arduino stepper lib and ULN2003 modules. No big deal. Here's a program I wrote years ago not using Stepper.h.

/* pin 8 to pin 1 on ULN2003, pin 16 to pink,   coilA
       9 to pin 2,                15    yellow, coilC
      10 to pin 3,                14    orange, coilB
      11 to pin 4,                13    blue,   coilD

   Type a number in top of serial monitor for steps to go,
    -2 billion (CCW) to 2 billion (CW) & press [ENTER].
*/
uint32_t tStart,
         tEnd = 7324UL; // microSeconds per step, 4 RPM here
const byte wSteps [8] = {0x01, 0x02, 0x04, 0x08, 0x01, 0x02, 0x04, 0x08};
const byte fSteps [8] = {0x03, 0x06, 0x0C, 0x09, 0x03, 0x06, 0x0C, 0x09};
const byte hSteps [8] = {0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09};
long stg; // steps to go
byte cntr; // step counter

void setup()
{
  Serial.begin(9600);
  DDRB = 0x0F; // set pins 8,9,10,11 to OUTPUT
  PORTB = 0 | wSteps[0]; // set motor to first position
}
void loop()
{
  if (Serial.available() > 0)
    {
      if(Serial.peek() == 'd')
      {
        tEnd = 1000000UL / Serial.parseInt();
        Serial.println(tEnd);
      }  
      else
      {  
        stg =  Serial.parseInt();
        Serial.println(stg);
      }  
      if(Serial.read() == '\n'){}; // skip 1 second delay
    }
  if (stg != 0)                   
  {
    if(micros() - tStart > tEnd)
    {
       tStart = micros();
       stg < 0 ? cntr-- : cntr++; // sets direction 
       stg < 0 ? stg++ : stg--; // adds to or subtracts from stg
                                // depending on direction
       PORTB &= 0xF0 | wSteps[cntr & 0x07];
       //Serial.println(stg);
    }
  }
}

No competition for MobaTools. :grin:

Surely true.
And it is also true for nearly all other stepper libs I know, e.g. like Accelstepper.

MobaTools is an exception because it was originally only intended for the 28BY. That's a long time ago, but nothing has changed in the wiring to the 28BY - what maybe a little bit confusing now. :laughing:

Well very good luck with that. There have been errors in official software on the Arduino platform for ages. But they never seem to get fixed. There is one on using shift registers that puts a capacitor between ground and a signal. This is wrong it should be between power and ground. But they won't change it. As I remember there might be a second example where it is right but the one with the error still remains.