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.
Installation
- Open Arduino IDE,
- Go to
Sketch
>Include Library
>Manage Libraries...
, - Then search for
Brushless Servo
and hit install.
Settings
In BrushlessServo.h
you can set the PRECISION
constant to the number of divisions you want in one motor revolution.
Reference
attach()
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 :
|
|
write()
Move to a position in degree. This method accepts floats.
|
|
setOutputPower()
Set a power multiplier between 0 (min) and PWMRANGE (max).
This will be applied to the PWM generator.
Better used just after attach()
.
|
|
setCycles()
Set how many sinusoid periods are needed for a full revolution. This method takes an integer.
Default to 8 cycles if not set.
Demo
Here is a demo with an L293DNE and an ESP8266 running a simple sketch.
Each iteration, the motor is incremented of one degree.