Controlling stepper motor using TB6612 Stepper Motor Driver Breakout Board - Page 1
Forum section: electronics / general

author: Zainiii
author_rank: Contributor
timestamp: November 02, 2024, 02:33:21 am
content: 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-motorsthe code isCode:#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 toStepper stepper(STEPS, 4, 5, 6, 7);void setup(){Serial.begin(9600);Serial.println("Stepper test!");// set the speed of the motor to 30 RPMsstepper.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 pumpfew 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 motormy 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

author: brucehoult
author_rank: Super Contributor
timestamp: November 02, 2024, 02:53:30 am
content: 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.

author: mikerj
author_rank: Super Contributor
timestamp: November 02, 2024, 10:15:27 am
content: Quote from: Zainiii on November 02, 2024, 02:33:21 amDo 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.

author: Zainiii
author_rank: Contributor
timestamp: November 02, 2024, 08:32:09 pm
content: 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

author: Zainiii
author_rank: Contributor
timestamp: November 02, 2024, 08:37:03 pm
content: there is no problem in the wiring side, wiring diagram is attached below for clear illustration

author: mikerj
author_rank: Super Contributor
timestamp: November 02, 2024, 09:52:40 pm
content: 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?

author: Zainiii
author_rank: Contributor
timestamp: November 02, 2024, 10:37:47 pm
content: 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 motorI 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 moveI 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 changesi 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.

author: brucehoult
author_rank: Super Contributor
timestamp: November 02, 2024, 11:09:39 pm
content: Quote from: Zainiii on November 02, 2024, 08:37:03 pmI refer you to my previous comment.

author: sarahMCML
author_rank: Regular Contributor
timestamp: November 03, 2024, 02:06:55 am
content: 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.