UNO NRF Servo issues

Hi - Im using NRF wireless with an arduino UNO. I'm able to send signals from UNO to UNO, but for whatever reason I cant get the servo thats on the receiving UNO to respond to anything. I suspect its some type of interference from the NRF? If the servo is plugged into the UNO and running off of the UNO 5v, then the receiver wont get any data over serial. I plugged the servo ground and 5V into its own power pack and the servo will hum quite loudly but not move. The serial does show that data is coming into the UNO. Currently I'm using no capacitors but suspect that Ill need to add some - and looking for some advice.

The receiver is definitely recognizing the "start button" going to 0.

Thanks very much

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "Servo.h"

int joystick[2];
int button[1];
int startButton;
int stopButton;


Servo myservo;


RF24 radio(7, 8);

const uint64_t pipe = 0xE8E8F0F0E1LL; //this is the pipe address for the radios

void setup()
        {
          myservo.attach(9);
          myservo.write(90);
          Serial.begin(9600);
         
          Serial.println("NRF STARTING SON");
          radio.begin();
          radio.openReadingPipe(1,pipe);
          radio.startListening();
          //radio.printDetails();
          //pinMode(led, OUTPUT);
        }

void loop()
{
  if ( radio.available() ) 
  { 

               {


                  //payload_t payload;
                  radio.read( &joystick, sizeof(joystick) );
                  
                  //done = radio.read( &joystick, sizeof(joystick) );
                  Serial.print(joystick[0]);
                  Serial.print(joystick[1]);
                  //parse the string up and store into variables
                 startButton = joystick[1]; //load the 1 spot from the array
                        if (startButton == 0)
                         {
                           Serial.println("start button is 0");
                         myservo.write(90);
                         delay(20);
                         }
                         else
                         {
                           myservo.write(45);
                           delay(20);
                         }
     
         //       }

  }

           
}
}



}/

It is unfortunately quite common for Arduino libraries to clash with each other and that may be what is happening.

You could try using the ServoTimer2 library. I got my copy here.

...R

Thanks Robin. I hadnt heard of that before, shows my ignorance. Ill give that a run.

no dice with the new servo library. still the same hum - what it is is the servo pegging all the way, as soon as the arduino board is plugged in. I tried two different arduino boards. im quite loss - my naive guess is that the NRF modules are creating some interference?

If possible, get your project working first using wires instead of rf, then add the rf. Don't attempt to power the servo from the arduino. The arduino loops pretty fast, so you may be overflowing the data buffers.

bkochuba:
no dice with the new servo library. still the same hum

Have you tried a short program with only the servo involved (with either servo library) and does the servo work properly?

Have you tried a short program with only the NRF modules to check that the Arduino (that normaly have the servo) is receiving sensible numbers?

...R

Yes, I do have two programs that run - one with a pushbutton and also have an XBEE version. I am trying to move from the XBEE to the NRF to save (substantial) cost.

bkochuba:
Yes, I do have two programs that run - one with a pushbutton and also have an XBEE version. I am trying to move from the XBEE to the NRF to save (substantial) cost.

I think this means that your servos work properly with push buttons and when you use an XBEE for communication. Can you confirm?

Have you figured out how to use the NRFs for communications without any servo code?

...R

Correct - i have the servos working with both wired pushbuttons and a separate wireless XBEE implementation.

I have the NRF sketch sending information back and forth, and I can see the receiver serial print out the button input from the transmitter.

The servo doesnt seem to acknowledge the code whatsoever. If you notice in the code i have a write() in the setup and the servo wont even do that.

OK. I have run out of bright ideas. I don't have an NRF device so I can't do any testing.

Have you a reliable source explaining what is needed to work with an NRF. From a little Googling there seem to be other libraries used in some cases and I've seen a case where it did not use both the nRF24L01 and RF24.

...R