This library offers the possibility to use a Brushless 3-wire motor as a servomotor. It’s very convenient for making fast precision movements in many applications such as Gimbals. No need to buy or hack an existing ESC (Electronic Speed Control).

Please note that this library operates with sensor-less brushless motors. So the motor may skip steps!

Warning: When you prototype electronic circuits with high current and Brushless motors, things can go wrong and blue magic smoke can appear! Be careful to choose the correct components.


  • Open Arduino IDE,
  • Go to Sketch > Include Library > Manage Libraries...,
  • Then search for Brushless Servo and hit install.


In BrushlessServo.h you can set the PRECISION constant to the number of divisions you want in one motor revolution.



Attach the BrushlessServo variable to 3 PWM pins.

These pins represent the 3 connectors of the brushless motor, but at low voltage (control signal for MOSFETs…).

Example :

#include <BrushlessServo.h> 

BrushlessServo myservo;

void setup() { 
  myservo.attach(9, 10, 11);

void loop() {} 


Move to a position in degree. This method accepts floats.



Set a power multiplier between 0 (min) and PWMRANGE (max).

This will be applied to the PWM generator.

Better used just after attach().

#include <BrushlessServo.h> 

BrushlessServo myservo;

void setup() { 
  myservo.attach(9, 10, 11);
  myservo.setOutputPower(512);  // Mid power

void loop() {} 


Set how many sinusoid periods are needed for a full revolution. This method takes an integer.

Default to 8 cycles if not set.


Here is a demo with an L293DNE and an ESP8266 running a simple sketch.

Each iteration, the motor is incremented of one degree.