cstram
Published © GPL3+

Arduino RC interface for helicopters

My friend is a model maker of RC helicopters but he has no experience in Arduino and asked my help for a specific project that he’s making.

BeginnerFull instructions provided1,069
Arduino RC interface for helicopters

Things used in this project

Story

Read more

Schematics

Arduino RC interface for helicopters

Code

Arduino RC interface for helicopters

Arduino
/*  Carlo Stramaglia 10 October 2021
 *  Code for driving a servo motor using an analog model remote conrol
 *  
 *  look at my youtube channel https://www.youtube.com/c/CarloStramaglia
 */

#include<Servo.h> 

Servo servo1; 

int angle=15;

int ch1;

int val1;

void setup() {
  
pinMode(6, INPUT); // Receiver channel 1 PIN input connection to Arduino
pinMode(2, OUTPUT); // Arduino output for LED light
pinMode(13, OUTPUT); // Internal Arduino led for debug purpose
digitalWrite(2, LOW);
digitalWrite(13, LOW); 

servo1.attach(8); // Servo PIN connection on the Arduino
servo1.write(15); // Go to home position at 15 degrees

Serial.begin(9600);
}

void loop() {
  
  ch1 = pulseIn(6, HIGH, 25000); //Configuration of the plseIN on PIN 6 

  if (ch1 > 1400 and ch1 < 1500){
    digitalWrite(2, HIGH);
    digitalWrite(13, HIGH);
  }
    
  else if (ch1 > 1900) {
    digitalWrite(2, LOW);
    digitalWrite(13, LOW);
    //servo1.write(0);
     }
  else if (ch1 > 900 and ch1 < 1000) {
    digitalWrite(2, HIGH);
    digitalWrite(13, HIGH);
    for (angle=15 ; angle <= 130; angle +=1) {
      servo1.write(angle);
      delay (40);
    }
    for (angle=130 ; angle >= 40; angle -=1) {
      servo1.write(angle);
      delay (40);
    }
    for (angle=40 ; angle <= 179; angle +=1) {
      servo1.write(angle);
      delay (40);
    }
    for (angle=179 ; angle >= 15; angle -=1) {
      servo1.write(angle);
      delay (40);
    }
  }
  
 }

Credits

cstram
16 projects • 23 followers
Passionate about IT, Electronics and DIY. Strong believer in Raspberry and Arduino devices. Experience in digital television and security.
Contact

Comments

Please log in or sign up to comment.