Rick Waldron edited this page Aug 19, 2018 · 43 revisions

The ESC class constructs objects that represent a single ESC (Electronic Speed Control) component attached to the physical board. ESC objects are similar to Servo objects as they both use PWM pins to communicate with the physical ESC. Currently, this class assumes the ESC is pre-calibrated.

See also:


  • pin A Number or String address for the ESC pin (PWM).

    var esc = new five.ESC(9);
  • Options An object of property parameters.

    Property Type Value/ Description Default Required
    pin Number, String Any PWM Pin. The address of the PWM pin the ESC is attached to yes
    controller String DEFAULT, PCA9685. Controller interface type. "DEFAULT" no
    pwmRange Array [ min, max ] The pulse width range in microseconds. [1000, 2000] no
    device String FORWARD, FORWARD_REVERSE. Device capability type. "FORWARD" no
    neutral Number Neutral point, usually the middle of the PWM range. Varies by device no
  • PCA9685 Options (controller: "PCA9685")

    Property Type Value/Description Default Required
    address Number I2C device address. 0x40 no


Property Name Description Read Only
id A user definable id value. Defaults to a generated uid No
pin The pin address that the ESC is attached to No
value The value of the last/current speed. Yes

Component Initialization


new five.ESC(9);



new five.ESC({
  controller: "PCA9685",
  pin: 1



new five.ESC({
  pin: 9, 
  device: "FORWARD_REVERSE", 



Standard ESC

var five = require("johnny-five");
var board = new five.Board();

board.on("ready", function() {

  var esc = new five.ESC(11);
  board.loop(100, () => 



  • speed(value) Deprecated. Use throttle(μs)

  • throttle(value) Throttle the speed of the ESC by setting a pulse in μs.

    var esc = new five.ESC(9);
    esc.throttle(1500); // 1500μs is half speed of a single direction or neutral of a bidirectional
  • brake() Brake the ESC

    var esc = new five.ESC(9);


Calibrating an ESC

This isn't a requirement, but if you experience issues with your ESCs, it might prove helpful

Load the following sketch onto your Arduino, via the Arduino IDE follow the instructions.

This requires that the ESC's power source is off or disconnected at the start of the calibration process. You will be prompted to turn on/reconnect the power during the process.

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 1000
#define MOTOR_PIN 12

Servo motor;

void setup() {
  Serial.println("Program begin...");
  Serial.println("This program will calibrate the ESC.");


  Serial.println("Calibrating Maximum Signal");
  Serial.println("Turn on power source, then wait 2 seconds and press any key + <enter>");

  // Wait for input
  while (!Serial.available());

  // Send min output
  Serial.println("Calibrating Minimum Signal");


void loop() {  

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.