Go Down

Topic: l293dne motor driver (Read 428 times) previous topic - next topic

nithinpoovanna

I am using a l293dne dc motor driver to control the dc motor (attached photo of driver),i am not able to get the connections  right.can someone help ?
From what i have understood
mot1 -connected  to the dc motor
power-using a 9v battery
EN1-given to 5v on the arduino uno
i1-to 3 pwm
i2 to 6 pwm
not sure about the other pins en1-on and J3 which are on the board ,is this program right


int pwm_a = 3;  //PWM control for motor outputs 1 and 2 is on digital pin 3 (or 5,6)

int dir_a = 2;  //direction control for motor outputs 1 and 2 is on digital pin 2 (or 4,7)
void setup()
{
  pinMode(pwm_a, OUTPUT);  //Set control pins to be outputs

  pinMode(dir_a, OUTPUT);
 
  analogWrite(pwm_a, 150);  //set both motors to run at (100/255 = 39)% duty cycle (slow)

}

void loop()
{
  digitalWrite(dir_a, LOW);  //Set motor direction, 1 low, 2 high

  delay(1000);

  analogWrite(pwm_a, 255);  //set both motors to run at 100% duty cycle (fast)


  delay(1000);

  digitalWrite(dir_a, HIGH);  //Reverse motor direction, 1 high, 2 low
 
  delay(1000);

  analogWrite(pwm_a, 150);  //set both motors to run at (100/255 = 39)% duty cycle
 
  delay(1000);
}

nithinpoovanna

dc motor driver

mart256

An schematic would be very useful.
Also the max switching frequency of the L293D is 5kHz. Which frequency are you using?

Go Up