1 second delay with NRF24L01 servo control

WP_20160207_16_04_35_Pro_LI.jpg (1958734Bytes)


I am building a Project which targets to:

Driving the Car with Steering Wheel connected to PC.

PC connected to Arduino which will transmit the Steering wheel commands to other Arduino via NRF24L01 modul.

On Car Side:

I will use two Arduino Cards,

- one for motorshield connection,

- one for NRF24L01 connection.

Arduino with NRF24L01 will be master, and Arduino with motorshild will be slave with I2C connection.

Currently i manage to send data and receive properly, the RC car that i will use has a DC steering control (with all left and all right, no precision position),

i bought one CHEAP servo to replace it. I connected the servo to RX part and control it via the steering wheel.

But it works with 1 sec delay. If i disable the servo, i can see the commands appearing on RX side like real time. but when i connect the servo, it slows down. can it be related to servo quality ?

I haven't attached the second Arduino yet for motorol control, just was checking servo control for now.

Any suggestion help will be very wellcome for delay problem.



My Code on RX part is as follows:

#include <VarSpeedServo.h>

#include <SPI.h>

#include <RF24.h>

#define led 3

#define RF_CS 9

#define RF_CSN 10

RF24 radio(RF_CS, RF_CSN);

const uint64_t pipes[2] = { 0xe7e7e7e7e7LL, 0xc2c2c2c2c2LL }; // paralel veri yolu adresleri

bool done = false;

VarSpeedServo myservo;

int pos = 0;

void setup() {


  pinMode(led, OUTPUT);



  radio.openReadingPipe(1, pipes[0]);



  pinMode(1, OUTPUT);

  myservo.attach(7); //analog pin 0


void loop() {

  if (radio.available()) {

    int Komut;

    int Value;

    radio.read( &Komut, sizeof(int) );

    Serial.print("Incoming Command: ");


    if (Komut < 4000)  // Steering Wheel Command


      int X = Komut - 2000;  //Serial.println(X);

      if (abs(X) > 30) // Avoid small steering wheel commands.


        int stepX = map(X, -1000, 1000, 0, 180);

        Serial.print("Servo Command send: ");



        myservo.write(stepX, 255, false);

        // step, speed (1--255), wait for action to finish



    Komut = 0;




I routinely use the nRf24L01 radios on a processor (PIC24) with hardware SPI and interrupts. Typical times for 32 byte messages are under 250usec so I don’t think your delay with the physical radio. I do not know if the Arduino libraries will have confilct in pin or timer resources. Perhaps you could develop your oun driver code for both nrf24l01 and servo.

Hı Ggallant, as you

Hı Ggallant,

as you mentioned, if i don’t use servo, and only print the recived data to screen, i don’t see any delay that can effect the project. but when i use servo it response slowly.

i will check the servo options to see if i can heal it.


Gurhan Cagin

What do you mean when you

What do you mean when you are saying you’re disabling the servo? Do you simply disconnect the servo wire, or are you actually changing something in the code to disable it? 

If you’re not changing the code, it should run exactly the same. No matter if the servo is actually wired up or not. Meaning your problem is in the power supply.

Hi, Yes, exactly i


   Yes, exactly i disable the code. don’t sent anything to Servo. 


Gurhan Cagin