I've wired a small 6v DC motor up to an L293D chip and it works perfectly in one direction.
I currently have the power to leg #2 set to high and leg #7 set to low via the digital output pins on my Arduino. This makes the motor spin anti-clockwise, and I believe that reversing these (2 = low / 7 = high) should reverse the spin of the motor and turn it clockwise.
For some reason this doesn't work at all, and just produces absolutely no movement.
I've attached a simple schematic showing the wiring for the circuit, and I've included the code below. I've checked all the connections and everything is definitely wired up correctly.
Does anybody have any ideas? It's driving me crazy that I can't get this thing to spin the other way!
int enablePin = 5;
int directPinA = 4;
int directBPinB = 3;
void setup() {
pinMode(enablePin,OUTPUT);
pinMode(directPinA,OUTPUT);
pinMode(directPinB,OUTPUT);
}
void loop() {
digitalWrite(directPinA,HIGH);
digitalWrite(directPinB,LOW);
digitalWrite(enablePin,HIGH);
}
stotty146:
Does anybody have any ideas? It's driving me crazy that I can't get this thing to spin the other way!
Physically reverse the wires to the motor, and see if it's actually capable of running the other way. (Or do that just with a battery and no Arduino / 293)
If that's ok (or even before) check the polarity of the 293's output with your meter or an led with resistor.
Hi,
Have you got hte gnd of the 293 connected to the gnd of the UNO, and have you got pin16 of the 293 connected to 5V of the UNO to supply the 293 driver logic.
Check my additions to your circuit.
TomGeorge:
Have you got hte gnd of the 293 connected to the gnd of the UNO
Hi Tom,
Turns out this was the issue!
Apologies for the rookie mistake, I'm still completely new to this. I connected the GND rail on the breadboard (supplied by an external module) to the GND pin on my Arduino and the motor now spins in either direction as expected.
Thanks very much for helping lesson learn to always connect the grounds when using external power!