DC Motor control
Bob2bot
Posts: 13
in BASIC Stamp
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.
Comments
-Phil
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
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 750
PAUSE 20
NEXT
DEBUG "All done."
END
Also see this:
Make sure your connections are like this, (Reciever is replaced by your BOE)
https://smile.amazon.com/Tracked-Platform-Aluminum-Chassis-Arduino/dp/B0746FYXYQ/ref=pd_rhf_dp_p_img_4?_encoding=UTF8&psc=1&refRID=W7EC75F1GS193HX8RV3P
An ESC is a lot more efficient than a relay especially when you are using batteries that have a limited energy capacity.
https://hobbyking.com/en_us/turnigy-20a-brushed-esc.html
I have used it on 6 volt tank I had laying around. Worked great.
Mike
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.
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.
Most likely those are toys motors which are not as efficient or durable as an R/C motor.
https://smile.amazon.com/Topoox-15000-16500RPM-Electric-Science-Experiments/dp/B073Q2Y3RC/ref=sr_1_5?ie=UTF8&qid=1527801381&sr=8-5&keywords=dc+motors
https://smile.amazon.com/Topoox-15000-16500RPM-Electric-Science-Experiments/dp/B073Q2Y3RC/ref=sr_1_5?ie=UTF8&qid=1527801381&sr=8-5&keywords=dc+motors
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 need to share a lot more information.
A link to the motor model.
A link to the motor controller model.
What micro controller are you using?
What code are you using?
A picture of the setup would help immensely.
'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
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 750
PAUSE 20
NEXT
DEBUG "All done."
END
Firstly, I can see your confusion with the two wires on the ESC. That ESC does not have a BEC, (Battery Elimination Circuit), which normally feeds power to a Flight Controller through a Red wire. The Black is Ground, and the White is signal.
Second, the components you have will only do continuous rotation. You can not command a rotation angle. The Pulse Out commands will determine the speed of rotation.
Hope that helps.