ESC Calibration and Speed Adjustment from Serial Port by Arduino

Sometimes we need to know how an Electrical Speed Controller (ESC) responds to a PWM signal so that the motor speed control could be more precisely. This post provides an Arduino sketch to manually calibrate an ESC and adjust the speed of a brushless motor. The schematic view to route wires is shown as following figure. The PWM signal is generated by the UNO and outputted by the pin 4.

Schematic view

The arduino sketch is given as follows:

#include <servo.h>

#define MAX_SIGNAL 2000  % maximum PWM width
#define MIN_SIGNAL 700     % minimum PWM width
#define MOTOR_PIN 4         % define the pin to output PWM signal

Servo motor;

int RUN_SIGNAL=MIN_SIGNAL;  % initialize the output PWM signal

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


  Serial.println("Now writing maximum output.");
  Serial.println("Turn on power source, then wait 2 seconds and press any key.");

  // Wait start command from serial port
  while (!Serial.available());;

  // Send min output
  Serial.println("Sending minimum output");


void loop() {  
  char c;
      RUN_SIGNAL+=10; % input 'a' from serial port to increase the PWM width
      RUN_SIGNAL-=10; % input 'd' from serial port to decrease the PWM width
  motor.writeMicroseconds(RUN_SIGNAL); % write the reference width to drive the motor

Leave a Comment

Your email address will not be published. Required fields are marked *