1

I have a requirement in which I need to run 2 motors and 6 servos. The motors and servos won't be running simultaneously at any given time. what best can I use. I Was hoping to use l293d shield as it powers 2 DC motors and 2 servos, but how do I get other 4 running too ?

I'm aware that l293d shield has 2 free pins pin2 and pin13 that I leverage for signal pins for servo. (am I right in this ?, if so, i'll still need 2 more free pins for signal)

enter image description here

6
  • Please provide a link to the shield that you are using.
    – chrisl
    Oct 28, 2021 at 20:25
  • 2 DC motors with 1 H bridge each need 6 pins in total (each motor 2 direction pins and 1 enable pin). I don't know what shield you are using, but in principle that would leave you with plenty of pins to connect your two servos. Though if the shield connects the enable pins (which are typically driven with PWM) to pins 9 or 10 the servo library would interfere with that. Then you would need a servo library, that uses the other hardware Timer
    – chrisl
    Oct 28, 2021 at 20:55
  • The servo motors I know don't require an h-bridge. Do you want to change their polarity or what's the purpose of the L293d?
    – Sim Son
    Oct 28, 2021 at 21:31
  • Sorry, an image (which is unfortunately also in bad quality) is not really enough. Better would be a link to the actual product page where you bought it. I'm particularly interested in the pin connections of the shield (I mean which component of the shield is connected to which Arduino pin). That will tell you which pins are still free.
    – chrisl
    Oct 29, 2021 at 7:37
  • Bought it from an hobby store. Attaching a link which I feel could be helpful. robojax.com/learn/arduino/robojax_L293D_motor_shield_manual.pdf Adafruit is the actual owner. cdn-learn.adafruit.com/downloads/pdf/adafruit-motor-shield.pdf I haven't been through their manual though. (As it is difficult for me to understand electronics and schematics). Oct 29, 2021 at 9:54

1 Answer 1

1

As to the PDF Guide on page 19:

How can I connect to the unused pins?

The analog pins (analog 0-5 also known as digital pins 14-19) are broken out in the bottom right corner.

Pin 2 has a small breakout since its the only truly unused pin

The remaining pins are not broken out because they could be used by the motor shield. If you are sure that you are not using those pins then you can connect to them by using stacking headers when assembling the kit or soldering onto the top of the header with wires, or using a "Wing shield"

So you should have access to pins A0 to A5 (enough for 6 servos). You might need to solder a pin header in that place before you can actually use them.

The wording "Pin 2 [...] the only truly unused pin" is a bit weird, but if you follow the link to the schematics repo and look at mshieldv12schem.png (which seems to be the schematic just as an image, so you don't need to install Eagle for viewing it) it shows the Arduinos pins A0 to A5 only connected to the pin header and nothing else. This tells me that they are actually free.

2
  • I haven't used analog pins for any PWM application, I guess will have to experiment with that this time. Thanks for the support. Oct 29, 2021 at 13:51
  • The Servo library uses a Hardware Timer, but actually it doesn't use its PWM functionality. The pins are controlled in a timer ISR. Thus every digital pin can be used by the library. Otherwise the library wouldn't be able to support up to 12 servos on the Uno
    – chrisl
    Oct 29, 2021 at 14:58

Your Answer

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

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