Radio Control using Arduino and NRF24L01
20141211 -

This sample of radiocontrol using two
Arduinos is based on this post :

This implementation takes advantage of improved features of the newest version of nano-eCat expansion board and I/O matrix.

nano-eCat has three new jumpers to select 5V or 3.3V as eCat bus supply voltage. This is convenient because NRF24L01 should be powered at 3.3V. However their input/output pins are 5V tolerant.

eCat Bus pinout
I/O matrix has two new connectors 5x2 (female and male) able to customize any two rows connector crossing matrix's rows and columns with jumpers :


I/O matrix and nano-eCat with proper jumpers settings to connect Arduino Nano and NRF24L01. It can be replicated for transmitter and receiver :


First trial to test wireless communications is upload transmitter Arduino code rf24_01.ino and receiver Arduino code rf24_02.ino. Transmitter should be connected to computer through USB to be able to watch 57600 bauds serial connection using minicom, gtkterm, qtTerm or similar. Receiver can be powered remotely and its task is to pong messages sent by transmitter. Established serial communication is checked through computer's serial monitor plugged at the transmitter.

Once wireless communications between Arduinos have been tested, it is time to add funcionalities. Previous codes have been slightly modified to be able to control two servos remotely using a joystick.

At the transmitter side is added analog read from a two axis joystick and loop function waits 100 milliseconds instead of 1 second :

unsigned long int nAnalogValue2Degrees(unsigned long int nAnalogValue){
    return (nAnalogValue * 180) / 1023;

void loop(void)
    int analogPinX = 0,analogPinY = 1;

    unsigned long int deg[2];
    deg[0] = nAnalogValue2Degrees(analogRead(analogPinX));
    deg[1] = nAnalogValue2Degrees(analogRead(analogPinY));
    printf("Now sending x : %lu , y : %lu  ...",deg[0],deg[1]);
    bool ok = radio.write( deg, 2*sizeof(unsigned long) );

Transmitter code : rf24_03.ino

transmitter layout

At the receiver side has been added servo code :

#include <Servo.h>

Servo servo1; Servo servo2;


void setup(void){


    if ( radio.available() ){
      unsigned long int deg[2];

      bool done = false;
      while (!done)      {
        // Fetch the payload, and see if this was the last one.
        done = deg, 2*sizeof(unsigned long) );    
        // Write to servo
        // Delay just a little bit to let the other unit
        // make the transition to receiver

Receiver code : rf24_04.ino

receiver layout

Video :

Boards used in this example :
nano-eCat I/O matrix
ArduinoNano Joystick Servo