At the moment, I'm trying to control a 12v motor with the TB9051FTG driver using the Arduino nano every. However after a few hours of trial and error I haven't been able to get a response from the motor yet. I'll link a rough drawing of the circuit, the code, and the parts I'm using below. Any help is much appreciated!
int pwm = 4;
int pwm_2 = 5;
int en = 6;
int t1 = 100;
int t2 = 200;
void setup() {
// put your setup code here, to run once:
pinMode(pwm, OUTPUT);
pinMode(pwm_2, OUTPUT);
pinMode(en, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(pwm, HIGH);
digitalWrite(pwm_2, LOW);
analogWrite(en, 255);
delayMicroseconds(t1);
digitalWrite(pwm_2, LOW);
digitalWrite(pwm, LOW);
analogWrite(en, 0);
delayMicroseconds(t2);
}
Thanks for the help Steve, while this would cause a issue it's not at the heart of the problem. I tried extending t1 significantly and even just leaving the motor at full power, but I saw no changes. Additionally when I watch my power supply, it seems to be drawing no amperage.
Try method 1 of the instructions, instead of method 2.
However, note that this second method restricts the PWM frequencies usable with the driver: the motor outputs on the TB9051FTG have a minimum off-time of about 80 microseconds when turned off with EN or ENB, which limits the maximum achievable duty cycle and makes PWM frequencies above a few kilohertz mostly impractical.
I tried wiring EN to the 5v line but no luck. I believe its a hardware issue. Any tips on debugging whether my motor, motor driver or Arduino are shot? Is it also possible that it might fault out and not work if I don't apply motor power immediately? Because at the moment, I upload to the Arduino then grab the probes from my power supply and touch them to the motor power line.
then grab the probes from my power supply and touch them to the motor power line.
Intermittent power or motor connections can instantly destroy a motor driver.
Even the inductive surge from long power leads can do that, during power up. Pololu has a web page documenting the problem and recommending fixes. You should have a 100 uF or greater cap connected directly across the motor driver power pins.
Solder all power and motor leads directly to the motor driver, or use secure screw terminals if provided, and power up the motor driver before uploading code to the Arduino.