TB67H420FTG Motor Driver Hookup and Program Guide
Vložit
- čas přidán 4. 03. 2019
- This video walks through the different pins of a TB67H420FTG and what they are used for. It also shows a circuit diagram and walks through how to write your own code or use a library.
This is part of a series on how to build a PID line following robot from scratch.
Check out the full article here: robotresearchlab.com/2019/03/1...
Parts
* Motors: 25:1 Metal Gearmotor 20Dx41L www.pololu.com/product/3486
* Teensy 3.2 www.pjrc.com/store/teensy32.html
* TB67H420FTG Dual/Single Motor Driver www.pololu.com/product/2999
* LM7805 Voltage Regulator
* 12V Step-Up Voltage Regulator U3V70F12 www.pololu.com/product/2895
* 1000mAh 2S Lithium Polymer battery
Dynamic Motor Driver Library: github.com/mcc-robotics/Dynam... - Věda a technologie
Just started to put PWM controller into our 1950s Model Trains, great video for background, debug and test. Thank You so much great tips and easy code to follow, Steam Engine Single motor, Diesel Dual Motors, should be CAKE!
Thanks for this great video. Is it also possible to connect direct VCC/GND to the PWM Pins instead of PWM Output pin to have full motor performance?
I don't know that this would work since you'd basically be turning the motor driver on and off completely and there might be some delayed start up due or shutdown due to capacitors in the circuit. In addition, the motor driver has some safety features built in which might conflict with what you are trying to do. There are usually two ways to hookup and achieve PWM with motors. You can provide digital lines to the A and B inputs and a PWM to the enable line which would use digital inputs to control direction and the enable line to control speed. The other way is to have the enable line always high and provide PWM to the A and B lines and apply PWM to A for one direction, PWM to B for the other direction.
However, it should be noted that this is usually on the more simple drivers like the L291. Motor drivers like the one in this video have some features that won't be able to be used if you don't hookup per the directions. Mainly the "brake drive" which basically allows the motors to drive but not coast. Also the brake function is an option you wouldn't have if hooked up differently.
Thanks, i was looking for something to test out my driver for the first time.
quick question, no matter what pwm value I set, the motor just spins at full speed.
This is the only section of code I used, just to try it out.
know what i could be doing wrong?
int motorA1 = 6;
int motorA2 = 7;
int motorPwm = 5;
void setup() {
// put your setup code here, to run once:
pinMode(motorA1, OUTPUT);
pinMode(motorA2, OUTPUT);
pinMode(motorPwm, OUTPUT);
// Drive motor A
digitalWrite(motorA1, LOW);
digitalWrite(motorA2, HIGH);
digitalWrite(motorPwm, 50);
}
void loop() {
// put your main code here, to run repeatedly:
}
Hey, thanks for the feedback. Assuming your circuit is properly hooked up, the only code issue I see is that you are using digitalWrite for the motorPWM, that should be analogWrite. digitalWrite only works for binary outputs like on or off (or HIGH/LOW). Putting a zero in digitalWrite is equal to LOW and any number other than zero is equal to a HIGH so you are simply turning the motor on regardless of the value you put in there.
I would suggest replacing the digitalWrite(motorPwm, 50) with the following
analogWrite(motorPwm, 50);
delay(2000);
analogWrite(motorPwm, 255);
delay(2000);
analogWrite(motorPwm, 0);
This code should turn the motor on to 50 (of 255), then after two seconds increase to full speed (255), then after two more seconds, turn off the motor.
I hope this helps, thanks for the support.
the L298 is not recognized
can you help me please
im using the motor shild rev 3 for arduino uno
What do you mean by "the L298 is not recognized"? do you have an error in the IDE, is your code not moving the motors, etc?
Does your library work when using more than one driver board (for more than 2 motors)
Yes, you just have to create more than one driver object.
Something like this
TB67H420FTG driver1(7, 8, 5, 9, 10, 6);
TB67H420FTG driver2(11, 12, 13, 14, 15, 16);
And then instead of driver.setMotorASpeed you would use driver1 or driver 2. (driver2.setMotorASpeed).
Thanks for watching!
@@RobotResearchLab Thankyou very much!
Link for qtr library??
Here is my QTR library github.com/gberl001/qtr-sensors-arduino
Here is the original one which is more up to date but still seems to have the overflow issue but I haven't confirmed recently. github.com/pololu/qtr-sensors-arduino
does not a name type
Can you provide more information, can you post the full error you are receiving?