Control 2 stepper motors with Bluetooth Module on UNO board

I am going to control 2 stepper motors through drivers (28BYJ-48 / ULN2003) on a UNO R3 board. Can I send instructions from a mobile device App to a single HC05/HC06 to control both motors? I won’t be controlling both at the same time and just need to rotate each motor a step, or maybe a number of steps at a time in either direction. Thanks

Use a better driver board that can control the current to the steppers. Using HC05/HC06 to receive commands would work. Just code the information sent to tell which motor is supposed to move.

I thought that was what the ULN2003 driver boards were for?

DavePreston:
I thought that was what the ULN2003 driver boards were for?

They are, for the 28BYJ-48, yep.

You can definitely do what you want to do. Send a 1 say, might mean motor1 rotates ccw 5 revs; 2 might mean motor1 rotates cc 10 times; 3 means motor2 rotates ccw 5 times then pauses for 2 seconds and goes cw twice.

By the way, since BT into an Arduino is just good ol' Serial, you can test your code very easily by just sending the commands in from the Serial monitor. (Then develop the BT app to send what you already know works.)

PS, I know it works: I used the technique of Ex4 in Robin2's serial tutorial to input a number of revolutions to turn. (disclaimer: from the monitor, not BT, but serial is serial :wink: )

I had these calls:

recvNumberOfRevsWithEndMarker(); //pka Robin2's recvWithEndMarker(), this is non-blocking capture
useNumberOfRevs();  //pka Robin2's showNewNumber(), converts char array to a number

... to these functions:

void recvNumberOfRevsWithEndMarker()
{
  static byte ndx = 0;
  char endMarker = '\n';
  char rc;

  if (Serial.available() > 0)
  {
    rc = Serial.read();

    if (rc != endMarker)
    {
      receivedChars[ndx] = rc;
      ndx++;
      if (ndx >= numChars)
      {
        ndx = numChars - 1;
      }
    }
    else
    {
      receivedChars[ndx] = '\0'; // terminate the string
      ndx = 0;
      newData = true;
    }
  }
}//recvNumberOfRevsWithEndMarker()
void useNumberOfRevs()
{
  if (newData == true)
  {
    numberOfRevolutions = 0;
    numberOfRevolutions = atoi(receivedChars);
    Serial.print(numberOfRevolutions);
    numberOfSteps = numberOfRevolutions * stepsPerRevolution;
    Serial.print(" (Number of steps: ");
    Serial.print(numberOfSteps);
    Serial.println(")");
    Serial.println("Press the start button\n");
    newData = false;
  }
}//useNumberOfRevs()

Time spent digesting Robin2's serial tutorial will be a worthwhile investment.

sayHovis:
They are, for the 28BYJ-48, yep.

You can definitely do what you want to do. Send a 1 say, might mean motor1 rotates ccw 5 revs; 2 might mean motor1 rotates cc 10 times; 3 means motor2 rotates ccw 5 times then pauses for 2 seconds and goes cw twice.

By the way, since BT into an Arduino is just good ol' Serial, you can test your code very easily by just sending the commands in from the Serial monitor. (Then develop the BT app to send what you already know works.)

Thank you very much. I know some of the basics as I built and did small mods on a Geeetech Prusa 3D printer but I am unsure at the moment at what code is run from and stored where. The important thing is that I know it can be achieved so I don't buy hardware then realise it won't work or could have done it a better way. FYI I am going to use this to rotate and pan/lift a camera tripod head small amounts for photographing birds on feeders in my garden. I can already remotely zoom and focus the camera from a mobile device. I'm looking forward to it :slight_smile:

You should ask for advice about how to choose the right motor in the first place though. Yes the ULN2003 is the right driver for that motor, but it might not be the ideal motor for your application....

sayHovis:
You should ask for advice about how to choose the right motor in the first place though. Yes the ULN2003 is the right driver for that motor, but it might not be the ideal motor for your application....

Thanks. I had done that already in a previous thread and this motor/driver were suggested; is there a reason why this motor would not be suitable?

DavePreston:
is there a reason why this motor would not be suitable?

I've never specc'ed a stepper motor in my life, so I wouldn't know how to pick one. Only reason I have two of those is that they (along with their driver cards as a set) are cheap "starter" steppers and I wanted to see how to go about programming steppers for no real reason.

I epoxied a toothpick on each shaft so I can see them turn: that's all I need to do!

sayHovis:
I've never specc'ed a stepper motor in my life, so I wouldn't know how to pick one. Only reason I have two of those is that they (along with their driver cards as a set) are cheap "starter" steppers and I wanted to see how to go about programming steppers for no real reason.

I epoxied a toothpick on each shaft so I can see them turn: that's all I need to do!

Like it :-). I've done enough research to believe they are fit for purpose, cheers