0
\$\begingroup\$

First up I am not an EE and am fairly new to this, so please forgive my ignorance.

I have a project that requires me to control 2 unidirectional and 1 bidirectional brushless DC motor at the same time with independent speed control on each motor. From what I can tell the L298 is advertised as being capable of driving 2 bidirectional or 4 unidirectional motors. Hence logic dictates I can hook up one side to my bidirectional and one side to my two unidirectional motors.

Am I correct in my assumption or am I going to burn things out? Also I cannot find a clear answer as to whether I can drive two motors on one side simultaneously (since as far as I understand you digitally toggle a pin to set the direction on one side, and driving two motors on a side seems to just take advantage of the reversing polarity).

If this is not the case, what alternatives could I look at? I do not want to use two bridges because 4 I/O pins is already too much (I have 6 to work with and I still want some sensors). I have considered using an I2C expander, but I cannot seem to find one that supports PWM output. As a last resort I could use an AVR like an ATTiny2313 and use that as an I2C slave, but I'm not really comfortable programming this raw.

One more thing, both size and power are a factor. So I cannot just take one of the few motor shields and be done with it.

Thanks in advance!

\$\endgroup\$
1
  • \$\begingroup\$ EDIT: In ignorance I mistakenly stated I'm using brushless motors. It turns out I'm using a plain old simple DC motor (cheap and cheerful) \$\endgroup\$ Jan 10, 2015 at 20:08

2 Answers 2

1
\$\begingroup\$

Yes, you can drive one bidirectional and two unidirectional brushed DC motors from a single L298. Just connect each unidirectional motor from Vs to one output of the same bridge (eg. OUT3 and OUT4) and you can control it from a single input.

The only limitation is that since there is only one current sense line per bridge, you won't be able to independently monitor each motor's current draw when both are running.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you very much! And I would be able to drive two motors simultaneously off a single bridge at different speeds? \$\endgroup\$ Jan 11, 2015 at 11:00
  • \$\begingroup\$ Yes. You will have independent control of each unidirectional motor. \$\endgroup\$ Jan 11, 2015 at 17:21
  • \$\begingroup\$ Awesome! Thank you very much for taking the time to help me! \$\endgroup\$ Jan 11, 2015 at 21:15
0
\$\begingroup\$

I'm sorry, but you've gone badly astray. The L298 is not appropriate for brushless motors. The control of brushless motors is considerably more involved than for stepper motors, usually involving feedback sensing of shaft position using Hall-effect sensors.

As for control pins, for 3 motors I'm afraid 4 pins is a minimum if you want direction control for even one of the motors. You would need a direction control and 3 step command lines. If you are willing to give up bidirectional capability, you could get by with only 3 lines.

I think you're confusing unidirectional/bidirectional with unipolar/bipolar (applied to stepper motors). And even then, a single L298 can only drive a single motor.

I really don't see a problem using an I2C expander to provide 8 bits of control lines, with 2 lines (direction, clock) going to 4 brushless motor controllers.

However, you should be aware that I2C can be rather slow, and since you have to send each clock pulse as a pair of write commands, you may run into speed problems if you are trying to run all three motors at high speed.

ETA - I now see that you have modified your question to eliminate the "brushless" part. I assume you are now talking about brushed DC motors. As Bruce Abbott has rightly pointed out, you can indeed drive two motors in one direction, and one reversible. And the two unidirectional motors will only have one with a closed-loop current control.

Be aware that controlling the current in a brushed motor will only control speed as long as the load does not vary. And the L298 will not allow much speed control using a resistor at the sense outputs: the voltage across the resistor must not be more than 2 volts.

What you can do is to adjust motor speed by adding a resistor in series with the motor, as long as you realize that it may dissipate considerable power, and size it accordingly. This will affect your size and weight, perhaps a great deal, and will not allow adjustment on the fly.

If you were considering using PWM on the motor drive to control speed, I'd suggest that I2C is probably too slow, particularly with multiple motors, although I really don't know why a low PWM frequency would be a problem in your case, motor noise aside.

\$\endgroup\$
6
  • \$\begingroup\$ Thank you very much for your helpful response! In my use case I do not have any requirement for precision control. My motors just need to turn at a controllable (but not exact) speed. I understand the issue with pins and I figured as much. The issue with I2C expanders I'm finding is that they seem to all be digital (e.g PCF8575). The point about I2C being slow is useful. Is there another 2 wire alternative that is faster? Is there a driver you would recommend for me in this case? Thanks again! \$\endgroup\$ Jan 10, 2015 at 20:00
  • \$\begingroup\$ I can't give you any alternative busses. But why is "digital" a problem? Any brushless motor driver will have exclusively digital inputs. Or were you hoping for a controller where you could give it a speed command, then just tell it to run? Such exist, but they are much bigger than you seem to think. Big bucks, too. \$\endgroup\$ Jan 10, 2015 at 23:02
  • \$\begingroup\$ Sorry, dup comment \$\endgroup\$ Jan 10, 2015 at 23:26
  • \$\begingroup\$ Yes I might just be phrasing myself incorrectly. Since I want to drive my motor using PWM from what I understand (correct me if I'm wrong) a typical I2C expander will not allow me to do this. I have found a few and yes indeed they are quite pricey and large. So much so it seems using a simple AVR is a much smarter alternative. I have found some code to convert an ATTiny2313 into an I2C slave for exactly such a purpose. It's just I prefer to understand the AVR code instead of blindly using it and also prefer using a single chip if I can for power and size. \$\endgroup\$ Jan 11, 2015 at 11:07
  • \$\begingroup\$ Don't get me wrong - You can always PWM, as long as you don't mind the frequency getting low. In your case, I'd guess you can use PWM frequencies in the kHz range. Is this fast enough? Like I said, you'd get audible noise from the motor, but if that's not a problem, then the question is whether or not that will give acceptable motor performance. And that I can't tell you - I don't know what you consider acceptable. \$\endgroup\$ Jan 11, 2015 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.