I am trying to control a 28BYJ-48 stepper motor + ULN2003 motor driver module (this is a picture) using MATLAB.

I tried to follow the instructions on this page, but these instructions are specific to Adafruit MotorShield, and I couldn't understand how to modify the code to fit my motor/driver.


  1. How do I wire my motor/driver/Arduino?
  2. How do I modify this command:

    shield = addon(a, 'Adafruit\MotorShieldV2')
  3. Do I need to flash my Arduino with any libraries?

1 Answer 1


Adafruit Motor Shield V2 itself generates signals that are required for motor control.

ULN2003 motor driver module requires signals at the input. This is a significant difference.

Example of use this driver with MATLAB. Not need to flash Arduino any libraries.


pins={'D8', 'D9', 'D10', 'D11'};
steps={'1100', '0110', '0011','1001'};

steps_size=size(steps,2);                        %steps = 4

for i = 1:50

    step = steps{mod(i,steps_size)+1};      % step=1,2,3,4

    for j=1:4
        writeDigitalPin(a, pins{j}, str2double(step(j)));



Wiring example (Copied from CheapStepper v0.2) Copied from [CheapStepper v0.2]

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