wireless sensor network problems

Hello i am trying to send data from a proximity sensor connected to an Arduino Pro Mini via nRF24L01 to an Arduino Mega 2560 (+nRF24L01) but i keep getting connection issues , ill attach the serial debug output

Mini serial monitor output

nRF24 test mega 
STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0

RX_ADDR_P0-1	 = 0xf0f0f0f0e1 0xc2c2c2c2c2

RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6

TX_ADDR		 = 0xf0f0f0f0e1

RX_PW_P0-6	 = 0x20 0x00 0x00 0x00 0x00 0x00

EN_AA		 = 0x3f

EN_RXADDR	 = 0x03

RF_CH		 = 0x4c

RF_SETUP	 = 0x07
CONFIG		 =0x0e
DYNPD/FEATURE    =0x00 0x00
Data Rate	 =1MBPS
Model		 =nRF24L01+
CRC Lenght	 =16 bits
PA Power	 =PA_HIGH
1
1
1
1

Mega serial output

 nRF24 test mega 
STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xf0f0f0f0e1

RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6

TX_ADDR		 = 0xe7e7e7e7e7

RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00

EN_AA		 = 0x3f

EN_RXADDR	 = 0x03
RF_CH		 = 0x4c

RF_SETUP	 = 0x07
CONFIG		 = 0x0c

DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 1MBPS

Model		 = nRF24L01+

CRC Length	 = 16 bits

PA Power	 = PA_HIGH
NO RADIO!
NO RADIO!

the codes used are written by me using rf24 library (thanks maniacbug)
Mega (reciever)

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

//Reteaua folosita
RF24 radio(49,53);

//adresele folosite
const uint64_t pipes[3] = {0xF0F0F0F0E1LL,0xF0F0F0F0D2LL , 0xF0F0F0F0C3LL};
int *proxi_state;

void setup(void)
  {
    Serial.begin(57600);
    printf_begin();
    printf("\n nRF24 test mega \n");
    radio.begin();
    radio.setRetries(15,15);
    radio.openReadingPipe(1,pipes[0]);//asculta nodul 1
 //   radio.openReadingPipe(2,pipes[1]);// asculta nodul 2
 //   radio.openReadingPipe(3,pipes[2]);// asculta nodul 3
 //   radio.startListening();
    radio.printDetails();
    
  }
void loop(void)
  {
    if ( radio.available() )
      {
         bool ok = false;
         while (!ok)
          {
            bool ok=radio.read(proxi_state,sizeof(proxi_state));
            Serial.println(*proxi_state);
          }
      }
     else 
     {
       Serial.println("NO RADIO!");
       delay(5000);
     }  
   }

and code for Mini Pro

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#define PROXI 7

//Reteaua folosita
RF24 radio(10,9);

//adresele folosite
const uint64_t pipes[1] = {0xF0F0F0F0E1LL};
int *proxi_state;

void setup(void)
  {
    Serial.begin(57600);
    printf_begin();
    printf("\n nRF24 test mega \n");
    radio.begin();
    radio.setRetries(15,15);
    radio.openWritingPipe(pipes[0]);
    radio.printDetails();
  }
void loop(void)
  {
    *proxi_state=digitalRead(PROXI);
    radio.write(proxi_state,sizeof(proxi_state));
    Serial.println(*proxi_state);
  }

Please help me solve this :slight_smile:

Hi Andrey

Can you post a diagram of how each of the RF modules is connected to the Arduinos?

Thanks

Ray

well for the sensor part i've got the nrf connected to pro mini with pins : CE=10,CSN=9,SCK=13,MOSI=11 and MISO=12. The sensor has a one wire connection connected on the pin 7 on the mini. All this is powered by a self made power source that reduces the 12v from input to 5v(arduino,sensor) and 3.3v (nRF). For the mega i'm using CE=49, CSN=53,SCK=53,MISO=50,MOSI=51. From what i can tell from the serial output , the hardware connections are good/fine. p.s. i've soldered 2 100nf caps on the 3.3v of the mega for filtering purposes.. p.s. 2 i want to recieve only on the mega , and just send on the pro mini Thanks

changed the power supply on the sending node , still no radio on the serial output . Then i changed the code on the sending node (on the pro mini) so that csn= pin 10 (ss pin) , still noting .. i'm beggining to run out of ideas , if some1 could give me some feedback or something new to try i would be very gratefull .. Thanks.

Hi Andrey

Could you swap the two nRF modules over between the Mini and the Mega? If the "no radio" message moves to the other Arduino, maybe it means one of the modules is faulty?

Regards

Ray

isn't the no radio error related to the fact that the arduino cannot connect to the network? if i have 1 faulty module then i can't really tell anything if i swapt them , i will try and reply .. thanks Ray

switched the nrf's out , same story ... could i code related? i dont seem to make any progress , i mean if the module would be faulty would the pipe addresses show correctly? Thanks

switched the nrf's out , same story

So the "no radio" message is still on the Mega?

If so, it could be ...

Problem with the code - try swapping the transmit and receive code, adjusting pin number definitions. Problem with the wiring connecting Mega to module - I'm sure you have double checked already. Problem with the Mega itself - unlikely?

Another thing to try is adding a call to radio.available() straight after radio.begin(). Does this show any different result?

And I just spotted this in an earlier post. I'm assuming the two 53s are a typo?

CE=49, CSN=53,SCK=53,MISO=50,MOSI=51

yes ,it's a typo . i just got them to comunicate with a code from here http://forum.arduino.cc/index.php?topic=224418.0 .. i think the problem was that i had no radio.powerUp(); .. i will try to add that to my code. Thanks for help Ray :D

That's great, Andrey. And thanks for tracking down that other thread - I have bookmarked it for reference.