Hello Hivemind I need some assistance.
So I have a motor that I pulled from a low voltage cordless drill. The label on the side of the drill says that it is a LESHI MOTOR 540PV-63596 6.4V 150417/D. I am trying to run said motor using an arduino. The hardware I am trying to use is an Arduino Uno, a BTS7960 Motor driver or a L298N Motor driver. The power supply is a wall adapter rated with an output of 5v DC at 2000mA. I have confirmed that just plugging the motor into the adaptor allows it to run at full speed. I am trying to PWM control this motor but so far neither the BTS7960 or L298N works. At best the BTS7960 causes the shaft to twitch but it does not do a full revolution.
The following code is used for the BTS7960
int r_en = 2;
int l_en = 3;
//Use PWM pins
int r_pwm = 5;
int l_pwm = 6;
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
//To enable forward and backward
digitalWrite(r_en, HIGH);
digitalWrite(l_en, HIGH);
//RPM in forward and backward
analogWrite(r_pwm, 255);
analogWrite(l_pwm, 0);
}
And for the L298N
int IN1 = 2;
int IN2 = 3;
int pwm = 6;
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
//To enable forward and backward
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
analogWrite(pwm, 255);
}
Any assistance would be appreciated as I have ran out of ideas and am on the verge of scrapping this project.