Author Topic: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board  (Read 861 times)

0 Members and 1 Guest are viewing this topic.

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 21
  • Country: us
Hi everyone.
I have been facing the issue to run the Bipolar stepper motor using the TB6612 Stepper Motor Driver Breakout Board. On the internet there are many codes available regarding controlling the stepper motor by changing the RPM ,but my motor is working on PPS (Pulse per seconds). i took the code from the ad fruit website to run the motor.
https://learn.adafruit.com/adafruit-tb6612-h-bridge-dc-stepper-motor-driver-breakout/using-stepper-motors
 the code is
Code: [Select]
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 4, 5, 6, 7);


void setup()
{
  Serial.begin(9600);
  Serial.println("Stepper test!");
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(60);
}

void loop()
{
  Serial.println("Forward");
  stepper.step(STEPS);
  Serial.println("Backward");
  stepper.step(-STEPS);
}
but this code didn't work, the company from where i bought the pump having stepper motor provide me one page regarding the flow rate controlling of pump and they also provide me the method how to control the flow rate.
**the method is**
" How It Works:

・The stepper motor has two sets of wires connected to two coils inside the motor.

・We call these coils "Coil A" and "Coil B".

Coil A is controlled by two wires (Black and Brown).

Coil B is controlled by another two wires (Orange and Yellow).

Operating the Motor:

The motor works by turning on these coils in a specific sequence.

First, Coil A is turned on, which moves the motor a little bit.
Then Coil B is turned on, which moves the motor a bit more.
By continuing to switch between these coils in a pattern, the motor rotates smoothly.
Controlling the Speed (and Flow Rate):

・Faster Pulses = Faster Motor = Higher Flow Rate: If we send pulses quickly, the motor turns faster, which pumps the fluid faster.

・Slower Pulses = Slower Motor = Lower Flow Rate: If we send pulses more slowly, the motor turns slower, reducing the flow rate."

the Flow rate related file is attached in the picture. Also, the pin configuration is correct as per my understanding, and pin configuration is also attached in the picture as well.
the motor worked on 10V DC which i applied on Vm pin of the module and the current draw by it is 350mA. With different codes the pump even didn't turn ON and i didn't listen or see any voice of the pump :(
few things i observed.
when i gave the 10vDC to Vm pin of the TB6612 Stepper Motor Driver Breakout Board, without connecting it with Arduino, the multimeter shows the 10V DC across , but when i connected the Arduino to Vcc of this board the voltage drop down to 1.14, Also the pins of the board used to connect with the coil of the motor shows the DC voltage 0, the board picture is also attached below, Motor A two pins used for one pair of motor coil and Motor B 2 pins used for second coil of stepper motor
my questions are.
1) can someone provide me the code to control the flow rate using the PPS method, i saw few codes using the AI tool but no one is working.
2) does in case of controlling the flow rate using the PPS does we need to  change the pins configuration or not.
3) does this pump will work by changing the RPM or we have to control the flow rate using the PPS method

 

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4753
  • Country: nz
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #1 on: November 02, 2024, 02:53:30 am »
Your driver board shows D4, D5, D6, D7 connected to AIN1, AIN2, BIN1, BIN2, but the Arduino wiring diagram shows the pin order as AIN1, BIN1, AIN2, BIN2 (or some renaming of that).

The documentation for the Stepper class and its init function is abysmal -- it doesn't tell you what the function of each argument is.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3376
  • Country: gb
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #2 on: November 02, 2024, 10:15:27 am »
when i gave the 10vDC to Vm pin of the TB6612 Stepper Motor Driver Breakout Board, without connecting it with Arduino, the multimeter shows the 10V DC across , but when i connected the Arduino to Vcc of this board the voltage drop down to 1.14,

Do you mean the 10v VM supply reduces to 1.14v or that the Vcc supply from the Arduino reduces?  You need to provide a circuit diagram of your system, we are just guessing without this.
 

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 21
  • Country: us
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #3 on: November 02, 2024, 08:32:09 pm »
Yes the 10V DC that i gave separately from the DC power supply to the Vm+ pin of TB 6612  dropped down when i connected the VCC pin of TB 6612 with 5V pin of Arduino. Pin configuration is attached for more clear illustration
 

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 21
  • Country: us
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #4 on: November 02, 2024, 08:37:03 pm »
there is no problem in the wiring side, wiring diagram is attached below for clear illustration
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3376
  • Country: gb
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #5 on: November 02, 2024, 09:52:40 pm »
How are you powering the Arduino, just through USB?  Do you have any idea how much current is being drawn from the 10v PSU supply?
« Last Edit: November 02, 2024, 09:57:14 pm by mikerj »
 

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 21
  • Country: us
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #6 on: November 02, 2024, 10:37:47 pm »
I am giving the power to the Arduino using the USB of computer.
on the pins configuration as other people used there is Vm+ pin on the TB 6622 motor driver module, i provided the separate power supply that is 10V DC (verified using multimeter) provided to this pin of TB 6622 motor driver module.
i uploaded this program on Arduino IDE and connected a multimeter across the coil A and coil B of the pump motor
I swapped the black and brown cable (coil A), i also swapped the black yellow and orange cable (coil B) as well.
this thing didn't work and pump didn't move
I have decreased the stepper.setSpeed(60) with number start using from 1,10,20,30,409,50 but i didn't observe movement of the coil.
When i changes the number from 1, 10,20,30,40 and 50, i connected the multimeter along the coil cable to check whether current and Voltage changes
i didn't see any change in voltage whereas the current when i set the multimer to micro Ampere level, it shuffle between 0 and 2. and there is no impact whether which number i used in stepper.setSpeed(60) value,
the program is running fine because the LED light on the Arduino blink as per changing the forward and backward direction as per program set.
 

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4753
  • Country: nz
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #7 on: November 02, 2024, 11:09:39 pm »
there is no problem in the wiring side, wiring diagram is attached below for clear illustration

I refer you to my previous comment.
 

Offline sarahMCML

  • Regular Contributor
  • *
  • Posts: 81
  • Country: gb
Re: Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board
« Reply #8 on: November 03, 2024, 02:06:55 am »
Where in the circuit are you using your meter when measuring current on the microamp scale? Not in series with the motor supply or a motor coil, I trust?
The 10 volt motor supply dropping when you connected your Arduino's supply suggests that it can't source enough current to start the motor turning.
 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf