DC Motor Driver Circuit ULN2003 Experiment-Correction L293D
microcontrolleruser
Posts: 1,194
Would like to run a 3v DC motor with the ULN2003 driver IC.
So. The big picture is we connect 3 volts to the motor side of the IC and connect the Stamp to the other side.
Just want a Run and an Off at this point.
Is that about it?
So. The big picture is we connect 3 volts to the motor side of the IC and connect the Stamp to the other side.
Just want a Run and an Off at this point.
Is that about it?
Comments
The ULN2803 will drop about 1.5V across the driver so you will be better off using a 4.5 to 5V power supply for the motor. Connections would be:
+5V > [Motor] > [ULN2003 Pin(10-16)
Thank you Kwinn Mike and JonnyMac
Will use that info at build time.
How come there is a 'black hole' about DC motors with Parallax?
My relative and I are going to do DC motors and Steppers second.
Being a DC motor is simpler if you just are turning it on and off.
Parallax seems to think the Servo is the thing.
I think if you build bigger robots DC motors would be better. For one thing price wise.
And 'Let me tell you another thing!' as the old timer used to say.
The projects motorizing car models, model tanks and ships like destroyers (Lindberg 36" long one)
with DC motors and a micro seem to be MIA around here.
Guess they were all done 15-20 years ago and I missed it. Rats!
Why do you want to use a ULN2003 for a DC motor when the L293D is perfectly suited for it?
The ULN2003 is great for a Unipolar stepper motor where each coil is either on or off, but a bipolar stepper motor and a DC motor also need the current to flow in BOTH directions.
The L293D is already mounted on the PDB and will control 2 DC motors or a 4-wire bipolar stepper motor.
The L293D can make the DC motor go Clockwise, Counter-Clockwise, or stop by just changing the values of the Input pins.
If you connect one of the inputs to the other through and Inverter then you can control the direction with just one I/O pin.
You can then then use another pin to control the Enable pin and turn the motor on and off.
You need an H-bridge configuration like the L293D to control the direction of a DC motor since the connections are opposite for opposite directions.
"Why do you want to use a ULN2003 for a DC motor when the L293D is perfectly suited for it?"
Because the manual for stepper describes it.
That is what I mean about a black hole about DC motors with Parallax.
I know where the DC motor with that IC lesson probably is. Stampworks.
Yes. The DC motor was covered better in the 90's and then it sort of fell by the wayside with Parallax.
Actually we have a board with L293D ready to roll.
http://www.futurlec.com/Mini_DC_Motor.shtml
That would be a little boring just hooking Stamp up to that.
We will do it the Stamp works way with PDB and the L293D module.
Larn something.
No Stampworks lesson for DC motor.
Will just wing it with PDB and L293D.
SOLUTION
Going to pop the L293D off PDB and stick it on breadboard.
That way the connections are like diagram for for L293D in Stampworks Stepper motor lesson.
Will look for spare L293D in parts bin overnite.
Will work on this in the AM. Use one channel of L293D for DC motor.
NB(Note this) Parallax uses the phrase 'element' in the Stampworks manual. I thought it was a Propeller thing.
Seems to mean directive, instruction, etc. Don't hear that much in the micro world. Usually just say what it is.
I know these DC Motor tutorials are for Arduino but they can be altered for the BS2.
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors
https://learn.adafruit.com/adafruit-arduino-lesson-15-dc-motor-reversing
FTR: I wrote StampWorks long before the Propeller was released (it was in early development). There are many elements to a program: constants, variables, directives, includes/libraries, instructions, comments, etc. I chose "element" because it conveys the idea better than "thing."
There's nothing about DC motor control because you can only turn motors on and off; PWM in the BASIC Stamp only lasts as long as the instruction. Perhaps you should consider the Propeller where one can easily construct a multi-channel PWM engine (many of us have) for running motors (one direction, but with speed control) or controlling the brightness of LEDs. The PWM instruction in the BASIC Stamp was designed to charge an RC circuit for pseudo-analog output (see experiment 22 in StampWorks).
This is the most helpful, friendliest, knowledgeable, and experienced forum. If you can't get help here or just can't plain get it as to understanding what has been plainly and patiently explained, you won't "get it" anywhere else. But if you bag Parallax for your own shortcomings, you draw the ire of the forum members, although we always remain friendly and receptive.
Great community if you want to learn about motor control and feedback.
Thank you JonnyMac and Mickster
Is it okay to connect 5v from power circuit to input pin of L293D?
Is the signal from micro different? Less amperage?
Would just like to see DC motor run. Can write a little program later.
They work great and I can't even buy the 18200 for what they sell the module for (probably a knock-off).
It depends on how much current your motor will use.
It's best if the motor has it's own power, such as from batteries, but just remember to connect the grounds together.
When a motor first starts and when it stalls, it will draw a lot of current which may cause the microcontroller to reset.
You can place a large capacitor across the power pins to act as 'shock absorber', but the negative lead must be connected to the ground side or it will explode.
http://www.ti.com/lit/ds/symlink/l293d.pdf
Sorry. Guess I said that wrong.
I mean just with the chip and the motor.
Can I connect 5v to the micro control pin on the L293D or will that fry it?
Instead of a micro high signal.
Thank you JohnnyMac
Just plunking around with this.
Where do I connect the two leads of the DC motor?
"makes it ideal for creating h-bridge motor driver
circuits, or for driving unipolar and bipolar stepper
motors."
That says it is suitable for one DC motor. Ugh! Takes a while to figure that out!
Happy holidays!
That way it is a 'one for one' connection.
No reading schematic to translate what is written on board to what pin it actually goes to.
Happy holidays!
Thank you Mike
Reading the datasheet really does not help me much.
SOLVED!
Found a plain talk(common sense) article on 'L293 Connecting a (different micro) to DC motor'.
Has nice explanation of H bridge. Finally! After all these years of seeing 'H bridge'.
All set!
I will look up Parallax H bridge.
I think they had some leftover motor driver boards or parts that were around for awhile.
The real deal is a simple one or two motor H bridge board.
Will see if there was one.
I never liked that one that looked like a little cube. Didn't look right to me.
Here's a Parallax board that looks okay.
https://www.parallax.com/product/28820
Has documentation.
The board that you quoted is made by Pololu and sold by Parallax.
Parallax makes an H-Bridge board:
https://www.parallax.com/product/28231
It is used on the current Arlo Robot.
Reading datasheets and supplied documentation are part of building circuits. You will make 'magic smoke' from time to time. That's also part of building circuits. Check your connections with a meter before you apply power.
I found 2 websites that show how to hook up 2 DC motors to an L293D but the code is for other microcontrollers.
The 1st uses the same diagram from StampWorks and the 2nd shows the connections directly to the chip.
http://www.me.umn.edu/courses/me2011/arduino/technotes/dcmotors/L293/L293.html
http://arduinoguides.blogspot.com/2012/06/using-l239-motor-driver.html
One of the worst things that you can do is keep moving BS2s and ICs from board to board since sooner or later you will damage a pin or a board.
The L293D is such a common chip that a decent electronic supplier will have it in stock.
Oh, and while looking for your diagrams, I saw that someone in an Arduino forum noted that the L293D will drop as much as 2 Volts so you need to add 2V to what the motors need.