So I am using a Seeeduino XIAO as my microcontroller which then connects to a ULN2003 board connected to a 28byj48 Stepper Motor. I have wired the Digital I/O pins from the XIAO as D1 -> In1 D2 -> In2 and so forth on the driver board. I am also using the 5V output from the XIAO to power ULN2003 board. I have been looking at the documentation for Circuit Python and Stepper Motors and can't figure out what's wrong with my code (or alternatively if my wiring is the problem). Below is a snippet of my Code:

import board
from digitalio import DigitalInOut
from adafruit_motor import stepper

pin1 = DigitalInOut(board.D1)
pin2 = DigitalInOut(board.D2)
pin3 = DigitalInOut(board.D3)
pin4 = DigitalInOut(board.D4)

motor1 = stepper.StepperMotor(pin1, pin2, pin3, pin4)

for i in range(100):

I am unsure if I am even initializing the motor correctly, so any help would be appreciated!

  • 1
    $\begingroup$ I think you should edit to supply some more information: What are the symptoms? Is the rotor locked or free to rotate? Is any current flowing through the motor? What is the coil voltage (multimeter or oscilloscope reading)? Are you getting switching signals on pin1 - pin4? Schematic diagram? Links to datasheets for the motor, XIAO and ULN2003 board? $\endgroup$
    – Transistor
    Commented Jun 25, 2022 at 7:45

1 Answer 1


As @Transistor commented, having any idea of what is happening or some links to some documentation would be "helpful."

That said, a little looking at the adafruit_motor package shows that it is expecting PWM inputs unless the last argument is None. Please try updating your motor1 line to read:

motor1 = stepper.StepperMotor(pin1, pin2, pin3, pin4, None)

and see if that works better. If it does, great. If not, tell us what you are seeing (and hearing).

  • $\begingroup$ Hey thanks for the reply, I was going to reformat everything and include links but I tried the Arduino library (since that's well documented with these components) and it worked first try, so I think ill just stuck with Arduino since it works. Thanks again! $\endgroup$
    – Geo
    Commented Jun 25, 2022 at 22:15
  • $\begingroup$ Glad you got it going. Making it work is the first thing, something I keep forgetting "solving" problems that would go away if I looked for a simpler solution. $\endgroup$ Commented Jun 26, 2022 at 5:59
  • $\begingroup$ The above code is almost right. As of this writing anyway, the last argument is parameterized: ``` motor1 = stepper.StepperMotor(pin1, pin2, pin3, pin4, microsteps=None) ``` $\endgroup$
    – ericzundel
    Commented Feb 14 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.