Motor

Drive DC motors

  • Drive DC motors from 4V up to 18V
  • Controls 2 motors with 1A each, or 1 motor with up to 1.8A
  • Overloading, short-circuit and polarity inversion protection

With the Motor Nanoshield, you can control speed and direction of rotation of DC motors. The module works with voltage from 4V up to 18V and it is possible to control 2 independent motors with 1A each, or 1 motor with up to 1.8A. This Nanoshield is recommended for robotics projects, and any other project in which it is necessary to control low-power DC motors.

Besides that, there are several possibilities for you to configure the way the motors and the Arduino are powered. This simplifies the wiring and the project becomes more flexible, as you will see below.

The module also features protection against overloading and mistakes on connections, such as polarity inversion from the power supply and short-circuit on the motors.

motor

Line following robot using the Motor Nanoshield (click to zoom)

!Using the Motor Nanoshield

In order to use the Motor Nanoshield, you just have to choose if you want to control 1 or 2 motors, as well as the way in which power will be supplied. Use the following sections as a guide.

!Step 1: Choosing between 1 or 2 motors

The Motor Nanoshield can control 2 DC motors with up to 1A each or 1 motor with current of up to 1.8A (the allowed voltage range is from 4V to 18V).

!Connecting 2 motors

In order to control 2 motors at the same time, close the jumpers on the board that are named M2B, M2A, M1B and M1A (see the figure below).

The motors are connected to the module through the green terminal block. The M1 terminals show the connection with motor 1 (controlled by the pins 3 and 5 on Arduino), and the M2 terminals show the connection with motor 2 (controlled by the pins 6 and 9 on Arduino). There is also a GND terminal, which can be used for connecting capacitors or any other kind of filter, if needed.

The figure below shows which jumpers must be closed and how the motor connection is done:

motor

Connecting 2 motors simultaneously to the Motor Nanoshield

!Connecting 1 motor

In order to control only 1 motor, close the jumpers on the board that are named M1/M2_B and M1/M2_A (see the figure below). After that, you can choose if the motor will be controlled by the pins 3 and 5 or by the pins 6 and 9 on Arduino.

The following figure shows both connections: on the left the motor is controlled by the pins 3 and 5; on the right the motor is controlled by the pins 6 and 9.

motor

Connecting 1 motor to the Motor Nanoshield

!Step 2: Choosing the way power is supplied

With the Motor Nanoshield, you have various possibilities to configure the way the motors and the Arduino are powered. The following sections show these options.

!Powering the motors and the Arduino through the VIN pin

This setup allows both motors and the Arduino to be powered by the voltage applied to VIN.

In order to use this mode, close the jumper that is located at the upper section of the board, at the VIN position (see the figure below). The power supply has to be connected to the Arduino or the Base Board through the external power supply inputs, or through the blue block terminal on the Motor Nanoshield. It is important to check the polarity indication and .

The figure below shows how to power the system up through the VIN pin.

motor

Powering the motors through the VIN pin on Arduino

!Powering the motors and the Arduino through the VCC pin

This setup allows both motors and the Arduino to be powered through the voltage applied to the VCC pin.

In order to use this mode, close the jumper that is located at the upper section of the board, at the VCC position (see the figure below). The power supply has to be connected through the blue block terminal on the Motor Nanoshield. Make sure to check the polarity and indication.

However, it is necessary to make sure that the power supply (or battery) uses a voltage between 4V and 6V. A voltage less than 4V can cause malfunctioning (yet not damaging the boards) and a voltage greater than 6V can cause permanent damage to the Arduino. If your power supply (or battery) provides more than 6V, use the option “Power the motors through the VIN pin on Arduino”.

Powering through the VCC pin is useful when your project uses batteries such as AA and AAA. For example, you can use 4 alkaline batteries (1.5V each) or 4 NiMh rechargeable batteries (1.2V each) in series.

The following figure shows how to power the system up through the VCC pin.

motor

Powering the motors through the VCC pin on Arduino

!Using an independent external power supply for the motors

This setup allows you to use a separate power supply only for the motors, that is, the Arduino must be powered by another power supply, or via the USB. This mode is useful when you have motors that take up a higher voltage (between 12 and 18V, for example), which may cause overheating of the voltage regulators on Arduino.

In order to use an independent power supply, open the jumper located at the upper section of the board (see the figure below). The power supply for the motors must be connected directly to the blue block terminal on the Motor Nanoshield. Make sure to check the polarity and indication.

The following figure shows how to power the system up with an independent power supply.

motor

Powering the motors with an independent power suply

!Step 3: Connecting with Arduino

!Using the Base Board or Base Boarduino

If you already have an Arduino, the easiest way to use the Motor Nanoshield is by using the Base Board UNO or Base Board L UNO. You just have to mount all the boards and the system is ready to be used. This assembly can be used with Arduino UNO, Mega R3, Duemilanove, among others (contact us in case you have doubts about the compatibility with other versions).

Another option is to use the Base Boarduino. Likewise, you just have to mount the Nanoshield in one of the slots and the system is ready to be used.

The following figure shows the final setup with the Base Board and the Base Boarduino.

motor

Connection using the Base Board UNO or Base Boarduino (click on the image to zoom)

!Connecting an Arduino using jumper wires

It is also possible to use the module with direct connections, using a protoboard and jumper wires to make the connection. Use the following schematics to guide you connecting the Motor Nanoshield to an Arduino UNO or Arduino Mega.

motor

Connection using Arduino UNO (click on the image to zoom)

motor

Connection using Arduino Mega (click on the image to zoom)

!Step 4: Controlling the motors

The motor control is done as shown on the following tables. It is possible to use PWM for speed control – using analogWrite(), for example.

! Motor 1

Pin D3 Pin D5 Function
0 0 OFF
0 1
1 0
1 1 BRAKE
Reference table to control motor 1

! Motor 2

Pin D6 Pin D9 Function
0 0 OFF
0 1
1 0
1 1 BRAKE
Reference table to control motor 2

Downloads

Projects