Hootie81's Motor Controller shield

I have just finished testing my motor controller shield… Its time to release it to the wild!
Everything you need to build your own is here Dual-DC-Motor

It will run 2 DC motors or 1 stepper per card, and they are designed to be stacked. They use an SPI interface in a daisy chain configuration, so one CS line for all of the cards. The driver is a TB6612FNG and rated for 1.2A per channel 2A max

The library is written to easily interface with the motors, you don’t need to worry about any of the SPI stuff, add the library to your project, cut and paste 5 lines of code to yours, and then control the motor with simple code like this:

DC motors example

MotorCard.A(CW,200);  //set motor turning clockwise at about 80% speed
MotorCard.B(CCW,128);  //set motor turning at 50%

Stepper example:

MotorCard.StepperPower(255);  // set to full power
for(i=1; i<100; i++){ 
MotorCard.StepperPower(120);  // reduce power for holding

There are 4 solder jumpers on the under side of the card for selecting the CS lines, you can choose from A0, A1, D0 and D1 depending on whatever else you have connected. A3, A4 and A5 are hardwired as they are the dedicated SPI lines. On the top side of the card there is 2 selector pads for setting up the daisy chain, labeled “first” and “last”. If its the first card (the bottom most one) then bridge Y for first, otherwise bridge to the N. if it is the top most card (the last one in the daisy chain) then bridge Y for last, otherwise bridge to the N. There is some tests being performed when the library initializes the cards, it passes data through all the cards and makes sure they are all there, and every command returns to the core for error checking.

Each write to the card takes about 11us + 6us for each additional card, so shouldnt slow things down too much!

There are some limitations,
due to the SPI interface chip not conforming to proper standards and not going high impedance on the MISO line when CS is high, the card wont play nice with other SPI devices. You could still use 1 way devices like LCD displays that use a 3 wire setup. Another option is to remove the solder jumper on the top card “last” this effectively disconnects the wire from the core, a slight change will need to be made in the library too.
Also the PWM is pretty slow at 125hz so no micro-stepping with this one… sorry i miss-read the datasheet
DC motor noise will mess things up, make sure you use capacitors on your motors! results are unpredictable, i had motors going full speed changing directions and all sorts.


All nicely lined up ready to spin some motors! :smiley:

I hope we can make improvements to this and eventually have it available to the community at large.

What do you think @Hootie81? :wink:

Happy to help run the first manufacturing run if there’s enough people demanding for it :stuck_out_tongue:

1 Like