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

Arduino UNO-Based RC Controlled Brushless Motor and Servo System

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based RC Controlled Brushless Motor and Servo System

Circuit Documentation

Summary

This circuit is designed to control a brushless motor and multiple servos using an Arduino UNO microcontroller. The circuit includes an Electronic Speed Controller (ESC) for the motor, a 6-channel RC receiver for remote control, and an Adafruit Proto Shield for easy prototyping. The power is supplied by an 11.1V 3S LiPo battery. The Arduino UNO reads signals from the RC receiver and controls the ESC and servos accordingly.

Component List

11.1V 3S Battery LiPo 40C 2250mAh

Arduino UNO

Electronic Speed Controller (ESC)

Brushless Motor

Adafruit Proto Shield R3

RC Receiver 6 Channels

Servo

Wiring Details

11.1V 3S Battery LiPo 40C 2250mAh

Arduino UNO

Electronic Speed Controller (ESC)

Brushless Motor

Adafruit Proto Shield R3

RC Receiver 6 Channels

Servo

Code Documentation

#include <Servo.h>

unsigned long previous_millis = 0;
int interval = 10;

#define CH1 3
#define CH2 5
#define CH3 6
#define CH4 9
#define CH5 10
#define Servo1 7
#define Servo2 12
#define Servo3 4

// Read the number of a given channel and convert to the range provided.
// If the channel is off, return the default value
int readChannel(int channelInput, int minLimit, int maxLimit, int defaultValue){
  int ch = pulseIn(channelInput, HIGH, 30000);
  if (ch < 100) return defaultValue;
  return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Red the channel and return a boolean value
bool redSwitch(byte channelInput, bool defaultValue){
  int intDefaultValue = (defaultValue)? 100: 0;
  int ch = readChannel(channelInput, 0, 100, intDefaultValue);
  return (ch > 50);
}

Servo ESC;
Servo serv1;
Servo serv2_pitch_r;
Servo serv3_pitch_l;

void setup(){
  Serial.begin(9600);
  serv1.attach(Servo1);
  serv2_pitch_r.attach(Servo2);
  serv3_pitch_l.attach(Servo3);
  ESC.attach(11,1000,2000);
  pinMode(CH1, INPUT);
  pinMode(CH2, INPUT);
  pinMode(CH3, INPUT);
  pinMode(CH4, INPUT);
  pinMode(CH5, INPUT);
  pinMode(2, OUTPUT);
}

int ch1Value, ch2Value, ch3Value, ch4Value;
bool ch5Value;

void loop() {

    unsigned long current_millis = millis();
    if(current_millis - previous_millis > interval) {
        ch1Value = readChannel(CH1, -100, 100, 0);
        ch2Value = readChannel(CH2, -100, 100, 0);
        ch3Value = readChannel(CH3, -100, 100, -100);
        ch4Value = readChannel(CH4, -100, 100, 0);
        ch5Value = redSwitch(CH5, false);

        int escvel = map(ch3Value,-