2x2A Arduino Motor Shield Twin Wiki-DFRobot

logo
  • HOME
  • COMMUNITY
  • FORUM
  • BLOG
  • LEARN
logo HOMECOMMUNITYFORUMBLOGLEARN
  • DFRobot Products (DFR) Index
    • Kitty Flower
    • DFR0677 ONPOWER UPS HAT for Raspberry Pi
    • DFR0604 I O Expansion HAT for Pi zero V1.0
    • DFR0580 Solar Power Manager For 12V Lead-Acid Battery
    • DFR0578 Gravity I O Expansion Shield for OpenMV Cam M7
    • DFR0577 Gravity I O Expansion Shield for Pyboard
    • DFR0576 Gravity Digital 1-to-8 I2C Multiplexer
    • DFR0575 Beetle ESP32
    • DFR0564 USB Charger for 7.4V LiPo Battery
    • DFR0563 Gravity 3.7V Li Battery Fuel Gauge
    • DFR0565 Gravity Digital Signal Isolator
    • DFR0559 Solar Power Manager 5V
    • DFR0558 Gravity Digital High Temperature Sensor K-type
    • DFR0555\DF0556\DFR0557 Gravity I2C LCD1602 Arduino LCD Display Module
    • DFR0553 Gravity I2C ADS1115 16-Bit ADC Module Arduino & Raspberry Pi Compatible
    • DFR0552 Gravity 12-Bit I2C DAC Module
    • DFR0548 Micro bit Driver Expansion Board
    • DFR0536 Micro bit Gamepad Expansion Board
    • DFR0535 Solar Power Manager
    • DFR0534 Voice Module
    • DFR0531 FireBeetle Covers-ePaper Black&White&Red Display Module
    • DFR0529 2.2 inches TFT LCD Display V1.0 (SPI Interface)
    • DFR0528 UPS HAT for Raspberry Pi Zero
    • DFR0524 5.5 HDMI OLED-Display with Capacitive Touchscreen V2.0
    • DFR0523 Gravity Digital Peristaltic Pump
    • DFR0520 Dual Digital Pot 100K
    • DFR0518 Micro Mate- A Mini Expansion Board for micro bit
    • DFR0515 FireBeetle Covers-OSD Character Overlay Module
    • DFR0514 DFR0603 IIC 16X2 RGB LCD KeyPad HAT V1.0
    • DFR0513 PPM 2x3A DC Motor Driver
    • DFR0511 FireBeetle Covers-ePaper Black&White Display Module
    • DFR0508 FireBeetle Covers-DC Motor & Stepper Driver
    • DFR0507 FireBeetle Covers-OLED12864 Display
    • DFR0506 7'' HDMI Display with Capacitive Touchscreen
    • DFR0505 SIM7000C Arduino NB-IoT LTE GPRS Expansion Shield
    • DFR0504 Gravity Analog Signal Isolator
    • DFR0503 Embedded Thermal Printer - TTL Serial
    • DFR0502 Gravity IO Expansion & Motor Driver Shield V1.1
    • DFR0499 64x64 RGB LED Matrix - 3mm pitch
    • DFR0498 FireBeetle Covers-Camera&Audio Media Board
    • DFR0494 Raspberry Pi UPS HAT
    • DFR0492 FireBeetle Board-328P with BLE4.1
    • DFR0489 FireBeetle ESP8266 IOT Microcontroller
    • DFR0487 FireBeetle Covers-24×8 LED Matrix
    • DFR0483 FireBeetle Covers-Gravity I O Expansion Shield
    • DFR0478 FireBeetle ESP32 IOT Microcontroller(V3.0)
    • DFR0473 Digital Relay Module
    • DFR0472 32x32 RGB LED Matrix - 4mm pitch
    • DFR0471 32x16 RGB LED Matrix - 6mm pitch
    • DFR0469 Gravity I2C SD2405 RTC Module
    • DFR0464 Gravity I2C 16x2 Arduino LCD with RGB Backlight Display
    • DFR0463 Gravity Flexible 16x16 RGB LED Matrix
    • DFR0462 Gravity Flexible 8x32 RGB LED Matrix
    • DFR0461 Gravity Flexible 8x8 RGB LED Matrix
    • DFR0460 64x32 RGB LED Matrix - 4mm Pitch/64x32 Flexible RGB LED Matrix-4mm Pitch/64x32 Flexible RGB LED Matrix-5mm Pitch
    • DFR0459 8x8 RGB LED Matrix
    • DFR0457 Gravity MOSFET Power Controller
    • DFR0453 DFRobot CurieNano
    • DFR0448 LED String Lights Warm White
    • DFR0440 The Micro Vibration Module
    • DFR0439 LED String Lights Colorful
    • DFR0438 Bright LED Module
    • DFR0428 3.5 inches TFT Touchscreen for Raspberry Pi
    • DFR0423 Self-Locking Swicth
    • DFR0420 Audio Shield For DFRduino M0
    • DFR0416 Bluno M0 Mainboard
    • DFR0412 Gravity IO Expansion Shield For DFRduino M0
    • DFR0411 Gravity 130 DC Motor
    • DFR0399 DC Micro Metal Gear Motor 75 1 w Driver
    • DFR0398 Romeo BLE Quad Robot Controller
    • DFR0392 DFRduino M0 Mainboard
    • DFR0387 TELEMATICS 3.5 TFT Touch LCD Shield
    • DFR0382 LED Keypad Shield V1.0
    • DFR0374 DFR0396 LCD Keypad Shield V2.0
    • DFR0371 IO Expansion Shield for Bluno M3
    • DFR0370 CAN-BUS Shield V2
    • DFR0360 XSP - Arduino Programmer
    • DFR0356 Bluno Beetle Shield
    • DFR0355 SIM808 with Leonardo mainboard
    • DFR0351 Romeo BLE mini V2.0
    • DFR0348 3.5 TFT Touch Shield with 4MB Flash for Arduino and mbed
    • DFR0347 2.8 TFT Touch Shield with 4MB Flash for Arduino and mbed
    • DFR0343 UHex Low-power Controller
    • DFR0342 W5500 Ethernet with POE Mainboard
    • DFR0339 Bluno Beetle
    • DFR0334 GPIO Shield for Arduino V1.0
    • DFR0332 Fan Module
    • DFR0331 Romeo for Edison Controller
    • DFR0311 Raspberry Pi Meet Arduino Shield
    • DFR0329 Bluno M3
    • DFR0327 Arduino Shield for Raspberry Pi 2B and 3B
    • DFR0323 Bluno Mega 2560
    • DFR0321 Wido-WIFI IoT Node
    • DFR0316 MCP3424 18-Bit ADC-4 Channel with Programmable Gain Amplifier
    • DFR0312 Raspberry Pi GPIO Extension Board
    • DFR0306 Bluno Mega 1280
    • DFR0305 RoMeo BLE
    • DFR0304 BLE Wireless Gamepad V2
    • DFR0302 MiniQ 2WD Plus
    • DFR0300 Gravity Analog Electrical Conductivity Sensor Meter V2 K=1
    • DFR0299 DFPlayer Mini
    • DFR0300-H Gravity: Analog Electrical Conductivity Sensor(K=10)
    • DFR0296 Bluno Nano
    • DFR0290 RLY-8-RS485 8 Relay Controller
    • DFR0289 RLY-8-POE Relay Controller
    • DFR0287 LCD12864 Shield
    • DFR0283 Dreamer Maple V1.0
    • DFR0282 Beetle
    • DFR0273 Speech Synthesis Shield
    • DFR0271 GMR Board
    • DFR0270 Accessory Shield for Arduino
    • DFR0267 Bluno
    • DFR0265 IO Expansion Shield for Arduino V7
    • DFR0259 Arduino RS485 Shield
    • DFR0233 RS485 Sensor Node V1.0
    • DFR0231 NFC Module for Arduino
    • DFR0225 Romeo V2-All in one Controller R3
    • DFR0222 X-Board Relay
    • DFR0210 Bees Shield
    • DFR0205 Power Module
    • DFR0202 RGB LED Matrix
    • DFR0188 Flymaple V1.1
    • DFR0182 Wirless GamePad V2.0
    • DFR0165 Mega IO Expansion Shield V2.3
    • DFR0162 X-Board V2
    • DFR0154 I2C TWI LCD2004 Module Arduino Gadgeteer Compatible
    • DFR0151 Gravity I2C DS1307 RTC Module
    • DFR0144 Relay Shield for Arduino V2.1
    • DFR0143 Triple Axis Accelerometer MMA7361
    • DFR0136 Flyduino-A 12 Servo Controller
    • DFR0133 X-Board
    • DFR0117 Gravity I2C EEPROM Data Storage Module
    • DFR0107 IR Kit
    • DFR0105 Power Shield
    • DFR0100 DFRduino Beginner Kit For Arduino V3
    • DFR0095 DIGITAL IR Transmitter Module
    • DFR0094 Digital IR Receiver Module
    • DFR0091 3-wire Serial LCD Module Arduino Compatible
    • DFR0090 3-Wire LED Module
    • DFR0076 Flame sensor
    • DFR0075 ADKeyboard Module
    • DFR0071 SD Module
    • DFR0067 DHT11 Temperature and Humidity Sensor
    • DFR0066 SHT1x Humidity and Temperature Sensor
    • DFR0064 386AMP audio amplifier Module
    • DFR0063 I2C TWI LCD1602 Module Gadgeteer Compatible
    • DFR0062 WiiChuck Adapter
    • DFR0061 Joystick Module For Arduino
    • DFR0058 Analog Rotation Sensor V2
    • DFR0057 Sensor Motor Drive Board - Version 2.2
    • DFR0054 Analog Rotation Sensor V1
    • DFR0053 Analog Slide Position Sensor
    • DFR0052 Analog Piezo Disk Vibration Sensor
    • DFR0051 Analog Voltage Divider
    • DFR0049 Analog Gas Sensor (QM-NG1)
    • DFR0034 Analog Sound Sensor
    • DFR0032 Digital Buzzer Module
    • DFR0033 Digital magnetic sensor
    • DFR0030 DFRobot Capacitive Touch Sensor
    • DFR0029 DFRobot Digital Push Button
    • DFR0028 DFRobot Tilt Sensor
    • DFR0027 DFRobot Digital Vibration Sensor V2
    • DFR0026 DFRobot Ambient Light Sensor
    • DFR0024 Gravity DS18B20 Temperature Sensor V2
    • DFR0023 DFRobot LM35 Linear Temperature Sensor
    • DFR0022 DFRobot Grayscale Sensor
    • DFR0019 Prototyping Shield For Arduino
    • DFR0017 Relay Module Arduino Compatible
    • DFR0015 Xbee Shield For Arduino no Xbee
    • DFR0013 IIC to GPIO Shield V2.0
    • DFR0010 Arduino Nano 328
    • DFR0009 LCD KeyPad Shield For Arduino
  • Sensor (SEN) Index
    • SEN0311 A02YYUW Waterproof Ultrasonic Sensor
    • SEN0307 URM09 Ultrasonic Sensor Gravity Analog
    • SEN0305 HUSKYLENS AI Machine Vision Sensor
    • SEN0304 URM09 Ultrasonic Sensor (Gravity-I2C) (V1.0)
    • SEN0289 Gravity: Digital Shake Sensor
    • SEN0264 TS01 IR Thermal Sensor (4-20mA)
    • SEN0262 Gravity Analog Current to Voltage Converter (4~20mA)
    • SEN0259 TF Mini LiDAR ToF Laser Range Sensor
    • SEN0257 Gravity Water Pressure Sensor
    • SEN0253 Gravity BNO055 + BMP280 intelligent 10DOF AHRS
    • SEN0251 Gravity BMP280 Barometric Pressure Sensors
    • SEN0250 Gravity BMI160 6-Axis Inertial Motion Sensor
    • SEN0249 Gravity Analog Spear Tip pH Sensor Meter Kit For Soil And Food Applications
    • SEN0248 Gravity I2C BME680 Environmental Sensor VOC, Temperature, Humidity, Barometer
    • SEN0246 URM08-RS485 Waterproof Sonar Range Finder
    • SEN0245 Gravity VL53L0X ToF Laser Range Finder
    • SEN0244 Gravity Analog TDS Sensor Meter For Arduino
    • SEN0240 Analog EMG Sensor by OYMotion
    • SEN0237 Gravity Analog Dissolved Oxygen Sensor
    • SEN0235 EC11 Rotary Encoder Module
    • SEN0236 Gravity I2C BME280 Environmental Sensor Temperature, Humidity, Barometer
    • SEN0232 Gravity Analog Sound Level Meter
    • SEN0231 Gravity HCHO Sensor
    • SEN0230 Incremental Photoelectric Rotary Encoder - 400P R
    • SEN0228 Gravity I2C VEML7700 Ambient Light Sensor
    • SEN0227 SHT20 I2C Temperature & Humidity Sensor Waterproof Probe
    • SEN0226 Gravity I2C BMP280 Barometer Sensor
    • SEN0224 Gravity I2C Triple Axis Accelerometer - LIS2DH
    • SEN0223 Conductivity Switch Sensor
    • SEN0221 Gravity Hall Angle Sensor
    • SEN0220 Infrared CO2 Sensor 0-50000ppm
    • SEN0219 Gravity Infrared CO2 Sensor For Arduino
    • SEN0214 20A Current Sensor
    • SEN0213 Heart Rate Monitor Sensor
    • SEN0212 TCS34725 I2C Color Sensor For Arduino
    • SEN0206 IR Thermometer Sensor MLX90614
    • SEN0205 Liquid Level Sensor-FS-IR02
    • SEN0204 Non-contact Liquid Level Sensor XKC-Y25-T12V
    • SEN0203 Heart Rate Sensor
    • SEN0197 Voice Recorder-ISD1820
    • SEN0192 MicroWave Sensor
    • SEN0187 RGB and Gesture Sensor
    • SEN0186 Weather Station with Anemometer Wind vane Rain bucket
    • SEN0185 Hall sensor
    • SEN0178 Triple Axis Accelerometer FXLN83XX Series
    • SEN0177 PM2.5 laser dust sensor
    • SEN0175 UV Sensor v1.0-ML8511
    • SEN0172 LX1972 ambient light sensor
    • SEN0170 Wind Speed Sensor Voltage Type 0-5V
    • SEN0169 Analog pH Meter Pro
    • SEN0165 Analog ORP Meter
    • SEN0161-V2 Gravity Analog pH Sensor Meter Kit V2
    • SEN0161 PH meter
    • SEN0160 Weight Sensor Module
    • SEN0159 CO2 Sensor
    • SEN0153 URM07-UART Ultrasonic Sensor
    • SEN0152 URM06-ANALOG Ultrasonic
    • SEN0151 URM06-PULSE Ultrasonic
    • SEN0150 URM06-UART Ultrasonic
    • SEN0149 URM06-RS485 Ultrasonic
    • SEN0147 Smart Grayscale sensor
    • SEN0143 SHARP GP2Y0A41SK0F IR ranger sensor 4-30cm
    • SEN0140 10 DOF Mems IMU Sensor V2.0
    • SEN0137 DHT22 Temperature and humidity module
    • SEN0132 Carbon Monoxide Gas Sensor MQ7
    • SEN0121 Steam Sensor
    • SEN0114 Moisture Sensor
    • SEN0101 TCS3200 Color Sensor
    • SEN0097 Light Sensor
    • SEN0085 Sharp GP2Y0A710K Distance Sensor 100-550cm
    • SEN0073 9 Degrees of Freedom - Razor IMU
    • SEN0072 CMPS09 - Tilt Compensated Magnetic Compass
    • SEN0043 TEMT6000 ambient light sensor
    • SEN0042 DFRobot Infrared sensor breakout
    • SEN0038 Wheel Encoders for DFRobot 3PA and 4WD Rovers
    • SEN0032 Triple Axis Accelerometer Breakout - ADXL345
    • SEN0019 Adjustable Infrared Sensor Switch
    • SEN0018 Digital Infrared motion sensor
    • SEN0017 Line Tracking Sensor for Arduino V4
    • SEN0014 Sharp GP2Y0A21 Distance Sensor 10-80cm
    • SEN0013 Sharp GP2Y0A02YK IR ranger sensor 150cm
    • SEN0008 SRF10 Ultrasonic sensor
    • SEN0007 SRF08 Ultrasonic Sensor
    • SEN0006 SRF05 Ultrasonic sensor
    • SEN0005 SRF02 Ultrasonic sensor
    • SEN0004 SRF01 Ultrasonic sensor
    • SEN0002 URM04 V2.0
    • SEN0001 URM37 V5.0 Ultrasonic Sensor
  • Telecom Module (TEL) Index
    • TEL0125 FireBeetle Covers LoRa Radio 868MHz
    • TEL0124 SIM7600CE-T 4G(LTE) Shield V1.0
    • TEL0122 FireBeetle Covers-LoRa Radio 915MHz
    • TEL0121 FireBeetle Covers-LoRa Radio 433MHz
    • TEL0120 DFRobot BLE4.1 Module
    • TEL0118 Gravity UART OBLOQ IoT Module
    • TEL0113 Gravity UART A6 GSM & GPRS Module
    • TEL0112 Gravity 315MHZ RF Receiver Module
    • TEL0110 CurieCore intel® Curie Neuron Module
    • TEL0108 Bluetooth Audio Receiver Module
    • TEL0107 WiFiBee-MT7681 Arduino WiFi Wireless Programming
    • TEL0097 SIM808 GPS GPRS GSM Shield
    • TEL0094 GPS Module With Enclosure
    • TEL0092 WiFi Bee-ESP8266 Wirelss module
    • TEL0089 SIM800C GSM GPRS Shield V2.0
    • TEL0086 DF-Beacon EVB
    • TEL0084 BLEmicro
    • TEL0083-A GPS Receiver for Arduino Model A
    • TEL0082 UHF RFID MODULE-UART
    • TEL0081 UHF RFID MODULE-RS485
    • TEL0080 UHF RFID MODULE-USB
    • TEL0079 WIFI Shield V3 RPSMA
    • TEL0078 WIFI Shield V3 PCB Antenna
    • TEL0075 RF Shield 315MHz
    • TEL0070 Multi USB RS232 RS485 TTL Converter
    • TEL0067 WiFi Bee V1.0
    • TEL0051 GPS GPRS GSM Module V2.0
    • TEL0047 WiFi Shield V2.1 For Arduino
    • TEL0044 DFRduino GPS Shield-LEA-5H
    • TEL0037 Wireless Programming Module For Arduino
    • TEL0026 DF-BluetoothV3 Bluetooth module
    • TEL0023 BLUETOOH BEE
    • TEL0005 APC220 Radio Data Module
    • TEL0002 Bluetooth Adapter
  • Motor Driver (DRI) Index
    • DRI0044 2x1.2A DC Motor Driver TB6612FNG
    • DRI0040 Dual 1.5A Motor Driver - HR8833
    • DRI0039 Quad Motor Driver Shield for Arduino
    • DRI0035 TMC260 Stepper Motor Driver Shield
    • DRI0029 Veyron Servo Driver 24-Channel
    • DRI0027 Digital Servo Shield for Arduino
    • DRI0023 Stepper Motor Shield For Arduino DRV8825
    • DRI0021 Veyron 2x25A Brush DC Motor Driver
    • DRI0018 DC Motor Driver 2x15A Lite
    • DRI0017 2A Motor Shield For Arduino Twin
    • DRI0009 Arduino Motor Shield L298N
    • DRI0002 MD1.3 2A Dual Motor Controller
    • DRI0001 Arduino Motor Shield L293
  • Fitting (FIT) Index
    • FIT0458 Micro DC Motor with Encoder-SJ02
    • FIT0450 Micro DC Motor with Encoder-SJ01
    • FIT0449 DFRobot Speaker v1.0
    • FIT0352 Digital RGB LED Weatherproof Strip 60LED m*3m
    • FIT0045 DF05BB Tilt Pan Kit
    • FIT0328 2.7 OLED 12864 display module
  • Robot (ROB) Index
    • ROB0050 4WD MiniQ Complete Kit
    • ROB0150 Micro bit Circular RGB LED Expansion Board
    • ROB0148 micro: Maqueen for micro:bit
    • ROB0139 FlameWheel Robot
    • ROB0137 Explorer MAX Robot
    • ROB0128 Devastator Tank Mobile Platform Metal DC Gear Motor
    • ROB0124 HCR Mobile Platform with Omni Wheels
    • ROB0118 Basic Kit for Turtle 2WD
    • ROB0117 Basic Kit for Cherokey 4WD
    • ROB0114 Devastator Tank Mobile Platform
    • ROB0112 Devastator Tank Mobile Platform
    • ROB0111 4WD MiniQ Cherokey
    • ROB0102 Cherokey 4WD Mobile Platform
    • ROB0080 Hexapod Robot Kit
    • ROB0036 6 DOF Robotic Arm Kit
    • ROB0025 NEW A4WD Mobile Robot with encoder
    • ROB0022 4WD Mobile Platform
    • ROB0005 Turtle 2WD Mobile Platform
    • ROB0003 Pirate 4WD Mobile Platform
  • micro:bit (MBT) Index
    • MBT0005 micro IO-BOX
  • Kit (KIT) Index
    • KIT0098 Breadboard Plugin Components Pack
    • KIT0071 MiniQ Discovery Kit
    • KIT0003 EcoDuino - An Auto Plant Kit
  • Toy (TOY) Index
    • TOY0058 Barometric Pressure Sensor
    • TOY0054 SI7021 Temperature and humidity sensor
    • TOY0048 High Accuracy Dual Axis Inclinometer Sensor Arduino Gadgeteer Compatible
    • TOY0045 TMP100 Temperature Sensor
    • TOY0044 UV Sensor
    • TOY0021 SD2405 Real time clock Module
    • TOY0020 SD2403 Real time clock Module
    • TOY0008 DFRduino Player MP3
    • TOY0007 OLED 2864 display module
    • TOY0006 OLED 9664 RGB Display module
    • TOY0005 OLED 2828 color display module .NET Gadgeteer Compatible
  • Servos (SER) Index
    • SER0044 DSS-M15S 270° 15KG DF Metal Servo with Analog Feedback
  • What is XX series
    • What is mmWave ( MillimeterWave )
    • What is LoRa
    • What is a Gas Sensor: Working and Types
    • What is Lorawan Gateway
    • What is TMR Sensor Technology? Key Advantages and Comparison with AMR and GMR
  • How to select series
    • Arduino Boards Selection Guide
    • A Genuine Guide to High-Quality Brushless DC Motors
    • How to Select the Best Soil Moisture Sensors for Agriculture and Research Lab
  • How it works series
    • How The SPI Protocol Works
    • How the MEMS Gas Sensor Works
    • How Ultrasonic Measuring Wind Speed
    • How do Rain Sensors Work
    • Modbus vs CAN bus
    • How does photoelectricity detect transparent objects
    • How to Calculate the Motor Torque for a Mobile Robot
    • A Brief Analysis of the Principles of Depth Cameras: Structured Light, TOF, and Stereo Vision
    • Sensor connection to Raspberry Pi
    • How to Resolve I2C Address Conflicts
  • PinPong Library
    • PinPong Introduction
      • Introduction
      • Installation Guide
    • Example
      • Basic Library Examples
      • Common Library Examples
      • Extended Library Examples
      • Unihiker Examples
      • More Examples
    • Library Description
      • Board class
      • Pin class
      • ADC class
      • PWM class
    • FAQ
  • Introduction
  • Specifications ApplicationPinOut
  • Tutorial DC Motor Control
  • FAQ
  • More Documents

