0

Yesterday I tried to stack a motor shield on a servo motor shield already stacked on my Arduino Uno.

But I realized that I have some problem when I try to use both of them. It seems like some energy is lost or the stepper motor connected to my servo motor shield move weirdly slowly.

I already checked online, and I found some explanations about stacking many shields. About making sure the shields don't use the same pins or SS. As a beginner, help would be very helpful. Thank you.

Here are the two shields I use.

wiki : https://www.dfrobot.com/wiki/index.php/Digital_Servo_Shield_for_Arduino_SKU:DRI0027

On these links, you can find all the specs with the pins used. I think I have some pinß shared by both of them... But not sure.

Does anyone have a solution please? Many thanks in advance.

  • The real answer, you don't know. For example, a shield may need to use the serial port. So a second identical shield may not work as it too may need to use the same serial port. Or it may be that the designer of the shield did something clever and used a software serial port of the 2nd shield. – st2000 Aug 3 '17 at 12:33
  • 2
    The above comment refers only to hardware. There is also the software problem of sharing resources. For instance, a motor shield may use the same timer as an SDCard shield. So the software for each may not work when both are active on the same Arduino. – st2000 Aug 3 '17 at 12:36
  • Thank you for your example. but for my problem , both of my shields is different. They are not same. I just want to kknow if i need buy another arduino , or have a way for make it work – Mehdi Bugnard Aug 3 '17 at 12:38
  • Mhh ok , so , the best choice is to use one shield per arduino i know. But i know too, sometimes we can stack more than one shield. And for my project i want try to make it the lightest and thinest possible – Mehdi Bugnard Aug 3 '17 at 12:39
  • When using more than 1 shield or Arduino library you will always be taking a risk of running out of resources. The only true way to be sure this will not happen is to backwards engineer the shield and / or library until you understand what resources each need. It is a lot of work for a beginner. Many people simply experiment / test to see if a given combination works. Usually for software nothing much bad happens. But for hardware there is always a chance of "burning something up". – st2000 Aug 3 '17 at 13:17
4

First you have to compare the pinouts of the two shields. If the shields use completely different pins then yes, you can use them together.

However if they share pins then you need to look in more detail at what those pins are and how they are being used.

In your example you have SPI being used (pins 10-13) for one shield and PWM (3/11) and GPIO (8/9/12/13) and analog input (A0/A1) for the other shield.

You can see now that there is a conflict. For instance pin 13 for the SPI clock for the DFRobot shield is also being used for one of the GPIO pins of the Arduino shield. Pin 12 for MISO is being used as GPIO. Pin 11 for MOSI is also being used for PWM.

Those are disparate functions on the pin, so it can never work.

However if the SPI pins were being used for both shields as SPI then that could work. In that case it's only the "chip select" pin that needs to be unique for each shield, since SPI is a Master-Slave Bus protocol which can be shared amongst multiple shields.

  • Ok thank you , That's a nice answer !! So even if i want to use a arduino Mega, it's will not work . I think i will use two separate Arduino Uno. – Mehdi Bugnard Aug 3 '17 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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