Simple Wireless Remote Control for the Arduino

Adafruit Industries supply a range of low cost of wireless transmitters and receivers which make it straightforward to add simple remote control capabilities to your electronics projects. In this tutorial, we'll begin by creating a simple stand alone system and then demonstrate how to link a remote control receiver to an Arduino Uno running a simple program.

Available Hardware Options

The Adafruit wireless transmitter and receiver devices are based on the PT 2262 and PT 2272 ICs produced by Princeton Technology Corporation.

Three different transmitter key-fobs are available, having one, two or four buttons. A number of wireless receiver options are offered, typically having four decoded outputs plus an additional Valid Tansmission signal. Receiver variants are available with momentary action (hold button to activate), latched operation (press once for 'On' and again for 'Off'), and toggle action (selecting a new option cancels the previous one).

The different operating characteristics of the three types of receiver are clearly illustrated in this short YouTube video.

Stand Alone Operation

We'll use the momentary action receiver here, as the latching or toggle type behaviours may be achieved in software, if required. The receiver requires a power supply in the range 4–15 volts, so may be conveniently powered from a battery power pack, or as shown below, a 5 V supply taken from an Arduino Uno.

A total of five signal outputs are provided by the receiver. As its name suggests, the Valid Transmission (VT) output simply indicates that a signal has been received, so this signal may be omitted if not needed. Data outputs D3–D0 (equivalent to key fob buttons A–D respectively) are active high and are capable of supplying sufficient current to drive an LED – but don't forget to include a suitable current limiting resistor, as shown above.

With stand alone operation demonstrated, the next step is to add simple remote control capabilities to a computer. We'll employ an Arduino Uno for our test, but any suitable device may be used.

Computer-based Operation

To configure the hardware, remote control decoder outputs D3–D0 are first connected to Arduino inputs A0–A3 respectively (i.e. in reverse order to the pin numbers). The four data LEDs are now linked to Arduino outputs 3, 5, 6 and 9. Note that there is no direct connection between the remote control and the LEDs, so a suitable program will be required to activate the appropriate Arduino output pin when a remote control signal is received.

The following program shows a traditional (but rather verbose) solution.

  Digital Input / Output using standard programming techniques

 * Input A connected in pin A0
 * Input B connected in pin A1
 * Input C connected in pin A2
 * Input D connected in pin A3
 * Output W connected to pin Arduino 3
 * Output X connected to pin Arduino 5
 * Output Y connected to pin Arduino 6
 * Output Z connected to pin Arduino 9


// Use constants to set pin numbers

const int inputA = A0;       // Input A
const int inputB = A1;       // Input B
const int inputC = A2;       // Input C
const int inputD = A3;       // Input D
const int outputW = 3;       // Output W
const int outputX = 5;       // Output X
const int outputY = 6;       // Output Y
const int outputZ = 9;       // Output Z

// Use variables for values that will change:
int readState = 0;           // Variable for reading the input status

void setup() {
  // Setup inputs:
  pinMode(inputA, INPUT);
  pinMode(inputB, INPUT);
  pinMode(inputC, INPUT);
  pinMode(inputD, INPUT);
  // Setup outputs:
  pinMode(outputW, OUTPUT);
  pinMode(outputX, OUTPUT);
  pinMode(outputY, OUTPUT);
  pinMode(outputZ, OUTPUT);

void loop() {
  // Read the state of the first input value:
  readState = digitalRead(inputA);

  if (readState == HIGH) {
    // turn LED on:
    digitalWrite(outputW, HIGH);
  else {
    // turn LED off:
    digitalWrite(outputW, LOW);
  // Read the state of the second input value:
  readState = digitalRead(inputB);

  if (readState == HIGH) {
    // turn LED on:
    digitalWrite(outputX, HIGH);
  else {
    // turn LED off:
    digitalWrite(outputX, LOW);
  // Read the state of the third input value:
  readState = digitalRead(inputC);

  if (readState == HIGH) {
    // turn LED on:
    digitalWrite(outputY, HIGH);
  else {
    // turn LED off:
    digitalWrite(outputY, LOW);
  // Read the state of the fourth input value:
  readState = digitalRead(inputD);

  if (readState == HIGH) {
    // turn LED on:
    digitalWrite(outputZ, HIGH);
  else {
    // turn LED off:
    digitalWrite(outputZ, LOW);

An alternative is to develop a PLC-style solution, as illustrated by the following ladder diagram.

Each horizontal rung of the ladder diagram shows a set of vertical switch contacts at the left connected to a corresponding output coil at the right. An equivalent 'instruction list' style Arduino program is shown below.

#include <plcLib.h>

/* Programmable Logic Controller Library for the Arduino and Compatibles

   Digital Input Output - Single bit I/O

   Input A connected to input X0 (Arduino pin A0 / Tinkerkit pin I0)
   Input B connected to input X1 (Arduino pin A1 / Tinkerkit pin I1)
   Input C connected to input X2 (Arduino pin A2 / Tinkerkit pin I2)
   Input D connected to input X3 (Arduino pin A3 / Tinkerkit pin I3)
   Output LED connected to output Y0 (Arduino pin 3 / Tinkerkit O5)
   Output LED connected to output Y1 (Arduino pin 5 / Tinkerkit O4)
   Output LED connected to output Y2 (Arduino pin 6 / Tinkerkit O3)
   Output LED connected to output Y3 (Arduino pin 9 / Tinkerkit O2)

   Software and Documentation:

void setup() {
  setupPLC();  // Setup inputs and outputs

void loop() {
  in(X0);      // Read Input 0
  out(Y0);     // Send to Output 0

  in(X1);      // Read Input 1
  out(Y1);     // Send to Output 1

  in(X2);      // Read Input 2
  out(Y2);     // Send to Output 2
  in(X3);   // Read Input 3 and send to Output 3
  out(Y3);  // Send to Output 3

You will first need to install our plcLib software prior to compiling and running the above program. In fact, with PLC library installed, a similar example program to the above is available by selecting the File > Examples > plcLib > InputOutput > DigitalInputOutput. option from the Arduino IDE. (The main difference is the use of a small number of inverted inputs and outputs in the example program.)

Potential Applications

Having successfully interfaced the remote control receiver to an Arduino Uno, potential applications are pretty much limited by your imagination!

The PT 2272 data sheet suggests the following as possible applications: -

  • car security system
  • garage door controler
  • remote controlled fan
  • home security / home automation system
  • remote control toys
  • remote control for industrial applications

Bear in mind however, that the Adafruit circuit boards do not provide a unique address decoding option, so each encoder/decoder pair is in effect an 'identical clone'. (This is a feature of the Adafruit boards, rather than the PT 2262 / PT 2272 ICs themselves.) Unintended operation of nearby receivers containing the same circuit board is a possible issue, which needs to be taken into account, as does the potential for impersonation by a third party in possession of an identical transmitter.

Clearly, security may not be a concern in certain types of application, such as electronic toys, or even something like a 'lost keys finder'. For more sensitive scenarios it may be possible to add an extra layer of security in software. For example, asking the user to input a 6-digit PIN such as A - B - D - C - A - D prior to activation, would give 4,096 possible unique codes (46 = 4,096).

Related Topics