2A Motor Shield For Arduino Twin

Introduction

This motor shield allows Arduino to drive two channel DC motors. It uses a L298N chip which deliveries output current up to 2A each channel.

Specifications

  • Motor Driven Voltage: 4.8V to 35V
  • Output Current: up to 2A/channel
  • Total Power Dissipation: 25W(T=75℃)
  • Driven Structure: Dual full-bridge driver
  • Driven Power Port: External power terminal, or VIN from Arduino
  • Driven Output Port: 2 channel screw terminals, or male PIN headers
  • Control Port: 4 TTL Compatible digital signals (Digital 10-13)
  • Operation Temperature: -25℃ to 130℃
  • Shield Size: 56x57mm

Application

  • Electric toy car

PinOut

DRI0017_pinout_en.png

  • Power Selection Jumper: The motors can be powered by external power supply(PWMIN) or VIN from Arduino control board(e.g., UNO). Default is VIN showed by the diagram. Note: There are two jumpers in parallel that can afford heavy current.

  • PWMIN Terminal: Used to connect to external power.

  • Motor Terminal: Used to connect motors by screw terminals(M1- M1+ M2- M2+) or PIN headers(1 2 3 4).

  • Analog 3Pin Port: Used to connect sensors or actuators. Note: pinout is (+ - S).

  • Motor Indicator: The red LED lights if Mn+ is positive, whereas the green LED lights.

  • Control Port: Used to control speed and direction of motor. You can get port's description in the "Control Table" printed on the shield.

  • Control Function Table:

