A Stackable Motor Driver Shield for the Arduino

The Arduino has been used for many purposes, and “shields” are available to make many common tasks easier. However, [Nick] wanted a stackable motor driver shield, so he build one himself!. There are many motor driver shields available for the Arduino, however, there aren’t any that allow one to drive as many motors as were needed for his project, and none that were stackable.

[Nick] had no experience designing and fabricating a custom board, but decided to try his hand at it anyway. Armed with a free version of [Eagle] PCB design software, he designed the board that he needed then sent it to [Seeed] to be manufactured. According to his article, a quantity of 10 Arduino-sized boards can be purchased for the price of $25. At that price point, some hobbyists may want to consider this option rather than manually creating their own circuit.

According to [Nick], he was able to manufacture his first board with no errors on his first run! Not bad for his first try at something like this.

Not to complicated to recreate. It looks like it’s just another AVR (ATtiny maybe) and a H-bridge with all the required external components. He had to have used the UART, SPI or TWI for communications and to allow multiple boards on the stack.

But I agree, not sharing should be a major deal breaker for a HAD post.

Actually he shared all his sources on github.com
You can find them at github.com/arachnid/busdrivershield. In his documentation you can also find a picture of the schematic and board layout. This design is far from being closed.

I found it cool that the circuit design process worked the first time. I had a similar experience working on my Arduino sound synthesizer board, and I was amazed at how easy it is these days to go from simple design to production grade circuit board delivered right to your door

Despite technical criticism on board design, I applaud the efforts to just go ahead and do it, even if just to learn how.

Looks like a very nice shield. A couple words of advice. I design motor controllers at my day job and these are some things I’ve learned along the way.

Motors and I2C do not play nice with each other. You can get a ground bounce on the SCL line that will mess up your whole packet, so it’s a good idea to provide some handshaking and error detection between the Arduino and your slave devices (I2C is not inherently protected or immune to hardware noise). Also, it would not be a bad idea to opto-isolate the 5V logic from the Vin signals (a barrier between the ATtinys and the H-bridge IC). Potentially powering the Arduino Vin separate from the motor shield Vin, and just populate a DC jack on one or all of your motor shields.

Good points, thanks. I’ll have to give some thought to what sort of error detection is practical given the constraints. Opto-isolation would be nice, but it seems unlikely I’ll be able to fit it on the board or within the budget. Were you suggesting this for noise-immunity, or circuit protection?

Support for a separate DC jack is another thing I’d like to add in a v2 version, if there’s room. Powering off vin is fine for a couple of shields, but if you want to push the boundaries of what it can deliver, a separate power jack is probably a good idea. I could really use the advice of someone with more power engineering experience than me (eg, any) as to what the best design is isolation-wise, too.

Opto’s shouldn’t be too large to squeak some in, even if they were on the bottom of the board…

Opto’s primarily for noise isolation, but also circuit protection. You want to protect your Arduino main board in case you accidentally hook your motor shields up to a reverse polarity input, short the outputs or get a large back EMF that takes out a handful of circuitry.

I looked into this after you suggested it – the problem is, I2C is a bidirectional bus, and affordable opto-isolators that are bidirectional are hard to come by, whilst building a bidirectional solution out of omnidirectional parts is also tough.

How do they help with noise isolation if the power rails are still shared?

Hmm. The H-Bridge (and the h-bridge side of the isolators, presumably) would still require a 5v logic supply, though. Actually, I’m not entirely clear on how noise from the motor rail would propagate to the logic rail, unless you’re talking about noise on the ground rail, which isn’t affected by using optoisolators on the inputs, is it?

Nick, so when the H-Bridge is switching current to the motor a lot is going on: 1) your FET driver is sinking/sourcing current at high di/dt rates, and 2) when the FETs turn on current is very rapidly flowing from your Vin rail through the motor and back through the ground path. 3) When the FETs turn off, the motor inductance will create negative voltage spikes with respect to ground. 4) If you don’t have enough bulk capacitance close to the FETs, the motor load will also be yanking down on your positive rail… and all traces have resistance/inductance that succumb to the pressure and create voltage drops. 5) Shoot-through current is hella-bad and can easily occur because you set the gate resistors incorrectly, picked the wrong FETs, etc..

So think about all of these current paths on a PCB. Now think of them flowing through several stackable headers as they compete for power consumption with the distributed I2C I/O expander uC’s and FET drivers.

Yes you will have to generate a separate 5V rail on the motor side of the Opto, but it will completely isolate the micro controller ground from the motor ground.

I wouldn’t stop the motor as they do with 50% PWM, but it’s the only way they can do it based on how they are controlling the H-Bridge. They are using a very rudimentary switching scheme. Your FET driver and H-Bridge may be better I don’t know. The whole point is to show the opto-isolation though. Google “opto-isolated h-bridge” and read as much as you can stand.

I mostly follow what you’re saying, but there are two power rails – 5v and the motor power rail. It seems to me that the motors are only going to affect the motor rail, aren’t they?

Unfortunately, looking at the price of opto-isolators and the number of lines (6) that would need isolating, along with an extra voltage regulator, I don’t think it’s possible to do that and still keep the shield affordable.

Well if you are powering the H-Bridge from Vin that enters the Arduino, it’s more coupled to the 5V than you think. Vin powers the 5V regulator on the Arduino and that regulator needs 2.5V of headroom, or 7.5V minimum coming into it to produce a steady 5V out. Dip the Vin too much and it will start dipping the 5V.

If you ran the motor shields on their own power packs, you’ll be pretty close to having a decent separation between high current and low current. They will be connected by ground, but the current wants to return to the source. So as long as you make sure all of your different grounds are tied together at a common point as close to the motor shield Vin jacks as you can, you’ll be in pretty good shape. I.e., don’t connect one of your Arduino or ATTiny grounds to the motor shield ground close to the H-Bridge… you want it closer to the motor shield Vin jack. This will prevent high current “ground bounce” from affecting the low current stuff.

As for cost, yeah opto’s aren’t free… but when it means you can stack 4 shields vs. not being able to stack even one shield due to noise… well I know I would design it to work and let everyone know it costs xxx for a reason. You should be able to just tie the enable lines high, as I’m pretty sure they just tri-state the motor outputs which would freewheel the motor…. not something you typically need. And if you do need it, you have other questions to answer to make sure you don’t blow your catch diodes or bulk capacitors.