Looking to make my own motor controller

Hello!

I am unsure as to how ambitious this is, but I would like to make a motor controller (via hooking up various ICs) to run two DC motors from my arduino uno. I haven't played with the motors yet, but for arguments sake lets just assume they need 5V to operate (if they don't I'll buy different ones that do).

I was looking at using a few TI ICs to get the job done, and came across this one which seems like it would do the job all by itself: http://www.ti.com/product/sn754410

Does anyone have any experience using this IC or other ICs to drive DC motors?

I am limited to Texas Instruments' selection of ICs for this project, but integrating them with my arduino uno should not prove difficult (or so I assume).

This is just a part of a larger arduino based project I am working on, I am also having trouble with my networking side of things which is much more arduino heavy: http://arduino.cc/forum/index.php/topic,95281.0.html (if you have any suggestions with that I'd appreciate them also!)

Thanks in advance!

The SN754410 is a common motor driver. It is interchangeable with the L293B and L293D. If you find a circuit that uses a L293, you can plop in your 754410 without any changes (you do need to use flyback diodes though)

integrating them with my arduino uno should not prove difficult (or so I assume).

You assume correctly. Here's a start: http://luckylarry.co.uk/arduino-projects/control-a-dc-motor-with-arduino-and-l293d-chip/

Thank you very much for the reply!

I looked into that article and the author seems to actually recommend using the SN754410 in this follow up article: http://luckylarry.co.uk/arduino-projects/obstacle-avoidance-robot-build-your-own-larrybot/

However it does not mention any flyback diodes. What would you recommend using these for?

Thanks again! :slight_smile:

Flyback diodes are required when you switch an inductive load, such as a motor or relay. What happens is a coil of wire will produce a voltage spike when power is removed. This spike can damage transistors and integrated circuits. A flyback diode will short the voltage spike before it can cause damage. They should be connected backwards (anode to ground, cathode to positive). If you just run a motor in one direction, the diodes should be placed as in the following diagrams:

Using an H-bridge, you're going to need 4 diodes per motor, connected as follows (disregard the transistors, the point is the diodes, which need to be from the positive power supply--->motor terminal--->ground)

The L293D has the flyback diodes built in, the L293B does not. The SN754410 has "light duty" diodes built in (for ESD protection). Some people don't add external diodes without any problems, but the H-bridge was not designed for that.

How much power are you needing? And why the Ti constraints? I ask because R/C car motor controls are really easy to interface with, they are reliable and cheap.

Then there are Jaguars.. Much bigger 12V motor drivers and can emulate R/C servos (PWM signal)
And look! they are a Ti product! http://www.ti.com/mcu/docs/mcuorphan.tsp?contentId=100442&DCMP=STELLARIS®ARM®CORTEX+Other&HQS=Other+OT+jaguar

-jim lee

Can anyone give me a schematic on driving 2 motors with the SN754410. I need to be able to control each motor independantly and in forward and reverse. Also, what type of diodes do I need? Would these do the job? Schottky Diode - COM-10926 - SparkFun Electronics . Also If anyone has a diagram for wiring up the L298N Full-Bridge Dual Motor Driver? I want to make the circuit as safe as possible so please note any resistors or other components needed for the setup. I am using it for this gearbox from sparkfun Dual Motor GearBox - ROB-00319 - SparkFun Electronics Thanks for any help you guys can provide.

John_S:
Using an H-bridge, you're going to need 4 diodes per motor, connected as follows (disregard the transistors, the point is the diodes, which need to be from the positive power supply--->motor terminal--->ground)

Why do you need those external diodes if you use N-channel MOSFETs? They already have the body diodes, that should be good for as much backwards current as the transistor can switch forward? (check data sheet)

jimLee:
How much power are you needing? And why the Ti constraints?

Sorry for the late response on this, but I am looking to drive these motors from Pololu at either 3V or 6V: Pololu - Solarbotics GM3 224:1 Gear Motor 90 deg. Output

The TI constraints are so that I can enter this project into the TI Analog Design contest, where it requires the use of at least 3 TI ICs for the project.

I've hooked up the circuit as shown in the tutorial I posted earlier:

I am running it with the following code (where pins 11 and 12 are the LEDs so that I can see where the code is running when):

int motor1Pin1 = 3;                             // pin 2 on SN754410
int motor1Pin2 = 4;                             // pin 7 on SN754410
int enable1Pin = 9;                             // pin 1 on SN754410
int motor2Pin1 = 5;                             // pin 10 on SN754410
int motor2Pin2 = 6;                             // pin  15 on SN754410
int enable2Pin = 10;                            // pin 9 on SN754410
int LED1 = 11;                             
int LED2 = 12;                             

void setup() {
  // set the motor pins as outputs:
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(enable1Pin, OUTPUT);
  pinMode(motor2Pin1, OUTPUT);
  pinMode(motor2Pin2, OUTPUT);
  pinMode(enable2Pin, OUTPUT);
  
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  
  // set enablePins high so that motor can turn on:
  digitalWrite(enable1Pin, HIGH);
  digitalWrite(enable2Pin, HIGH);

}

void loop() {
   digitalWrite(motor2Pin1, HIGH);
   digitalWrite(motor2Pin2, LOW);
   digitalWrite(motor1Pin1, LOW);
   digitalWrite(motor1Pin2, HIGH);
   digitalWrite(LED1, HIGH);
   digitalWrite(LED2, LOW);
   delay(1000);
   
   digitalWrite(motor2Pin1, LOW);
   digitalWrite(motor2Pin2, HIGH);
   digitalWrite(motor1Pin1, HIGH);
   digitalWrite(motor1Pin2, LOW);
   digitalWrite(LED2, HIGH);
   digitalWrite(LED1, LOW);
   delay(1000);
  
}

