13 responses to “Joystick and 2 28YBJ-48 stepper motors”

  1. Wireless control of 2 stepper motors

    […] month ago I wrote a sketch to control 2 little stepper motors with an analog joystick. After getting the Nrf24L01 modules to […]

  2. Joe Bell

    Hi, Your sketch is excellent, one quick question would it need modiying much if my steppers are running through an ADAfruit Motor Shield?


  3. Marius

    Regarding the >2000 steps: I think the motor itself has 48 steps/turn plus a 1/64 reduction gear. This results in 48×64=3072 steps per turn.
    And 92 mA is the current per wire, not for the whole motor…

  4. Matt

    Awesome but wont work for me and I cant tell why, would there be anyway to incorporate buttons for left right?

  5. John

    This is just what I am looking for to do some pan and tilt. Any chance I can get a quick diagram. I am trying to figure out how the power is hooked up from the joystick-it is an older style analog with two pots.

  6. Michael

    Can I ask for a plain , easiest Wiring diagram of the kit ??

  7. Wolfgang Sewelies

    Hello, thank you for the helpful videos.
    I am complete novice and’d eden Remote head of my self-built camera crane control as follows. With Joystick X; Y;. Speed and a soft start via potentiometer. Can you provide me an appropriate Skatch available. I would be very grateful.

  8. Jean-Yves

    You can add some lines in the original code.
    I use also a LCD display 1602 I2C.
    // http://www.bajdi.com

    // 2 stepper motors controlled by a joystick
    //moteurs 28YBJ-48 Driver ULN2003
    LiquidCrystal_I2C lcd(0x27,16,2);

    const int stepsPerRevolution = 64; // change this to fit the number of steps per revolution
    int vitesse;
    // for your motor

    // initialize the stepper library for both steppers:

    Stepper small_stepper(stepsPerRevolution, 8,10,9,11);

    Stepper small_stepper2(stepsPerRevolution, 3,5,4,6);

    void setup() {
    lcd.print(“Deux moteurs”);
    lcd.setCursor(0, 1);
    lcd.print(“Vit: “);

    // set the speed of the motors

    small_stepper.setSpeed(200); // set first stepper speed

    small_stepper2.setSpeed(200); // set second stepper speed


    void loop() {

    int potar = analogRead(A2);//read valuefrom potentiom├Ętre
    //change scale for compatibility motor step
    vitesse = map(potar,0,1023,100,300);
    small_stepper.setSpeed(vitesse); // set first stepper speed

    small_stepper2.setSpeed(vitesse); // set second stepper speed

    int sensorReading = analogRead(A0); // read value from joystick X-axis

    if (sensorReading 540) { small_stepper.step(-1); } // step right

    int sensorReading2 = analogRead(A1); // read value from joystick Y-axis

    if (sensorReading2 540) { small_stepper2.step(-1); } // step backward

  9. luke

    how add 2 endstop button please?

Leave a Reply