Main Site Documentation

Multiple DC Motor Shields?


#1

I am new to all this but have some ideas on robots etc that I want to build with the kids. From what I can tell you can stack the shields on top of the microcontrollers to add functionality. It appears that the Panda II will be the microcontroller for us. I’m making my list of components to order today and have a few questions:

  • Is it possible to stack two dc motor shields on top of the panda II to provide control of 4 motors? If not, can you point me toward alternatives for access to more than two motors?

  • By the same token, if you need access to more than two servos (that the connect shield would provide for example), how do you manage that?

  • Is the following arrangement possible?
    ==> connect shield (top)
    ==> DC Motor Shield
    ==> DC Motor Shield
    ==> FEZ Panda II (bottom)

Many thanks,
Will


#2

Stackable shields is good but you run into problems when using shields that reuse the same pins. So, you can’t use 2 shields of the same type without hacking some wires. (the new FEZ Spider gadgeteer fixes this problem)

How much do you know about electronics?


#3

I suspected this might be an issue with stacking the shields because two shields with the same pin mapping would conflict with each other. I’m a computer programmer. I would say my hardware electronics knowledge is beginner level but improving. After I posted my question I found another thread about “More PWMs” for quadcopter construction (which is where we’re headed). Part of being able to ask the right questions is learning the vocabulary. So now I understand that Panda II has 6 pwm’s which can control 6 motors, but that’s only the control signal, not the power that the motors require. PWM, once switched on, so to speak, maintains the motor speed without processor intervention required. This was the appeal of the shield, it allows pwm and provides power input for the motor in one package.

So ultimately do you have any thoughts on what is the most direct path to getting control over 4 motors and providing them with power? Is it Panda II’s pwm --> electronic speed controller --> motor?
The ESC takes the signal from pwm and combines it with power, right? Does the ESC in the middle introduce lag time? I understand that responsiveness is important for flight control. If I used this: http://www.practicalmaker.com/content/pwm-shield-assembled would the ports be addressable from code without writing/porting a driver?

My main goal is to get a parts list together so I can order. I don’t mind ending up with multiple orders as I go along, I just don’t want to buy something that I will ultimately not use. If the most straightforward solution is to rewire one of the DC Motor Shields, I’m up for that if you can point me toward the suitable resource for how to do it.

Sorry for the 1000 questions. Thanks for your help,
Will


#4

You can use the ADAfruit motor shield that can handle up to 4 DC motors (or 2 steppers). I made some driver code available here: http://code.tinyclr.com/project/323/adafruit-motor-shield-driver/
However, without modifying a bit the shield (redirect two wires) only 2 motors can vary their speed (the 2 other ones beeing ony foreward/backward). Modifying the board would take you 15 minutes however to redirect 2 driver pins from pure output to PWM able pins.

Also you may be interested by this design:


But you will need to make the driver.

Have FUN :slight_smile:


#5

One will be shield and the second will be any HBridge circuit connected to PWM, like this one http://www.dfrobot.com/index.php?route=product/product&product_id=66


#6

Thanks Nicholas3 and Gus. This is starting to make sense. I went ahead and placed my order this afternoon for among other things the Panda II and two of the DC motor shields. I assumed based on Gus’s comments that it would be possible to rewire, and if successful then I’ll have a nice compact. If not, I’ll have a spare. I’m looking forward to getting started.

Thanks again,
Will


#7

I received my order today and am ready to start work. I’ve examined the documentation and see that the motor shield uses Di4 - Di7 with Di5 and Di6 being the PWM pins. (Is pin the right term?). The other PWM pin is Di10 and the one marked MOD on the Extended Pins. Can someone get me started in the right direction on rewiring to allow two shields? I’m a novice, but if I can get a push in the right direction it would help a lot.

Here’s another big question that might be a problem. I also want to use the Touch screen which uses the Extended pins. Is this even possible?

Thanks,
Will


#8

Can I suggest something, please start with one shield and use it, get familiar with its drivers and PWM then look into Outputcompare and maybe try it on the same shield.

This is easier that you think but has to be done in baby steps :slight_smile:


#9

Okay, thanks. I’ll start with that. It is my understanding that PWM allows for offloading the responsibility of maintaining the motor speed once it has been set from the main processing thread. Is that correct?


#10