However the motors do not turn (I have a 9V battery hooked up to the rails, and yes the red rail is backwards here...its negative).

Yet when I hooked up the motors directly to the Arduino they turn...slowly. What is the purpose of a motor controller? Is it anything other than to give the motors power from an external power source? Is using a 9V battery to power 2 3V (or 6V) motors too high? What will happen if I over-volt these?

Thanks for all of the help!

jwatte:

John_S:
Using an H-bridge, you're going to need 4 diodes per motor, connected as follows (disregard the transistors, the point is the diodes, which need to be from the positive power supply--->motor terminal--->ground)

Why do you need those external diodes if you use N-channel MOSFETs? They already have the body diodes, that should be good for as much backwards current as the transistor can switch forward? (check data sheet)

I think this was more in reference to the L293B/SN754410, and not to that particular h-bridge circuit; the datasheet for the IC in question shows a reference schematic for the diodes (refer to the TI L293/293D datasheet for the best example; the TI SN754410 datasheet shows only a connect for a bipolar stepper, which may be somewhat obscure to convert for using a DC motor for a beginner).

DeathByToast:
Yet when I hooked up the motors directly to the Arduino they turn...slowly. What is the purpose of a motor controller? Is it anything other than to give the motors power from an external power source? Is using a 9V battery to power 2 3V (or 6V) motors too high? What will happen if I over-volt these?

Powering from the Arduino will make the motor attempt to draw more current than the AVR chip can deliver, and if you do it for any length of time, will probably fry those particular pins on the microcontroller.

Powering from the battery should work -- just hook it straight up if you want to verify.

The purpose of a motor controller is to allow the low-voltage/current microcontroller to switch a higher current and/or voltage motor. It may also do other things like generate PWM for speed control, stepper motor sequencing, etc, depending on the controller.

If you get "nothing" out of the motor controller, then chances are it's not hooked up right, or you're not talking to it right. If you have a logic analyzer or oscilloscope, that may help you figure out what signals are going where, and compare to what it's supposed to be. If you don't, well, you're going to need a lot of head scratching, re-checking, and muttering "hmmm...." Plus hook up very small sub-circuits to verify that they work the way you think they should work. A LED or volt meter as output testing may also be useful.

Running a 3V motor on 9V will make it run really fast for a little while, and then make it overheat and die. The 9V battery is unlikely to deliver a lot of current at 9V though, so a multimeter may show it delivering less voltage with actual load. Don't rely on this for the life of your motors, though :slight_smile: If you run a 6V motor on a 9V battery, probably nothing terribly bad will happen.

jwatte:

DeathByToast:
Yet when I hooked up the motors directly to the Arduino they turn...slowly. What is the purpose of a motor controller? Is it anything other than to give the motors power from an external power source? Is using a 9V battery to power 2 3V (or 6V) motors too high? What will happen if I over-volt these?

Powering from the Arduino will make the motor attempt to draw more current than the AVR chip can deliver, and if you do it for any length of time, will probably fry those particular pins on the microcontroller.

Powering from the battery should work -- just hook it straight up if you want to verify.

The purpose of a motor controller is to allow the low-voltage/current microcontroller to switch a higher current and/or voltage motor. It may also do other things like generate PWM for speed control, stepper motor sequencing, etc, depending on the controller.

If you get "nothing" out of the motor controller, then chances are it's not hooked up right, or you're not talking to it right. If you have a logic analyzer or oscilloscope, that may help you figure out what signals are going where, and compare to what it's supposed to be. If you don't, well, you're going to need a lot of head scratching, re-checking, and muttering "hmmm...." Plus hook up very small sub-circuits to verify that they work the way you think they should work. A LED or volt meter as output testing may also be useful.

Running a 3V motor on 9V will make it run really fast for a little while, and then make it overheat and die. The 9V battery is unlikely to deliver a lot of current at 9V though, so a multimeter may show it delivering less voltage with actual load. Don't rely on this for the life of your motors, though :slight_smile: If you run a 6V motor on a 9V battery, probably nothing terribly bad will happen.

Thanks for the response! I'll wait until I get back to school (we are on spring break) and use the scopes we got in the lab to fiddle with it. Glad to hear that I most likely won't kill my 6V motor with the 9V battery (and if I do...the thing was only a few bucks).

I'll keep this thread updated as I progress for anyone interested in similar projects.

You might want to put some current limiting resistors on the breadboard for those leds.

justone:
You might want to put some current limiting resistors on the breadboard for those leds.

I thought about it, but I'm only using those LEDs for debugging purposes. They don't really need to do anything specific other than just turn on. Once I have it running I'm going to take those off the breadboard.

Unless they could be sapping the power from the motors I'm not going to worry about it.

DeathByToast:
Unless they could be sapping the power from the motors I'm not going to worry about it.

You might not worry about it, but your Arduino's pins will...

/p00f

DeathByToast:
Unless they could be sapping the power from the motors I'm not going to worry about it.

Let's say a red LED wants 1.6V and 20 mA. At 5V, if it's a fully Ohmic load it will want 65 mw. This may fry the LED, and more importantly, is way above the Max rating of 40 mA per pin. Thus it may fry the Arduino out pins. Ticking time bomb.

Use a 220 Ohm resistor, and you're safe.