# Help with DC Motor

Hey,

So I am trying to using the H bridge I just bought to control a simple DC motor. I am using a l293DNE as h bridge and the dc motor is a 6V plastic gear motor…
I have tried to hook it up and enter the code, but the motor doesn’t move at all! nothing happens! can someone help me with setting up a dc motor on breadboard w/ h bridge? thx

I am literally doing the same exact thing as ^ -- that is, minus the potentiometer and switch...

This is my code:

int enablePin = 11; int in1Pin = 10; int in2Pin = 9;

void setup()

{ pinMode(in1Pin, OUTPUT); pinMode(in2Pin, OUTPUT); pinMode(enablePin, OUTPUT);

digitalWrite(enablePin, HIGH); }

void loop()

{ digitalWrite(in1Pin, HIGH); digitalWrite(in2Pin, LOW); }

I have a hunch my h bridge is the problem....but not sure

That circuit provides the motor power, via pin 8 of the 293, from the Arduino's 5v. That could be the problem... What voltage and current do the motor require?

Maybe throw power into that pin from a source other than the Arduino?- remember to join the grounds together.

the motor is a 6v dc motor.

Well putting 5v into the 293 is probably not enough... Even at 5v, your 6v motor is getting too little, and the 293 loses volts anyway- I can't find the exact number right now, but a recent post here suggested 2-3 volts iirc. So it might be that your nominal 5v is actually only giving ~3 to the motor on the other side of the 293.

Put 6 into the 293 from 4xAAs and see what happens- measure the output voltage. Maybe try a 9v PP3, which should give 6-7 out of the 293?

Edit.... Here it says the voltage drop is 1.5 volts- so at best your 6V motor is getting 5-1.5 = 3.5V. This, btw, is current issues aside: you have the possibility of damaging the Arduino pin, by asking for more current than it's happy with. Absolute max iirc is 40mA, suggested about 20.

Thanks,

I am still very new to this...

So if I get an external 9v battery to power driver, arduino, motor - would that be fine? the driver can handle up to 36v, the motor is 6v... does that mean it requires 6v to run or its tolerance?

thanks

It means it needs 6v to run at top speed. DC motors are controlled for speed by voltage... there is some voltage under which it won't turn at all. I suspect giving yours 3.5 might be too little.

If you power the arduino from 9v, that won't help if you leave the chip pin 8 powered from the 5v output of Arduino... it always gives 5v.

As an alternative, you could use 9v for the Arduino (which will regulate that to 5v for its own use) and take the power to the chip's pin 8 from the Arduino Vin pin, which will be at the 9v. That would give about 7v to the motor: don't run the 6v motor at 7v for too long though, I'm just suggesting this as a test.

BUT..... without knowing what current your motor consumes, it might not be wise to provide its power via the Arduino, and it would be safer to put that 9v into the chip from the battery directly.

And btw, don't confuse the 2 voltage pins on the 293.... Pin 8, bottom left (with the notch at the top), is the voltage for the motor and yes the chip may take 36v there for a ~36v motor. The other voltage pin for the chip is pin 18 Edit: Oops, 16, top right is the voltage which drives the chip itself and should be 5v, at least between 4.5 and 7 anyway.

Thanks, I still need help with identifying the pins though... I have the l293DNE (if the NE makes any difference) and there is a curved notch at one end and a whole circle right on the center at the other end.... so which pin should be one?

The cut out notch is at the top and pin 1 is on its left, numbering down the left 1-8 and up the other side to pin 16 on the right of the notch.

But don't take my word for that, download a datasheet and satisfy yourself on that...

(The "D" means it has the built in flyback diodes; the "NE" means that 16 pin plastic pack.)