This is a new brushless DC motor with the added bonus of a built-in motor driver - this means it doesn't need any external motor drivers and you can connect it to an Arduino board directly!

The brushless motor comes with direction control, PWM rotational speed control and frequency feedback output. It is suitable for miniature-sized mobile robotic platforms. With the motor speed feedback signal, it is useful in cyclic control systems.




Label Name Description
1 PWM PWM Control, 0-5V (20~30KHz)
2 Power - POWER- (GND)
3 Direction Direction Pin:+5V or dangling, motor moves forward;
GND or cathode, motor moves backward.
4 FG FG signal pin(need a pull-up resister-5k)
5 Power + POWER+ (12V)

warning_yellow.png NOTE: Sometime, the manufacturer provides a different color cable, but the cable order is same.


Here is a example how to use this motor, Just follow the guide, and you will get it work.


First, prepare the following hardware and software.

Connection Diagram

After the hardware, the module is connected with the UNO in the following diagram.


warning_yellow.png NOTE: Remember to connect Arduino GND to the POWER-.

Sample Code

  1. Open the Arduino IDE and copy the following code to the IDE. Select your board's serial port and the board type (e.g. Arduino UNO) and upload the sample code.
  2. Open the Serial monitor.
  3. Enter a number between 0 and 255 to set the motor's speed. (0: Maxmum speed; 255: Stop)
    • The code will alternates its rotation direction every 5 seconds.
int i = 0;
unsigned long time = 0;
bool flag = HIGH;

void setup() {
  // put your setup code here, to run once:
  pinMode(10, OUTPUT); //PWM PIN 10  with PWM wire
  pinMode(11, OUTPUT);//direction control PIN 11 with direction wire

void loop() {
  // put your main code here, to run repeatedly:
  if (millis() - time > 5000)  {
    flag = !flag;
    digitalWrite(10, flag);
    time = millis();
  if (Serial.available())  {
    analogWrite(11, Serial.parseInt());  //input speed (must be int)
  for(int j = 0;j<8;j++)  {
    i += pulseIn(9, HIGH, 500000); //SIGNAL OUTPUT PIN 9 with  white line,cycle = 2*i,1s = 1000000us,Signal cycle pulse number:27*2
  i = i >> 3;
  Serial.print(111111 / i); //speed   r/min  (60*1000000/(45*6*2*i))
  Serial.println("  r/min");
  i = 0;

Expected Results


More Documents

If you have any questions or cool ideas to share, please visit the DFRobot Forum

DFshopping_car1.png Get Brushless DC Motor with Encoder 12V 159RPM from DFRobot Store or DFRobot Distributor.

Turn to the Top