Introduction

An ordinary DC motor requires an H Bridge to work with a arduino microcontroller such as an arduino UNO. For newcomers to electronics, the process of finding the right motor driver, connecting it to the MCU and learning the relevant electronic theory can be confusing and frustrating when you just need something to work quickly. We hope that using the DC Micro Metal gear motor changes this. The new micro DC geared motor is easy to operate - using the DFRobot "Gravity" interface, you are able to control the motor using only one control signal. Easily implement forward/reverse control and speed control via PWM. This motor also combines the features of a DC motor and 360 degree servo. We have also increased the stop range and reduced standby power consumption, so the current draw is less than 1mA without signal control. Ideal for DIY projects!

NOTE: The embedded control chip will consume a small amount of the input voltage, therefore the motor voltage will be slightly reduced. The motor speed will also be slightly slower than the rated motor speed.

Specification

Motor Overview

DFR0399

No. Label Description
1 Signal PWM signal input
2 Power VCC (3.5~8V)

Tutorial

The motor works similar to a 360 degree rotation servo, using the servo library (Arduino IDE included).

Requirements

Connection Diagram

Micro Metal DC Geared Motor w/Driver

Sample Code

#include <Servo.h>

#define speed_maxP 0   //Clockwise rotation (Max speed)
#define speed_maxN 180 //Anticlockwise rotation (Max speed)
#define speed_stop  90 //Stop

Servo  mymotor;  // create servo object to control a servo (my motor)
                 // twelve servo objects can be created on most boards

int pos=0;
void setup()
{
  mymotor.attach(9);  //attaches the motor on pin 9 to the servo object
}
void loop()
{
  /**********Using 180 degree servo library to control N20 motor******************************/
  mymotor.write(speed_stop);     //Stop
  delay(1000);                   //delay 1s
  mymotor.write(speed_maxP);     //Clockwise rotation
  delay(2000);                   //delay 2s
  mymotor.write(speed_maxN);     //Anticlockwise rotation
  delay(2000);                   //delay 2s
  for(pos=speed_maxP;pos<speed_maxN;pos++)  //slow down, change the direction and speed up
  {
    mymotor.write(pos);
    delay(50);
  }
}

Note

"0~180" degree corresponds to the pulse width signal "500us~2500us". When we give a value between 8199° (14001600us), the motor will stop; When we give a value less than 81° (1400us), the motor rotates clockwise, the smaller the value, the faster the speed, 0° (500us) is the maximum speed; When we give a value greater than 99° (1600us), the motor rotates anticlockwise, the larger the value, the faster the speed, 180 ° (2500us) is the maximum speed; Since every motor has a little difference, we enlarge the stop range to ensure that the motor can be stopped correctly.

FAQ

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

More

Dimension

DFshopping_car1.png Shopping from Gravity: DC Micro Metal Gear Motor w/Driver - 75:1 DFshopping_car1.png Shopping from Gravity: DC Micro Metal Gear Motor w/Driver - 50:1 DFshopping_car1.png Shopping from Gravity: DC Micro Metal Gear Motor w/Driver - 30:1 DFshopping_car1.png Shopping from DFRobot Distributor.