Getting Started With The MC33932 Dual Motor Shield


Electric motors can be found inside just about everything you use; your phone uses a vibration motor, coffee machines have a water pump, and your car uses them!

Learning how to control an electric motor is a great skill to retain.

With motors you can give your robot wheels to move, and hands to pick things up. The simplest way to control a DC motor is to use an H-Bridge. An H-Bridge is a circuit that allows you to control the speed and the direction of a DC motor. Building a full H-Bridge using transistors and mosfets can be a pain.

Hardware and Assembly:

This is where the MC33932 Motor shield comes in. It allows you to control two DC motors, or one bipolar stepper motor.

In this tutorial, we will show you how to assemble the shield and how to use it to drive both types of motors. The shield comes with all the headers and connectors you will need to put the shield together, but you will need an Arduino Board (Uno, Leonardo, Mega) to control the shield.


Start by inserting all the headers in their respective spots on the board. No need to solder anything just yet, we will do all four at the same time.


Next we will use a piece of masking tape to hold all four pieces on, so that you can flip it over before soldering.


Solder one pin on each of the headers so that you can remove the tape. Once the tape is off, you can check the alignment of the headers before soldering all the pins in.


Here is what it looks like all soldered up. Next step is to solder in the screw terminals.


 Go ahead and place your screw terminals in place and use a piece of tape to hold them down.


Flip over the shield and solder the remaining 6 joints. Once you are done, you can remove the tape and mount the completed shield on your Arduino Board. We chose to work with an UNO, since we have a gazillion of these laying around the shop.


DC Motor Connection:

The completed board/shield assemble should look like this. Next step is wiring up a motor and writing some code!


We will first control a standard DC motor using this shield, and then show you how the board can also control a stepper. The MC33932 has two full H-Bridges built in so it can control two DC motors. The two channels are labeled A and B on the board. Hook up your DC motor to either of these channels, we chose to use channel A.


Here is the completed motor shield mounted on an Arduino Uno and connected to a DC motor. The rest of the wires from the motor are for a built in encoder, which we will not be using for this tutorial. Now for the code!

DC Motor Code:

We have already written some code for this shield, which you can download here. It includes the code to control both channels, as well as one bipolar stepper motor. Go ahead and open up the Dual_DC_Motor.ino sketch.

int PWMA = 3; // PWM Pin for Output A int PWMB = 5; // PWM Pin for Output B int DIRA= 8; // DIR Pin for Output A (There is a Mistake on Silkscreen on V1 of the board) int DIRB= 7; // DIR Pin for Output B (There is a Mistake on Silkscreen on V1 of the board) // the setup routine runs once when you press reset: void setup() { pinMode(DIRA, OUTPUT); // Make Direction Pins Outputs pinMode(DIRB,OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(DIRA,LOW); // Set Direction of Output A analogWrite(PWMA, 60); // Set Speed for Output A (0-255) delay(1000); // Delay 1 Second digitalWrite(DIRA,HIGH); // Switch Direction of Output A delay(1000); // Delay 1 Second analogWrite(PWMA,0); // Turn off Output A by setting speed to 0 digitalWrite(DIRB,LOW); // Set Direction of Output B analogWrite(PWMB,60); // Set Speed for Output B (0-255) delay(1000); // Delay 1 Second digitalWrite(DIRB,HIGH); // Switch Direction of Output B delay(1000); // Delay 1 Second analogWrite(PWMB,0); // Turn off Output B by setting speed to 0 }

Here is what you should see when you open up the motor sketch. The first part of the code defines the motor control pins. PWM for channel A and B are connected to pins 3 and 5 respectively. The Direction control pins for channel A and B are connected to pins 8 and 7 respectively.

(Note: These don’t match the silkscreen on our board because we accidentally swapped the labels on the silkscreen.)

The setup part of the code configures both Direction pins as outputs. There is no need to set the PWM pins as outputs, as this is already handled by the analogWrite functions. To control the speed, you call the function analogWrite(“Channel”, “Speed”) and pass it which motor's speed you are trying to control (PWMA or PWMB) and the speed at which you want it to go (Between 0-255).

To control direction, you use the digitalWrite function. A digitalWrite(“Channel” , LOW) will cause the motor to turn one way and a digitalWrite("Channel”, HIGH) will cause the motor to turn the other way. The complete code is simply turning one motor at a time in one direction, waiting a second, and then turning the other way for one second.


Upload the sketch, and connect your UNO to an external power supply to test the code. The motors will not turn if the Arduino is powered by the USB Port. Above, you can see we are using the UNO's DC barrel jack to supply power to the board.

Note: Although we are powering the shield through the DC Barrel Jack, this is not recommended since you risk burning the thin traces on your Arduino. The shield should instead be powered using the VIn screw terminals (Max 28V). 


Here you can see the proper way to power the shield. Use an external power source connected directly to the shield. The shield will automatically route power to the UNO, so you do not need to power it separately.

Stepper Motor Example:

As an added bonus, this shield can also control a single stepper motor all the way down to 5 volts. A stepper motor gives you the ability to control precise position without the complexity of position sensors and expensive closed loop controller. The zip file above also contains a sample code to control a stepper.

#include <Stepper.h> const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution // for your motor // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 7,8); int PWMA = 3; // PWM Pin for Output A int PWMB = 5; // PWM Pin for Output B void setup() { // set the speed at 60 rpm: myStepper.setSpeed(60); // The 255 can be lowered to reduce power to the steppers. analogWrite(PWMA, 255); // Set Speed for Output A (0-255) was added to turn on Channel A analogWrite(PWMB, 255); // Set Speed for Output B (0-255) was added to turn on Channel B // initialize the serial port: Serial.begin(9600); } void loop() { // step one revolution in one direction: Serial.println("clockwise"); myStepper.step(stepsPerRevolution); delay(500); // step one revolution in the other direction: Serial.println("counterclockwise"); myStepper.step(-stepsPerRevolution); delay(500); }

The sample code above uses a built in Arduino Stepper library to control the motor’s steps (first line in the code). We start by defining the number of steps our motor has per revolution. In our case this is 1.8 degrees per step, so 200 steps per revolution. Next we initialize the stepper class with the step per revolution, as well as the two pins used to control the direction of the outputs. The last two lines before the setup are to define the PWM pins, just like our last program.

The first line in our setup routine sets the speed at which we will want to move the stepper. The maximum speed is limited by the type of stepper you use (generally higher voltages mean higher RPM’s). For our stepper, we were able to get about 60 RPM, by driving the motor at its rated 5V.

Next we need to set our PWM pins HIGH. We can do this using the analogWrite function, or the digitalWrite function. By setting the PWM pins to 255, both channels are always on and enabled. From this line on, the motor will just be controlled using the two direction pins. The Serial port is just used to display messages to the computer and is optional.

Finally, we get to the loop. The loop is turning the stepper one full revolution, pausing for half a second, and then one full revolution the in the other direction. You can use the myStepper.step() function to step the motor in any direction.


Now connect your stepper; channel A goes to one coil, and channel B goes to the second coil. Connect each pair to the shield; if you got it right, the motor will turn one full revolution, and then return back home. If the motor fails to turn, flipping one pair will fix the problem.

That concludes our motor shield tutorial. Now you are ready to put these motors to some good use.

If you have any questions about this tutorial, don't hesitate to post a comment, shoot us an email, or post it in our forum!

This article was published by the Jaycon team. Learn more about how we can take your product design and hardware idea to the next level here.

TutorialsJaycon Systems