Name Function
En Mn Speed control(PWM)
Mn Mn Direction Control
  • Control Signal Truth Table:
En Mn State
L X Disable Mn
H L Mn Foreward(Mn+ is positive)
H H Mn Backward(Mn+ is negative)

Note: n of "Mn" or "En" is 1, 2

Tutorial

DC Motor Control

Target: Control speed and direction of DC motor

Step1: Hardware List

  • DF_UNO 1
  • Micro Metal Gearmotor 2
  • Regulated Power 1
  • The Shield 1
  • Wires

Step2: Software List

  • Arduino IDE

Step3: Wiring

Step4: Sample Code

  1. Open Arduino IDE
  2. Upload the code to UNO
/**set control port**/ const int E1Pin = 10; const int M1Pin = 12; const int E2Pin = 11; const int M2Pin = 13; /**inner definition**/ typedef struct { byte enPin; byte directionPin; } MotorContrl; const int M1 = 0; const int M2 = 1; const int MotorNum = 2; const MotorContrl MotorPin[] = { {E1Pin, M1Pin}, {E2Pin, M2Pin} } ; const int Forward = LOW; const int Backward = HIGH; /**program**/ void setup() { initMotor(); } void loop() { int value; /**test M1 **/ setMotorDirection( M1, Forward ); setMotorSpeed( M1, 100 ); delay(1000); setMotorSpeed( M1, 0 ); delay(100); setMotorDirection( M1, Backward ); setMotorSpeed( M1, 50 ); delay(1000); setMotorSpeed( M1, 0 ); delay(100); /**test M2**/ setMotorDirection( M2, Backward ); for (value = 0 ; value <= 100; value += 5) { setMotorSpeed( M2, value ); delay(100); } setMotorSpeed( M2, 0 ); setMotorDirection( M2, Forward ); for (value = 0 ; value <= 100; value += 5) { setMotorSpeed( M2, value ); delay(100); } setMotorSpeed( M2, 0 ); } /**functions**/ void initMotor( ) { int i; for ( i = 0; i < MotorNum; i++ ) { digitalWrite(MotorPin[i].enPin, LOW); pinMode(MotorPin[i].enPin, OUTPUT); pinMode(MotorPin[i].directionPin, OUTPUT); } } /** motorNumber: M1, M2 direction: Forward, Backward **/ void setMotorDirection( int motorNumber, int direction ) { digitalWrite( MotorPin[motorNumber].directionPin, direction); } /** speed: 0-100 * */ inline void setMotorSpeed( int motorNumber, int speed ) { analogWrite(MotorPin[motorNumber].enPin, 255.0 * (speed / 100.0) ); //PWM }

Step5: Result

M1 will forward at full speed, and then half speed inversion; M2 velocity from fast to slow, reverse first, and then forward.

FAQ

More question and cool idea, visit DFRobot Forum

More Documents

Back to Top

Tag » Arduino Motor Shield V2 Datasheet