DC Motor control

I am trying to control 2 dc motors (KEDA 1000 v brushless ) using an H-Bridge Dual motor drive MC 33926 but can't figure out the wiring. There are 3 leads from the motor so not sure where they go, the Parallax tutorial just seems to cover the Arduino board examples. I also bought a Parallax X Rotor 20 A Electronic Speed Controller but again can't find any wiring or code examples. Any help would be appreciated, thanks.


  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 22,227
    edited 2018-02-18 - 20:47:45
    The H-bridge drive is designed for brushed DC motors or steppers and won't work with your motor. The Parallax ESC is the one you want to use. The red and black wires go to your battery. The three sockets at the end go to your motor. You will need to crimp bullet connectors onto your motor leads to make the connections. The black/white twisted cable goes to your servo output (either an RC receiver or your microcontroller): black to ground, white to the control output. If, when you control the motor, it turns in the opposite direction of the one you want, swap any two of the motor wires connected to the ESC.

    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Thanks Phil, I will give it a shot.
  • I plugged the motor to the Parallax ESC and ran the red and black leads to a 9 volt battery and the black and white leads to my Board Of Education (Rev D). Next I ran the following program but all I got was a musical tone and a slight movement of the motor. I then replaced the motor and ESC with a Parallax Standard Servo and the motor responded properly. I think I am on the right path but have hit a roadblock here, any help would be appreciated.
    Here is the program:
    'Program Name ServoTest.bs2
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    counter VAR Word
    DEBUG "Counterclockwise 10 o'clock", CR
    FOR counter = 1 TO 150
    PULSOUT 14, 1000
    PAUSE 20
    DEBUG "Clockwise 2 o'clock", CR
    FOR counter = 1 TO 150
    PULSOUT 14, 500
    PAUSE 20
    DEBUG "Center 12 o'clock", CR
    FOR counter = 1 TO 150
    PULSOUT 14, 750
    PAUSE 20
    DEBUG "All done."
  • A 9 volt battery probably will not cut it. The is very little current to move the motor. You need a 2 cell or better yet a 3 cell Li-Po battery.

    Also see this:
    Eureka!!! With some tests I found out that the pulse width had to be above 800 for my ESC to recognize it. I tested from 800 to 1500. With 1500 not being a good idea because I drained the heck out of the battery. I am going to charge it for a few hours and run some other tests.

    Make sure your connections are like this, (Reciever is replaced by your BOE)

    640 x 262 - 29K
    Infernal Machine
  • Thanks!!
  • I am wanting to get a chassis with two 9v dc motors. Should I use this technique, or relays to provide and cut power?
    Cows say “moo”, right? Well Greek cows say “μ”
  • The ESC gives you much finer control over the power going to the motors than the simple on/off a relay does.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Thanks!
    Cows say “moo”, right? Well Greek cows say “μ”
  • GenetixGenetix Posts: 1,391
    edited 2018-04-13 - 20:05:57

    An ESC is a lot more efficient than a relay especially when you are using batteries that have a limited energy capacity.
  • Here is a good ESC for a good price. Remember to purchase an ESC for Brushed motor, not Brushless

    Infernal Machine
  • You could also use the Parallax dc motor controller as well. It works up to 3 amps: Dual Motor Driver MC33926

    I have used it on 6 volt tank I had laying around. Worked great.

  • Alright, then.
    Cows say “moo”, right? Well Greek cows say “μ”
  • Snagged a sweet pack of DC motors on Amazon. 1.5-6v and 24,000 RPM! These could theoretically be driven directly from the IO pins on a Stamp or Propeller, right?
    Cows say “moo”, right? Well Greek cows say “μ”
  • Mike GreenMike Green Posts: 22,869
    edited 2018-05-30 - 17:06:17
    Probably not. The issue is the amount of current drawn. Even though the motors are rated at the same voltage as used by the Stamps (5V) and the Propeller (3.3V), most logic gates, including the I/O pins of pretty much all microcontrollers, can only output 20-30mA. This is enough to light an LED or drive a low-current relay coil, but not much else. In addition, I/O pins are usually arranged in groups of 8 and there are separate maximum current limits for these groups and for the device as a whole.

    There are all sorts of buffers that can be driven by an I/O pin and can, in turn, handle currents on the order of 1A. Parallax sells the 2N3904 NPN transistor which can handle up to 200mA. Look at the Nuts & Volts Column #6 for examples. You'll also need what's called a flyback diode, something like a 1N4001. This prevents the collapsing magnetic field of the motor (when it's switched off) from frying the transistor and maybe the microcontroller too as a reverse voltage spike is produced by the motor windings.
  • AwesomeCronk,

    No, the I/O pin does not source enough current to drive a motor directly and since a motor is inductive the kickback voltage may damage the I/O pin transistors.

    An L293D can control 2 motors in both directions and protective "kickback" suppression diodes are built into it.
  • Thank you Mike and Genetix. I will look into both of these options, and find what works best. Looking at building a 6-engine model plane or a very small rc car.
    Cows say “moo”, right? Well Greek cows say “μ”
  • AwesomeCronk,

    Most likely those are toys motors which are not as efficient or durable as an R/C motor.
  • With bottle-cap tires(with rubberbands and rubber cement for traction), est. 0.75 in. dia. That's about 2.4 in circumference, so you would travel about 2.4 in per rotation. I'm going to say 15,000 rpm(about 1,500 under max.), so that's 36,000 inches traveled in a minute. 6,000 in. per second. I'm thinking that there is better, safer work for these guys in r/c planes.:smile:
    Cows say “moo”, right? Well Greek cows say “μ”
  • What sort of DC motor driver should I get for these? I would like to be able to run speed(to a degree) and direction.

    Cows say “moo”, right? Well Greek cows say “μ”
  • AwesomeCronk,

    According to the seller (Questions and Answers) the rated current is 0.2 A, the no-load current is about 67 mA, and the stall current is 0.4 A.

    The L293D is rated for 600 mA.
    You control the direction by reversing the polarity of the power source.
  • You reverse the polarity of the power source by using an H-Bridge driver. The L293D has 4 half bridges in it which you can use to control two separate reversible motors (see the link to the L293D datasheet on that page).
  • cavelambcavelamb Posts: 679
    edited 2018-09-17 - 18:28:46
  • cavelambcavelamb Posts: 679
    edited 2018-09-17 - 18:28:29
Sign In or Register to comment.