Nordic Fob +nRF24L01 module help!

I am currently working on a wireless controlled outlet box using arduino and the relay board kit available at sparkfun.

Hardware being used: Arduino Uno, Nordic Fob, nRF24l01 transceiver from spark fun model WRL-00691

I am trying to use the sample code found in this forum post here

http://www.arduino.cc/cgi-bin/yabb2/YaB … 1245058973

When running this code I get no serial output. I have also tried several other sample codes from around the internet all using the spi, mirf, and nRF24L01 libraries. When running all these codes they seem to stop when the mirf library functions have been called. For example if i call a serial print before the mirf functions it will work, but after it will not. In all cases the code compiles fine before upload. I have setup the data payload to 4 which I understand the remote calls for as well as the channel to 2 which is also what the remote is preset for. I would like to use the preloaded setup on the nordic fob if possible to keep things simpler

If i go to the examples in the mirf library and run reg_read i do get serial output which is the following

“starting wireless…”

“rf_setup= 1111”

“wireless initialized”

Any help anyone could give would be great, I’ve had good success in the past with xbee modules however haven’t had any results/experience with the nRF24l01 module and cannot figure out what I am doing wrong.

To be more specific the code i’m attempting to use is the following

#include <Spi.h>
#include <mirf.h>
#include <nRF24L01.h>

byte data_array[4];

