RF Joystick for Arduino




About: Creative Computing Club provides technology based learning opportunities for all ages and abilities to participants in Suffolk. We deliver courses on computer programming, video game design, hardware progr...

This is a very simple Instructable which will help you learn how to wirelessly control a second Arduino and the components attached to it. This could be used to control motors on a car, servos on a robotic arm or propellars on a drone.

To complete this example you will need:

2 X Arduino Unos

2 X USB Cables for Arduinos

1 X Dual Axis Analogue Joystick

An assortment of male to male, male to female and female to female jumper leads.

4 X LED's

4 X 200Ω Resitors

1 X 433mhz Transmitter

1 X 433mhz Receiver

Arduino Software

RCSwitch Arduino Library


Firstly download and install the the Arduino Software as per developer instructions for your operating system, secondly download and unzip the RCSwitch Arduino Library. Place the folder inside the Arduino/libraries folder located in your Documents folder. This will allow Arduino to access it.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Transmitter

This sketch will send either the number 1,2,3,4 or 5 depending on the position of the joystick and it will only send

a number if it is different from the previous number it read from the joystick. It will transmit it using "Digital Pin 10" and using the command "mySwitch.send(pos, 23);". The "23" is a number unimportant in these examples however they could be used to determine which signal is going to which receiver if there was more than one.

RF Controlled Joystick

Before this example will work you will need to work out your joysticks "dead zone", these are the horizontal and vertical values of the joystick of when it is not in use. In the code replace the "VALUE" with 0, run the code and then selct tools from the menu in the Arduino software and select Serial Monitor, this will provide you with the two values. Stop the program and replace the two 0's with those values.

Hardware Setup Transmitter

In this example we need four "female to male" jumper leads the first goes from "GND" to "GND" the second goes from "VCC" to "5v". The third "HOZ" to "AO" and finally "VER" to "A1". Now to connect the transmitter. Firstly use a "female to male" jumper lead to connect the "GND" to "GND" on the lefthand side of the board next to "Digital Pin 13". Secondly using a "Female to Female" jumper lead connecting the "VCC" to the top left "5v" header pin. Finally use a "female to male" jumper lead to connect the "ATAD/DATA" pin to "Digital Pin 10". You are now set up to send some data wirelessly.

Arduino Code Transmitter Code

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int hozdead= VALUE ;
int verdead= VALUE ;
int pos = 0;
int oldpos=100;
int val = 0;
int val2 = 0;
void setup() {
void loop() {
    //Read JoyStick
    val = analogRead(0);
    val2 = analogRead(1);
    //UP 1
    if (val> verdead+30){pos=1; Serial.println(pos);}
    //DOWN 2
    if (val< verdead-30){pos=2; Serial.println(pos);}
    //RIGHT 3
    if (val2> hozdead+30){pos=4; Serial.println(pos);}
    //LEFT 4
    if (val2< hozdead-30){pos=3; Serial.println(pos);}
    //DEAD ZONE 5
    if (val>verdead-20 && val< verdead+20 && val2>hozdead-20 && val2< hozdead+20)
         pos=5; Serial.println(pos);
    mySwitch.send(pos, 23);

Now let's make a receiver!

Step 2: Receiver

By now we should have the transmitter setup and transmitting 1,2,3,4 and 5 depending on the position of the

joystick. Now on this the Receiver Arduino we are going to wait for a signal, read it and decide which light to turn on or off.

Hardware Setup Receiver

Now to connect the receiver. Firstly use a "female to male" jumper lead to connect the "GND" to "GND" on the righthand side of the board. Secondly use a "female to male" jumper lead to connect the "DOUT" pin to "Digital Pin 2". Finally using a "Female to Female" jumper lead connecting the "VCC" to the top left "5v" header pin.

Using a "male to male" jumper lead Digital Pin 4" goes to a "220Ω" and then on to a "LED". Using a "male to male" jumper lead "Digital Pin 5" goes to a "220Ω" and then on to a "LED". Using a "male to male" jumper lead "Digital Pin 7" goes to a "220Ω" and then on to a "LED". Using a "male to male" jumper lead "Digital Pin 9" goes to a "220Ω" and then on to a "LED". These four "LED's" are then returned to "GND" using Using a "male to male" jumper leads.

You are now set up to receive some data wirelessly.

Arduino Code Receiver

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int pos = 0;
void setup() {
void loop() {
    if (mySwitch.available()) {
        int value = mySwitch.getReceivedValue();
        if (value > 0) {
            if (mySwitch.getReceivedValue()==1){digitalWrite(4,HIGH);}
            else if (mySwitch.getReceivedValue()==2){digitalWrite(5,HIGH);}
            else if (mySwitch.getReceivedValue()==3){digitalWrite(8,HIGH);}
            else if (mySwitch.getReceivedValue()==4){digitalWrite(9,HIGH);}
            else if (mySwitch.getReceivedValue()==5){

And there you have it you should now be able to control the LEDs via a joystick on the first Arduino.

Hope you like it, please leave comments if you can think of any improvements or you use it in any of your projects.

Creative Computing Club


Step 3:

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    14 Discussions


    2 years ago

    Hello, can i use arduino mini pro + arduino UNO for this project instead of 2x arduino UNO?

    Thanks <3


    2 years ago

    What is the change if we want to use a pot metre instead of a joystick.

    I wanted to send values for each value from the pot metre.


    2 years ago

    How can i change the pin of the receiver/transmitter?


    2 years ago

    big project
    how can I add 3 buttons fire?
    Thanks, it's very kind of you



    2 years ago

    nice tutorial , thank you,..... but i am getting this error msg when compiling;

    Arduino: 1.6.12 (Windows 7), Board: "Arduino/Genuino Uno"

    C:\Users\Mohamed\AppData\Local\Temp\ccWjAw5T.ltrans0.ltrans.o: In function `main':

    ccWjAw5T.ltrans0.o:(.text.startup+0x2e6): undefined reference to `RCSwitch::send(unsigned long, unsigned int)'

    collect2.exe: error: ld returned 1 exit status

    exit status 1

    Error compiling for board Arduino/Genuino Uno.

    option enabled in File -> Preferences.


    3 years ago

    How can be the code of the transmitter implemented to use for example 4 simple switches?


    3 years ago

    indeed, nice and simple. Good work.
    Is there any way we can improve the transmission speed so that the changes are taking place faster?

    please help me i got this error"Arduino: 1.6.1 (Windows 7), Board: "Arduino Duemilanove or Diecimila, ATmega328"

    sketch_jul25a.ino:3:14: error: 'VALUE' was not declared in this scope

    sketch_jul25a.ino:4:14: error: 'VALUE' was not declared in this scope

    Error compiling.

    This report would have more information with

    "Show verbose output during compilation"

    enabled in File > Preferences.

    1 reply

    ronakpatel5391, the error you're getting is because you need to find the horizontal and vertical "Dead Zone" values of your joystick and replace "VALUE" for each one with it. I hope this helps!


    4 years ago on Introduction

    Very nice, will definitely come in handy some times.

    Did you think about switching the Arduinos with core Atmega328 chips? Could that be done?

    2 replies

    Reply 4 years ago on Introduction

    Good stuff, we tend to use "off the shelf" parts as we teach 11 to 16-year-olds, but those would be good for the older students.