DC Motor Driver Circuit ULN2003 Experiment-Correction L293D

microcontrollerusermicrocontrolleruser Posts: 1,194
edited 2018-12-10 - 04:32:56 in BASIC Stamp
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?
«1

Comments

  • kwinnkwinn Posts: 8,189
    edited 2018-12-07 - 18:00:58
    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?

    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)
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Nuts and Volts Column #6 gives a brief overview of the use of a ULN2003. The schematic shown has a relay, but you can substitute a DC motor. Mind the current limits of the ULN2003 ... 500mA for one Darlington output. You can parallel several outputs (and inputs) to increase this, but there is a total current limit for the chip.
  • If you're just controlling one motor you might consider an n-channel MOSFET. You'll get a smaller package and not have to worry about the voltage drop across the device.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.

  • 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!
  • microcontrolleruser,

    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.
  • microcontrolleruser,

    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
  • JonnyMacJonnyMac Posts: 6,166
    edited 2018-12-08 - 22:53:47
    That is what I mean about a black hole about DC motors with Parallax.
    If we're fair and offering criticism, there seems to be a black hole in your ability to do basic research. Parallax is just one great source of information among many. They're not a motor nor motor control manufacturer, their focus is on microcontrollers. That said, expecting any company to spoon feed you every bit of information you want right this second is just illogical. Engineers do research, and sometimes that's tricky and takes more time that we want. Case in point: the last couple weeks I've been working on an embedded Raspberry Pi project. I'm new to the RPi and to Python. I -- and a colleague -- spent at least half our time doing research that helped us reverse engineer the protocol of a poorly-documented device that we want to control with the RPi. At times it was tough. But we stuck it out and we succeeded.
    NB(Note this) Parallax uses the phrase 'element' in the Stampworks manual. I thought it was a Propeller thing.
    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."
    No Stampworks lesson for DC motor.
    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).
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • idbruceidbruce Posts: 5,850
    edited 2018-12-09 - 12:21:20
    Post deleted for being nonproductive. :)


    Novel Solutions - http://www.novelsolutionsonline.com/ - Machinery Design • - • Product Development
    "Necessity is the mother of invention." - Author unknown.

  • Peter JakackiPeter Jakacki Posts: 8,149
    edited 2018-12-09 - 04:04:06
    I gave up offering assistance because he complained to the moderators. I think after being helpful but ending up exasperated i used the offensive expression "obvious to anyone"....

    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.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    P2CHIP-1.jpg
    P2 +++++ TAQOZ INTRO & LINKS +++++ P2 SHORTFORM DATASHEET
    P1 +++++ Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    Brisbane, Australia
  • I'm just about to order one of these

    Great community if you want to learn about motor control and feedback.
    Failure is not an option...it's bundled with the software.
  • MicksterMickster Posts: 1,327
    edited 2018-12-09 - 11:54:29
    It is a little ironic that the Prop + a power-stage could do what the servo-drive does in this infomercial.



    Failure is not an option...it's bundled with the software.

  • 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.
  • MicksterMickster Posts: 1,327
    edited 2018-12-09 - 14:41:02
    I have only ever used these for small motors

    They work great and I can't even buy the 18200 for what they sell the module for (probably a knock-off).
    Failure is not an option...it's bundled with the software.
  • microcontrolleruser,

    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.
  • Is it okay to connect 5v from power circuit to input pin of L293D?
    If you have a look at the data sheet (hint, hint [research]), you'll find that it's probably not appropriate for your 3v motor.
    http://www.ti.com/lit/ds/symlink/l293d.pdf
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • microcontrollerusermicrocontrolleruser Posts: 1,194
    edited 2018-12-09 - 19:47:26
    Genetix

    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.
  • microcontrollerusermicrocontrolleruser Posts: 1,194
    edited 2018-12-09 - 19:49:36
    Okay.Sorted this out.

    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!

    L293D%20Schematic.png
    1366 x 768 - 227K
  • microcontrollerusermicrocontrolleruser Posts: 1,194
    edited 2018-12-09 - 19:56:10
    NB I just popped it out of 'prewired' IC socket on PDB and put it in center of the PDB breadboard.

    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!
  • The TI datasheet nicely provided by JonnyMac has examples of the use of the L293D for driving DC motors, either unidirectionally or bidirectionally. Reading the datasheet and looking over any available examples often prevents the "venting of the magic smoke" ... an often undesirable event.

  • 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 Wikipedia is a great source for "common sense" explanations of many things including H-bridges.
  • PublisonPublison Posts: 10,720
    edited 2018-12-09 - 22:10:10
    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.
    Infernal Machine
  • @microcontrolleruser, on page three of the datasheet that JonnyMac posted there is a pinout diagram of the L293 and a chart showing the pin functions. That is absolutely essential information not only for any IC but also any driver module that you want to use.
    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.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
  • GenetixGenetix Posts: 1,391
    edited 2018-12-10 - 01:56:53
    microcontrolleruser,

    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.
Sign In or Register to comment.