void setup() {
  Mirf.csnPin = 7;
  Mirf.cePin = 8;
  Mirf.init();
//  delay(50);
  byte rx_addr[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
  Mirf.setRADDR(rx_addr);
  Mirf.configRegister(RF_SETUP, 0x07); //Air data rate 1Mbit, 0dBm, Setup LNA
  Mirf.configRegister(EN_AA, 0x00); //Disable auto-acknowledge
  Mirf.payload = 4;
  Mirf.channel = 2;
  Mirf.config();
  Serial.begin(9600);
}

void loop(){
  if (Mirf.dataReady()){
    Serial.print("Data! : ");
    Mirf.getData(data_array);
    Serial.println(data_array[0],HEX);
    switch (data_array[0]) {
	case 0x1D: Serial.println("UP"); break;
	case 0x1E: Serial.println("DOWN"); break;
	case 0x17: Serial.println("LEFT"); break;
	case 0x1B: Serial.println("RIGHT"); break;
	case 0x0F: Serial.println("CENTER"); break;
	default: break;
    }
  }
}

In order to get the above code to compile i have to remove the adding of libraries as it was done in that post online and then import spi and mirf on my own, I’m wondering if this is where the issue is coming from. The code i finally get to compile is the following, but still no serial output.

#include <SPI.h>

#include <Mirf.h>
#include <MirfHardwareSpiDriver.h>
#include <MirfSpiDriver.h>
#include <nRF24L01.h>





byte data_array[4];

void setup() {
  Mirf.csnPin = 7;
  Mirf.cePin = 8;
  Mirf.init();
//  delay(50);
  byte rx_addr[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
  Mirf.setRADDR(rx_addr);
  Mirf.configRegister(RF_SETUP, 0x07); //Air data rate 1Mbit, 0dBm, Setup LNA
  Mirf.configRegister(EN_AA, 0x00); //Disable auto-acknowledge
  Mirf.payload = 4;
  Mirf.channel = 2;
  Mirf.config();
  Serial.begin(9600);
}

void loop(){
  if (Mirf.dataReady()){
    Serial.print("Data! : ");
    Mirf.getData(data_array);
    Serial.println(data_array[0],HEX);
    switch (data_array[0]) {
   case 0x1D: Serial.println("UP"); break;
   case 0x1E: Serial.println("DOWN"); break;
   case 0x17: Serial.println("LEFT"); break;
   case 0x1B: Serial.println("RIGHT"); break;
   case 0x0F: Serial.println("CENTER"); break;
   default: break;
    }
  }
}

I’m thinking now that I somehow have the mirf library incorrect or the wrong library. When i add the mirf library it adds several items mirf.h mirfspidriver.h and mirfhardwarespidriver.h but others only have mirf.h in their sample code. Is it possible i have an incorrect version or that this has something to do with it?

I hope someone out there knows how to use this module, I cannot figure out out and i really want to remotely control this outlet.

Hi,

i test this code in my Arduino UNO and it hung after Mirc.init()…

#include <SPI.h>

#include <Mirf.h>
#include <MirfHardwareSpiDriver.h>
#include <MirfSpiDriver.h>
#include <nRF24L01.h>

/*
-- [Circuito] --------------------
    Hardware SPI:
      * MISO ->  Pin 12
      * MOSI ->  Pin 11
      * SCK  ->  Pin 13
     Configurable:
      * CE   ->  Pin 8
      * CSN  ->  Pin 9
----------------------------------
*/

byte wirelessDataArray[4]; // 4 = Mirf.payload
long FOBDebounceDelay = 250;
long FOBDebounceCount = millis();

int pinLEDDebug = 4;

void setup() {

  pinMode(pinLEDDebug, OUTPUT);
  digitalWrite(pinLEDDebug, HIGH);
  
  Mirf.csnPin = 9;
  Mirf.cePin = 8;
  Mirf.init();
  byte rx_addr[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
  Mirf.setRADDR(rx_addr);
  Mirf.configRegister(RF_SETUP, 0x07); //Air data rate 1Mbit, 0dBm, Setup LNA
  Mirf.configRegister(EN_AA, 0x00); //Disable auto-acknowledge
  Mirf.payload = 4;
  Mirf.channel = 2;
  Mirf.config();

  digitalWrite(pinLEDDebug, LOW);

  Serial.begin(9600);

  // Read and print RF_SETUP
  byte rf_setup = 0;
  Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );
  Serial.print( "Canal = " );
  Serial.println( Mirf.channel, DEC );
  Serial.print( "Payload = " );
  Serial.println( Mirf.payload, DEC );
  Serial.print( "rf_setup = " );
  Serial.println( rf_setup, BIN );
  Serial.println( "Wireless iniciado." );
}

void loop() {
  doCheckWireless();
}

void doCheckWireless() {
  if (Mirf.dataReady()){
    Mirf.getData(wirelessDataArray);
    if (millis() - FOBDebounceCount > FOBDebounceDelay) {
      switch (wirelessDataArray[0]) {
        case 0x1D:
            digitalWrite(pinLEDDebug, HIGH);
//          Serial.println ("ARRIBA");
          break;
        case 0x1E:
            digitalWrite(pinLEDDebug, LOW);
//          Serial.println ("ABAJO");
          break;
        case 0x17:
//          Serial.println ("IZQUIERDA");
          break;
        case 0x1B:
//          Serial.println ("DERECHA");
          break;
        case 0x0F:
//          Serial.println ("CENTRO");
          break;
        default:
          break;
      }
      FOBDebounceCount = millis();
    } else {
//      Serial.println ("Bounce Ignorado.");
    }
  }

}

I delete Serial.begin line, and don’t work too.

I need help for use of this item nRF24L01

I too an having a problem with the Nordic +nRF24L01 module. I used it successfully with the Arduino Duemilanove but with the new Uno it hangs right at the “Mirf.init();” command, telling me it is not initializing. I am also using the code and the same Mirf.h library.

Anyone successfully use this module with the Uno?

I just got a nrf24L01+ link up and running, using the libraires here:

http://www.arduino.cc/playground/Interf … e/Nrf24L01

I put the client and server example program into two Arduino Duemilove’s and I am running mdfly Nordic boards, they are $7 but no 3.3V reg. so I use the FDTI 3.3V output. The ping test runs for me- I would start here to make sure there are no hardware problems.

Hi,

I also have problems with nFR24L01 and Arduino Mega.

I have 2 Arduino Mega communicating to each other.

With the “old” Spi and Mirf library everything is going fine, but I have problems with the SPI in arduino 22 with the latest Mirf library.

After compiling and running there is no communication.

For de SPI and Mirf in arduino 0022 , I made de following changes in my program.

//  #include <Spi.h>    exclude this
// now the newer SPI is included
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>    //  ad this 

 void setup(){
  
 Mirf.csnPin = 49;   */   this could be the problem with the new SPI / Mirf lib
  Mirf.cePin = 48;     */   this could be the problem with the new  SPI / Mirf lib

  /*
   * Set the SPI Driver.
   */
  Mirf.spi = &MirfHardwareSpi;              //  ad this
  Mirf.init();
…………………
………………..

I did a test with the pingserver and pingclient example.

This program is running fine, but when I set

Mirf.csnPin = 49;

Mirf.cePin = 48;

in the void setup(), there is also no communication again.

I can’t ignore the setting of the csnPin and the cePin in my program, when I do this the program will hang in the communication with my GSM board.

please help,

is there something I am doing wrong?

With a new test after my last post, I have a strong feeling there is something wrong in the library.

When I asign the Mirf.csnPin to an other pin (eg. 39 , what is not the csnPin of the nRF24L01) the pingserver , pingclient example is working!