Introduction
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, and is also equipped with Gravity sensor interface and TB6612FNG dual motor driver. Additionally it has a XBee socket, I2C interface and UART port, allowing for easy and convienant connections.
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 on the market. It is a solid choice for small intelligent robot controls, plus it is convenient and cost-effective.
Features
- Compatible with Arduino UNO R3 Pinmap.
- Gravity-3Pin interface, plug & play, esay to use.
- Integrated XBee Slot, XBee, WiFi Bee, Bluetooth Bee compatible.
- Program download switch will avoid serial occupancy during Arduino UNO/Mega downloading.
- 2x1.2A TB6612FNG DC motor driver (power from Vin port).
Specifications
- Digital interface: 14
- Analog interface: 6
- IIC interface: 2
- SPI interface (compatible with Arduino UNO R3): 2
- Serial port: 1
- XBee Slot: 1
- Output Current: 1.2A single channel continuous driving current
- Start/ Peak Current: 2A (continuous pulse)/ 3.2A (monopoles)
- Input Voltage: 12V (peak value)
- Occupying Pins: D4, D5, D6, D7 (caution: the pin is occupied when control the motor)
- Size: 68.5mm×53.3mm (2.7 inch×2.1 inch)
- Weight: 36
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
LED “L”
Here is an onboard LED in the expansion shield, it is connected to digital pin 13.
D&A
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. Even with multi-sensors connections there is no need to worry about an 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 we designed in the following order: Signal > VCC > GND is ensure a consistent linear order for improved wiring efficiency.
RUN/PROG
The new expansion shield added switch ‘RUN’ and ‘Download’. When using controller such as Arduino UNO/ Mega, you may fail to download program because downloading via the USB and the attached XBee would occupy the same serial port. Therefore, you should switch to ‘PROG’ in download and switch to ‘RUN’ in run.
Tutorial
Connection Diagram
Sample Code
/*!
* file motor.ino
* brief Show Show The motor turns clockwise or counterclockwise.
* Copyright [DFRobot](https://www.dfrobot.com)
* Copyright GNU Lesser General Public License *
* @author [DongZi](dongzi.liu@dfrobot.com)
* version V1.0
* date 2017-07-05
*/
void setup() {
pinMode(4,OUTPUT); /* define pin (4,5,6,7) out*/
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
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
}
else
{digitalWrite(4,LOW);
analogWrite(5,speed_m);
}
}
else
{
if(direction_m==1)
{digitalWrite(7,HIGH); // pin 7 controls M1 rotary direction
analogWrite(6,speed_m);//pin 6 controls M2 rotation speed
}
else
{digitalWrite(7,LOW);
analogWrite(6,speed_m);
}
}
}
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. |
---|
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum. |
---|