Hello! I'm an engineering student and I'm working to automate a wheelchair using voice commands with auto-navigation.
I am using 2 24V DC motors with a rated current of 14A and I used 2 BTS7960 motor driver to control it. At first it is working fine, however, when I inserted the Arduino USB cord to another port in my laptop it does not work anymore. I have done serious wiring inspections and I am sure my wirings are correct. And I am sure that the problem is not with the DC motors since I directly connected my DC motors into a 2 12V batteries connected in series.
I guess the main problem is my motor drivers. If anyone can help me on how can I test and determine if my motor drivers are fried or not?
Below is my code to initially test my dc motors:
#define LeftRPWM 12
#define LeftLPWM 13
#define RightRPWM 9
#define RightLPWM 10
#define PWM 11
void motor_cw() //Clockwise
{
digitalWrite (LeftLPWM, HIGH);
digitalWrite (LeftRPWM, LOW);
digitalWrite (RightLPWM, LOW);
digitalWrite (RightRPWM, HIGH);
analogWrite (PWM, 100); //0 - 255
Serial.println ("MOTOR RUNS CLOCKWISE");
}
void motor_ccw() //Counter-clockwise
{
digitalWrite (LeftLPWM, LOW);
digitalWrite (LeftRPWM, HIGH);
digitalWrite (RightLPWM, HIGH);
digitalWrite (RightRPWM, LOW);
analogWrite (PWM, 100);
Serial.println ("MOTOR RUNS COUNTER-CLOCKWISE");
}
void motor_stop()
{
digitalWrite (LeftLPWM, LOW);
digitalWrite (LeftRPWM, LOW);
digitalWrite (RightLPWM, LOW);
digitalWrite (RightRPWM, LOW);
analogWrite (PWM, 0);
Serial.println ("MOTOR STOPS");
}
void setup()
{
Serial.begin (9600);
Serial.println ("START");
pinMode (LeftRPWM, OUTPUT);
pinMode (LeftLPWM, OUTPUT);
pinMode (RightRPWM, OUTPUT);
pinMode (RightLPWM, OUTPUT);
pinMode (PWM, OUTPUT);
}
void loop()
{
delay(800);
motor_stop();
delay(2000);
motor_cw();
delay(2000);
motor_stop();
delay(2000);
motor_ccw();
delay(2000);
motor_stop();
}
If someone can give me any suggestions, thank you in advance