Hi all, new to arduino and I have been having a problem
I am trying to control a 24V 15A DC motor (quite a large motor yes) and I am using an Arduino UNO with a BTS7960 motor driver module. I am supplying the motor driver with a 24V 26.5 A power supply. The BTS7960 has a peak current rating of 43A.
I have been trying to have bidirectional speed control using a potentiometer and PWM signals. I have tested the driver by initially inputted simple commands, but when i try to introduce the potentiometer, the control does not seem very robust. I have verified that my PWM code works by implementing it on LED's. i have burned my BTS7690 out at the VCC pin it seems( the module started sizzling and my power supply started working very hard with its fans operating very loudly).
- Is there something fundamentally wrong with my code?
- Is the BTS9760 motor driver module not strong enough to drive my DC motor?
- Do i have a to strong power supply that when i implement my code, exceeds the max current ratings?
- is my logic of LPWM and RPWM correct if i understand it as clockwise and counterclockwise rotation?
Please help
Here is my code
int sensor_value=0;
int RPWM_output=0;
int LPWM_output=0;
int enable=0;
int RPWM = 6; // Arduino PWM output pin 9; connect to IBT-2 pin 1 (RPWM)
int LPWM = 9; // Arduino PWM output pin 10; connect to IBT-2 pin 2 (LPWM)
int R_EN = 7;// H-BRIDGE enable pin pin 1
int L_EN = 8;// H-BRIDGE enable pin pin 2
void setup()
{
pinMode(RPWM, OUTPUT); //pin 9 arduino, pwm output, right(clockwise)
pinMode(LPWM, OUTPUT); //pin 10 arduino, pwm output, left(counter clockwise)
pinMode(R_EN, OUTPUT); //pin 7 arduino, right enable bridge
pinMode(L_EN, OUTPUT); //pin 8 arduino, left enable bridge
pinMode(A4,INPUT); //pot input
delay(1000);
Serial.begin(9600);
digitalWrite(R_EN,HIGH);
digitalWrite(L_EN,HIGH);
delay(100);
}
void loop()
{
sensor_value = analogRead(A4);
if (sensor_value < 401) // this will be for clockwise rotation, with the speed decreasing as sensor_value increases
{
RPWM_output = map(sensor_value, 0, 400, 255, 0);
analogWrite(LPWM,0);
analogWrite(RPWM, RPWM_output);
}
else if(sensor_value > 699) // this is for counter clockwise rotation, with the speed increasing as sensor_value increases
{
LPWM_output = map(sensor_value, 700, 1023, 0, 255);
analogWrite(RPWM,0);
analogWrite(LPWM, LPWM_output);
}
else //a buffer region where the motor will be stationary
{
analogWrite(RPWM,0);
analogWrite(LPWM,0);
}
}