yes, you set your PWM up and then it runs at that cycle rate until you stop it. You can also try that on an LED and you can see for yourself.


#11

Guys you do know that you can go to your local hobby store and pick up a brushed speed controller for very cheap and with much higher amperage than all these H-Bridge devices out there.

Such as these:
http://www.hobbyking.com/hobbyking/store/__9090__Turnigy_20A_BRUSHED_ESC.html

You can control them just like you would a RC servo.


#12

Two (or more) of the same motor shields on one Domino?

I solved it with an piece of experimental board and some arduino headers.
Solder 4 headers in the middle of the experimental board to fit the Domino’s headers.
Solder 2x4 headers (maybe even turned around for 90 degrees) in a way that the two motor shields fit in these headers.
Than connect your motor shield headers to the desired pins with some wires.
In this way you can remap the pinning on one or both (or even more) of the motor shields.

I did it in this way some time ago to control two motors and two heaters. Motors were one direction, so I needed 4 PWM’s. If I can find a picture, I wil post it.

Cu, Wim


#13

Thanks for everyone’s input. I am a C# programmer by profession, but am a complete novice with respect to the circuitry. For instance, I’m trying to make a quadcopter and only just now realized that the motor shields were the wrong choice for powering the motors. So I’ve got switch to ESCs. I’m literally drowning in an alphabet soup of acronyms. But that’s part of the fun and challenge of learning a new discipline. It can be frustrating though when you can’t even find a simple example of supplying the motor shield with power. I mean a specific example of connector A soldered to wire B from kind of battery C attached to the motor shield at point D kind of thing. It must be so elementary that nobody documents it. Still, I’m getting there and again thank everyone for their time in responding above.

Will


#14

@ will I feel your pain. It sounds like me and you are going through the exact same process except maybe I’m just one step ahead of you. I’m building tutorials for all these little things you’re speaking about and it just happens that ESCs + brushless motors + NETMF is what I am currently working on documenting. Look for it sometime this week. Check out my “NETMF for Electronics Noobs” tutorials at http://blog.ianlee.info.


#15

Ian,
Thanks for chiming in. I checked out your blog and it looks like a great source of information. I’ll be following your posts. I hope to blog my experiences as well once I’ve learned a little more.

Will


#16

What you’re probably trying to figure out at this point is how to wire the motor, ESC, & board together. In a nutshell…

  1. There are three wires coming out of your motor. On one side of your ESC there will be three thick wires (all the same color or varying colors) and on the other side there will be two thick wires (red & black). Connect the three wires from your motor to the three wires on the one side of the ESC. It doesn’t matter how. If you find that the motor is later spinning the wrong direction, then swap any two of these wires. Don’t worry, it’s magic…

  2. The thick red & black wires on the other side of your ESC go to the same colored wires on your battery.

  3. There’s also a group of two or three thin wires also coming out of your ESC. Probably on the same end as the battery connection wires. These can be varying colors. You should look for documentation from your ESC manufacturer. If you can’t find it… For my Mystery ESC one of the outside wires is brown. It goes to ground. The other outside wire is orange. It goes to a PWM pin on the FEZ board. The middle pin provides 5V power. It can be used to power your board but that’s not recommended by most as it can be unreliable. You will find in another thread here that I have an issue where mine doesn’t seem to work unless I connect this middle pin to the 5V pin on my board. But that’s not normal and I still have to get back to it and figure out what I’ve done wrong…

After that’s all connected, it’s actually very easy. Get Chris’ code here…

http://code.tinyclr.com/project/62/brushless-motor-esc-for-aircrafts/

Here’s a sample app I used to test out my motor. It assumes you’re using PWM pin 10. It will turn your motor on at 20% briefly then turn it back off. From there, I think you can figure out the rest. I should have all this in pictures and more detail by the end of next week. Have fun!


public static void Main()
{
    var m1 = new BrushlessMotor((PWM.Pin) FEZ_Pin.PWM.Di10);
    m1.Scale = 100;
    m1.SetPower(20);
    Thread.Sleep(200);
    m1.Stop();
}


#17

Thanks, Ian. This is starting to make sense.


#18

The blog post is available now. Let me know if anything is lacking.
http://blog.ianlee.info/2011/08/controlling-brushless-motor-with-netmf.html


#19

Nice!


#20

Thanks.