Gravity IO Expansion Shield with Motor Driver is a new product designed for Arduino Boards. It combines IO Expansion Shield and DC Motor Driver Shield, equipped with Gravity sensor interface and TB6612FNG dual motor driver. It also has XBee socket, I2C interface and UART port, makes the connections more convenient.

With TB6612FNG dual channel motor driver IC, the shield can drive 2x1.2A DC motors at the same time. It supports PWM speed control, each channel can output 1.2A continuous current and the peak current can reach to 3.2A. It is compatible with majority micro DC motors in the market. It is a solid choice for small intelligent robot controls, convenient and cost-effective.



Board Overview

Num Descripition
1 Digital interfaces
2 XBee interfaces
3 Analog interfaces
4 Power supply and reset interfaces
5 dual channel motor driving interfaces
6 SPI interfaces
7 Serial port interfaces
8 Programming switch (RUN: Running XBee; PROG: Sketch upload)
9 State indicators
10 IIC interfaces

Detail Explanation


Here is an onboard LED in the expansion shield, it is connected to digital pin 13.


Letter ’D’ and ‘A’ are printed in the Gravity: IO Expansion & Motor Driver Shield
‘D’: stands for digital signal, which should be connected to digital pins.
‘A’: stands for analog signal, which should be connected to analog pins.

Gravity: IO Expansion & Motor Driver Shield V1.0 is sufficient in interfaces. Compared to limited power supply interfaces in the control shields, it equipped with more GND interfaces and power supply interfaces. Although a multi-sensors connection, no need to worry about interface shortage.

A row of red pins and a row of black pins are below digital pins and analog pin.  They are the expanding power supply interface. The red pins connect to the power supply (VCC) and the black pins connect to GND.

DFRobot Colors Explanation

Green: Digital Signal

Blue: Analog Signal

Red: VCC

Black: GND


The reason why designed the order as Signal > VCC > GND is to correspond to sensors linear order, the design has improved the wiring efficiency.


The new expansion shield added switch ‘RUN’ and ‘Download’. When using controller such as Arduino UNO/ Mega, you may failed to download program because downloading and XBee would occupy the same serial port. Therefore, you should switch to ‘PROG’ in download and switch to ‘RUN’ in run.


Connection Diagram

Sample Code

  * file motor.ino
  * brief Show Show The motor turns clockwise or counterclockwise.
  * Copyright  [DFRobot](
  * Copyright GNU Lesser General Public License  *
  * @author [DongZi](
  * version  V1.0
  * date  2017-07-05

void setup() {
pinMode(4,OUTPUT);   /* define  pin (4,5,6,7) out*/
void motor_c(char motor_n,char direction_m,int speed_m ) /* motor_n: the motor number to drive(0 stands for M1;1 stands for M2)*/
/* direction_m : the motor rotary direction(0 is clockwise and 1 is counter-clockwise).*/
/* speed_m: to control the motor rotation speed(from 0 to 255 ), the speed_m value is larger, the rotation speed is faster;*/
{  if(motor_n==1)
   {   if(direction_m==1)
        {digitalWrite(4,HIGH);    // pin 4 controls M2 rotary direction analogWrite(5,speed_m);  //pin 5 controls M2 rotation speed
        {digitalWrite(7,HIGH);  // pin 7 controls M1 rotary direction
         analogWrite(6,speed_m);//pin 6 controls M2 rotation speed

void loop() {
 motor_c( 0,0,127 );// M1 rotate in clockwise of 127 component velocity(total as 225)
 motor_c( 1,0,127 );// M1 rotate in clockwise of 127 component velocity(total as 225)
 delay(5000);        //delay for 5s
 motor_c( 0,1,200 );// M1 rotate in counter-clockwise of 200 component velocity(total as 225)
 motor_c( 1,1,200 );// M2 rotate in counter-clockwise of 200 component velocity(total as 225)
 delay(5000);      //delay for 5s

Expected Results

The motor rotate slowly in clockwise for 5s and rotate quickly in counter-clockwise for 5s and goes on.

NOTE: If the motor rotating direction is opposite to the expectation, you just need to adjust the pin order.


For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Gravity: IO Expansion & Motor Driver Shield from DFRobot Store or DFRobot Distributor.

Turn to the Top