Use that old RC transmitter to control your Arduino projects

Got Questions? Click here and post them in the Brainy-Bits Forum to get help!

OVERVIEW

We all have that old Radio Controlled helicopter, plane, drone… That we bought, played with it once or twice, crashed once, twice, three times, and now it’s just there collecting dust.

Well why not use the transmitter and receiver to control an Arduino project at great distances.

The range on even the simplest of RC transmitter is around 300-500 feet, which is much better than any Bluetooth or WiFi connection.

Of course compared to those it’s not as versatile and it’s only a one way communication, but for turning on relays or lighting some Led’s it can be very useful.

In this tutorial we will see how to extract the values from the RC Receiver (the one that’s in the heli, plane, etc…), and display them in PUTTY, which is more versatile than using the Serial Monitor that’s included with the Arduino IDE software.



SCHEMATIC

Use RC transmitter with an Arduino

We will be connecting 2 channels from the RC Receiver, but you can connect as many as are available on the Receiver you are using.

Channel 1 is connected to pin 8

Channel 2 is connected to pin 9

 

We are using the 5V and Ground from the UNO to power the RC Receiver directly.

 

Note:  Most recent RC Receiver follow this guideline for the pins:

Left to Right:  ‘Signal Pin’ – ‘Positive’ – ‘Negative (Ground)’

or wire color:  ‘Yellow’ – ‘Red’ – ‘Black’



THE CODE

We are using the ‘PulseIn’ function to count the amount of micro seconds between pulse from the RC Receiver.

‘PulseIn’ will wait for the pin to go ‘HIGH’ in our example, start a timer, then waits for the pin to go ‘LOW’.

The timer result will then be saved in a variable that we will display in PUTTY.

Of course you can also use the Arduino IDE Serial Monitor to display the results, but since the results will be scrolling very fast it might be hard to read, which is why PUTTY is better since we can include some ‘Clear Screen’ and ‘Home’ commands inside our code.

You can find a link to download ‘PUTTY’ at the bottom of this page.

 

As always you can have a look at the tutorial video for more information.

#define rcPin1 8   // Pin 8 Connected to CH1 of Transmitter;
#define rcPin2 9   // Pin 9 Connected to CH2

int ch1 = 0;  // Receiver Channel 1 PPM value
int ch2 = 0;  // Receiver Channel 2 PPM value

void setup() {
  pinMode(rcPin1, INPUT);
  pinMode(rcPin2, INPUT);
  Serial.begin(9600);
}

void loop() {

// Read in the length of the signal in microseconds
  ch1 = pulseIn(rcPin1, HIGH, 20000);  // (Pin, State, Timeout)
  ch2 = pulseIn(rcPin2, HIGH, 20000);

  Serial.print("Channel #1: ");
  Serial.println(ch1);
  Serial.print("Channel #2: ");
  Serial.println(ch2); 
  Serial.println("------------");
  delay(500);
  
// Clear screen and move cursor Home, only works in PUTTY
  Serial.write(27);       // ESC command
  Serial.print("[2J");    // clear screen command
  Serial.write(27);
  Serial.print("[H");     // cursor to home command
}



TUTORIAL VIDEO



DOWNLOAD

Copy the above Sketch code in your Arduino IDE software to program your Arduino.

 

You can download PUTTY here if you wish to use it instead of the Arduino IDE Serial Monitor.

 

1 Comments

Caleb - Feb 02, 2017

Hey man, I’m trying to use arduino with an rc TX and rx to control an rc car. I wanted to have 1 motor controlling the back steering and 1 servo controlling the 2 front steering wheels. In your next 2 part video in part 2 you guys have created a code and I think I can modify it to work. Just wondering what your thoughts were? As simple as it might sound to you I am brand new to arduino and cannot find code that will do this. Thanks!

Got Questions? Click here and post them in the Brainy-Bits Forum to get help!

Leave a comment

Comments have to be approved before showing up