So a few months back I got my arduino board for a project. I tested the motor and L293D chip, and it worked fine. I didn't need it then, so I continued on with my project. Now, the motor just will not run. Any thoughts or ideas on what may be the problem? (code is just the DC_motor example code) Ask me if you need any more deatails, and thanks a bunch!
What is the stall current and rated voltage of the motor? What is the motor power supply (Volts, Amps)? Can you provide a schematic of your wiring?
Read the how to use the forum stickies to see the type of information that you can provide for better help.
Breadboarded circuits can be pretty unreliable, especially if they've been kicking around for a few months. It looks like you just have the jumper wires poked through the terminals of the motor, which introduces another extremely unreliable connection. You might try wiggling the various connections around.
groundFungus:
What is the stall current and rated voltage of the motor? What is the motor power supply (Volts, Amps)? Can you provide a schematic of your wiring?Read the how to use the forum stickies to see the type of information that you can provide for better help.
The voltage of the motor is five volts, power supply I assume would also be volts.
L293D driver: http://www.ti.com/lit/ds/symlink/l293.pdf
I am using an Arduino Uno r3
Motor is just a 5 volt hobby motor
Schematic is attached
Code:
[code]
#define ENABLE 5
#define DIRA 3
#define DIRB 4
int i;
void setup() {
//---set pin direction
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
Serial.begin(9600);
}
void loop() {
//---back and forth example
Serial.println("One way, then reverse");
digitalWrite(ENABLE,HIGH); // enable on
for (i=0;i<5;i++) {
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(500);
digitalWrite(DIRA,LOW); //reverse
digitalWrite(DIRB,HIGH);
delay(500);
}
digitalWrite(ENABLE,LOW); // disable
delay(2000);
Serial.println("fast Slow example");
//---fast/slow stop example
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(3000);
digitalWrite(ENABLE,LOW); //slow stop
delay(1000);
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,LOW); //one way
digitalWrite(DIRB,HIGH);
delay(3000);
digitalWrite(DIRA,LOW); //fast stop
delay(2000);
Serial.println("PWM full then slow");
//---PWM example, full speed then slow
analogWrite(ENABLE,255); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,50); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,255); //half speed
delay(2000);
digitalWrite(ENABLE,LOW); //all done
delay(10000);
}[code][code]
As for the breadboarded connections, I believe you are right. The LED I have connected to pins 3 and 5 of the l293d chip is turning on and off erratically, even though I have all the pins pushed in securely. Do you have any suggestions to fix this? Also I haven't left the connection sitting, I disassembled it and have just now reassembled it.
EDIT: I tried wiggling the wires as suggested, but nothing changed. The motor does nothing at all until I analogWrite below 255, at which point it makes a whining noise but still does not run
Pin 16 of the L293 needs to go to 5V.
groundFungus:
Pin 16 of the L293 needs to go to 5V.
I connected it, still dosen't work. Maybe I'm misunderstanding what to do? Can you post a correct schematic?
Here is the schematic. Connect all the ground pins to ground, not just one.
Note: The EN pin can be connected to a PWM pin instead of 5V for speed control.
Also, the L293 driver drops about 2 volts, so the motor sees about 3 volts with a 5 volt motor supply.
Hello Spheal,
Can you shared the code to us?
And L293 GND to Arduino GND. Got to have a logic signal return path.