When I bought such a motor control shield recently, it came as a kit without any instructions. I could find the circuit diagram and list of parts on the Internet after some searching, but almost nothing on assembly and how to control it. Therefore I decided to create this page to share with the community what I learned so far.
The "official" documentation states that jumpers or bridges have to be installed here (vertically!) to control a stepper motor. This will connect E1 and E2 (Arduino 8 and 9) to IC3' inputs 1A and 4A and, via IC2, inverted to 2A and 3A.
However, normally that seems to be superfluous because DIRA and DIRB (Arduino 12 and 13) can be used instead, see instructions on stepper motor below.
The output pins, numbered from top to bottom (positioned 180°, compared to the circuit diagram, it seems!), are connected to the following outputs of the driver chip:
The shield contains two pairs of outputs (MOTORS 1-2 and 3-4) to drive motors or other consumers. Only one of the two outputs forming a pair can be used at a time. This gives us the following options:
Simply connect the motors to pins MOTORS 1 and 2 resp MOTORS 3 and 4.
I also managed to control a linear drive from a very old CD-ROM drive and a head drive from a hard disk drive. They are connected the same way as motors.
Take care not to overload the drivers in IC3. If the resistance of the motor coil is too low (= current will be too high) or the voltage resistance of the motor is too low (=motor will get too much voltage and take up too much power), you can connect an appropriate load resistor in series with the motor or device. This will work for experimenting, however on the long run I'd prefer using a more appropriate different driver circuit instead of wasting some of the possible power.
Up to four DC motors or other consumers can be connected to one of the MOTORS pins with one connection and to GND with the other one. Please note that the consumers connected to MOTORS 1 and 2 resp. MOTORS 3 and 4 can be switched on only alternatively.
Of course nothing speaks against using one of the MOTORS output pairs for a bidirectional motor and the other one for unidirectional consumers.
I tried to get a bipolar stepper motor (head drive from an old 3,5" floppy drive) working with the "official" Arduino Stepper library and the example "stepper_oneRevolution", but the motor was hardly turning, mostly only vibrating and getting quite hot. After comparing the "official" circuit diagram in the Stepper lib's docs with the Motor Control Shield's one, I understood the reason: The "official" diagram sets IC3's ENABLE lines to HIGH and controls the four IC3 outputs independently. The Motor Control Shield works differently: The control lines for IC3's 4 outputs are connected in pairs using the gates from IC2 so that always exactly one of the outputs in a pair is active, controlled by DIRA and DIRB. Then the ENABLE lines connected to PWMA/PWMB decide if outputs are to be enabled or not.
The standard stepper library can be used the following way (not recommended for more than tryout, motor is under constant power and will get hot):
Using the Arduino stepper library in 4-pin mode can be achieved the following way:
A unipolar stepper motor with 6 wires can be driven the same way (use an Ohmmeter to find the ends of the coils, connect one coil to MOTORS 1-2 and the other one to MOTORS 3-4, but don't connect the center wires). A unipolar stepper motor with 5 wires cannot be driven using this board.
The encoder inputs and buttons can be used by polling (the sketch queries the status of the corresponding input lines regularly) or in interrupt mode (a special interrupt routine is called when something happens on the interrupt line 0). Interrupt mode has some oddities, see below.
The LEDs next to the buttons can also be used as outputs. Sample sketch:
It might be possible to use the LEDs as output and the buttons as input "at the same time" when switching the mode of the pin between output and input mode quickly.
The purpose of IC1 is to be able to use the same interrupt-enabled pin for max. four devices, two encoder inputs and two button inputs. Then the interrupt service routine has to query the digital input pins for each of the devices to determine which device or which devices caused the interrupt.
The encoder inputs work with positive logic, they generate HIGH on "interruptable" pin 2 when a HIGH signal is present on EC1 or EC2.
The button inputs work the other way round, they generate HIGH on pin 2 when they are NOT both pressed. While this makes them usable as security or "dead man" switches, they cannot be used as control buttons and also block the interrupt pin for the encoders while not both pressed, unless modified.
First get the schematic and other documentation from http://blushingboy.net/p/motorShieldV3/.
For assembly, you should download the package and locate the following files:
Then follow "standard" methods for assembling an electronics board according to the schematic and parts list.
Adafruit offer a similar board and have good instructions for that, including links to pages explaining how to solder and other basics: http://www.ladyada.net/make/mshield/make.html .
The polarity of the LEDs is not stated clearly on the board print. The "flatter" side of the symbol is -. If the LED is not marked, the shorter leg is -. Note that the LEDs next to each buttons have opposite polarity!
On my Arduino UNO, there was the danger of C6 touching the USB socket on the Arduino. Therefore I used longer pins for the connection to the Arduino. Or take care that the connection wires are as flat as possible and add sufficient electrical tape, etc. below.
There is a mechanical problem with pins from "STEPPER" touching IC1. Therefore it might make sense to place bridges instead of sockets if only use with stepper motors is intended.
Depending on your requirements, some changes can be made to the kit.
I recommend using sockets for the ICs, especially for IC3, the driver. IC1 and IC2 require 14-pin sockets, IC3 a 16-pin one.
If you need no power LED, do not put in R7 and PWR.
If the encoder inputs and buttons are not required, IC1, R1, R2, S1, S2, R10 and R11 are not required and the corresponding Arduino inputs on the connection strip ENCODERS stay available for different purposes.
If only the buttons are not mounted, two more inputs are available for switches/encoders.
The board has two different power lines, "5V" for TTL logic and "Vin" to provide power to the outputs for the motor(s). "5V is powered by the Arduino's power supply, "Vin" is connected to the Arduino's "raw" power supply.
Please note that while the Arduino is powered by USB, only very small motors or other consumers with low current requirements can be driven, otherwise the USB port might be overloaded. Otherwise an external power supply appropriate for the Arduino must be used.
The driver chip supports voltages from 4,5-36V and up to 1A. To drive the motors with a voltage different from the Arduino's "Vin", do not put in the corresponding connection pins that plug into the Arduino board, but attach the external power supply there. This will connect the GND of "Vin" and "5V".
In my kit, the capacitors C4 and C5 had a voltage rating of 20V and need to be exchanged to use higher input voltages.