Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled ESC for Brushless Motor with Joystick Interface

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled ESC for Brushless Motor with Joystick Interface

Circuit Documentation

Summary of the Circuit

This circuit is designed to control a brushless motor using an Arduino UNO microcontroller and an Electronic Speed Controller (ESC). The motor's speed is regulated by a signal generated by the Arduino, which is influenced by the position of an analog joystick. The joystick's vertical movement is used to determine the motor's speed. The ESC receives power from a Lipo battery and also provides a regulated 5V output that powers the Arduino UNO and the joystick. The ESC interfaces with the motor through its motor output pins and controls the motor's speed based on the signal from the Arduino.

Component List

Arduino UNO

Electronic Speed Controller (ESC)

Lipo Battery

Brushless Motor

Analog Joystick (Wokwi Compatible)

Wiring Details

Arduino UNO

Electronic Speed Controller (ESC)

Lipo Battery

Brushless Motor

Analog Joystick (Wokwi Compatible)

Documented Code

#include<Servo.h>

#define ESC_PIN 2

Servo esc;

int joyStickpin  = A1; // Not used in the current setup
int joyStickValue = 0; // Not used in the current setup
int EscPin       = 9;  // Not used in the current setup
void setup() {
  // Attach the ESC to pin D2 and set the initial signal range
  esc.attach(ESC_PIN,  1000, 2000);
  // Initialize the motor's speed to 0
  esc.write(0);
  // Allow the ESC to initialize
  delay(2000);
}

void loop() {
  // Read the joystick value from the analog pin A0
  int joystickValue = analogRead(A0);
  // Constrain the joystick value to the upper half from the center
  joystickValue = constrain(joystickValue, 550, 1023);
  // Map the joystick value to a range suitable for the ESC
  int motorSpeed = map(joystickValue, 550, 1023, 0, 180);
  // Write the mapped value to the ESC, controlling the motor speed
  esc.write(motorSpeed);
}

The code provided is for an Arduino sketch that reads the position of an analog joystick and translates it into a speed control signal for a brushless motor via an ESC. The Servo library is used to generate the control signal, and the joystick's horizontal axis is used to determine the motor's speed. The code includes setup and loop functions that initialize the ESC and continuously read the joystick position to control the motor speed.