Pages: 1 ... 8 9 [10] 11 12 ... 17   Go Down
Author Topic: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver  (Read 96875 times)
0 Members and 2 Guests are viewing this topic.
Kuala Lumpur, Malaysia
Offline Offline
Full Member
***
Karma: 4
Posts: 200
Anything is possible
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much for your help. Hopefully I didn't have to go through all these steps because the problem has been partially fixed.

As I was looking at the outputs on the Serial Monitor of the two Arduinos, I figured out that there should be a problem with one of the two Arduinos, receiving data but not sending. As you can see in the screenshot of my previous post, the Arduino on the right sends responses but the Arduino on the left isn't receiving anything.

So, I disconnected the RF module from the protoboard and connected it to the Arduino through male-to-female wires. Below you can see the result after doing so:

The only problem I found, and is shown in the screenshot above, is that every module has to be at least one time in transmission mode before it can listen to the other. So, if I power an Arduino through external power the two modules will never start to communicate with each other. The same happens if for a reason there is a power-off to one of them.


Yes, did I mention that I usually put a few of my arduino + nRF on 16x2 LCD (pics on my blog) so I do not even connect them to PC/Serial Monitor... and I change the code to force one of them to RX mode and auto-reply back to sender...

Just put two lines, radio.stoplistening() and radio.startlistening() to enable TX mode then back to RX mode..

You are very near to solving yr radio issues..... haha...
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are very near to solving yr radio issues..... haha...

Jeez, Stanley, are you getting up early or going to bed late?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the network code working perfectly using DS18B20 temp sensors on a pair of Megas, and am now trying to get a Due working.
Lots of compile errors using 1.5.2
fixed all the errors related to printf_p and PSTR, but there seem to be lots of issues with SPI
Any thoughts on the move to the Due?
Logged

Kuala Lumpur, Malaysia
Offline Offline
Full Member
***
Karma: 4
Posts: 200
Anything is possible
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are very near to solving yr radio issues..... haha...
Jeez, Stanley, are you getting up early or going to bed late?
Nick...
I woke up early after falling asleep last night at 10pm!!!!
Logged

Kuala Lumpur, Malaysia
Offline Offline
Full Member
***
Karma: 4
Posts: 200
Anything is possible
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the network code working perfectly using DS18B20 temp sensors on a pair of Megas, and am now trying to get a Due working.
Lots of compile errors using 1.5.2
fixed all the errors related to printf_p and PSTR, but there seem to be lots of issues with SPI
Any thoughts on the move to the Due?

Pls look at :-
https://github.com/gnulnulf/RF24/network

Pls fork the latest version and work on the lib for the Due.... once it is stable, we can merge it back to the main libs..

We had a GPIO working version for RPi (also ARM) and we are porting to a h/w version directly from the bcm2835 Soc...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the solution, and it can likely be fixed in RF24.h.

1) added the following to the start of RF24.cpp:
#define _BV(bit) (1 << (bit))
#define PSTR(x) (x)
#define PRIPSTR "%s"
#define PROGMEM
#define printf_P printf
#define strlen_P strlen

They are conditional in RF24.h, but I'm not sure the right way to fix it for the DUE

in RF24.cpp changed:
  SPI.setClockDivider(SPI_CLOCK_DIV4);
to:
  SPI.setClockDivider(21);

I also changed a couple of lines in  that used "%S" in a printf() to use "%s"

That, combined with a little payload structure alignment to account for 32-bit vs. 16-bit ints, and everything works for me.

I now have my Megas chatting with my Due.

Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This looks pretty heavy....

Has this been brought about in order to use the Due?

Actually, I don't even understand the function of the *.cpp file, or why there are several files in the library folder.. 
Logged

Kuala Lumpur, Malaysia
Offline Offline
Full Member
***
Karma: 4
Posts: 200
Anything is possible
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the solution, and it can likely be fixed in RF24.h.

1) added the following to the start of RF24.cpp:
#define _BV(bit) (1 << (bit))
#define PSTR(x) (x)
#define PRIPSTR "%s"
#define PROGMEM
#define printf_P printf
#define strlen_P strlen

They are conditional in RF24.h, but I'm not sure the right way to fix it for the DUE

in RF24.cpp changed:
  SPI.setClockDivider(SPI_CLOCK_DIV4);
to:
  SPI.setClockDivider(21);

I also changed a couple of lines in  that used "%S" in a printf() to use "%s"

I now have my Megas chatting with my Due.

Good stuff!!!

You can use the #ifdef DUE ( or whatever the keyword for DUE ) #endif
so the compiler will add those statement in become compiling it for the DUE...

If it is working for the DUE, could you take the latest github RF24 fork and add in these changes so that in the future, the RF24 will have support for the DUE... ( or If you send me the codes, I could git push it for you but I do not have a DUE to test if it is working or not...)

Just curious, why did you use the DUE or MEGA instead of the regular UNO.. I was aware the DUE is very fast/32-bit if you need to do some high speed processing on it..




Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, I'll do the research, and set it up with the right ifdefs.

I chose the DUE, because I'm going to use a 7-inch tft touch display. I'm using it as a master to control and monitor other units that manage aquariums, brewing fermentation, and some other things. Those basic units are simple, with temp sensors and relay controls. I was running out of room on my Mega that has been doing the job, and just added RF24 communications to already existing XBee communications. I'm also adding some very simple temperature monitoring only units.

So far, I have xBee, RF24, ds18b20 temp sensors, Ethernet, relays, and a simple display working.

Waiting for the new tft display and w5200 based Ethernet to arrive.
Logged

UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys.

I have two problems/questions
I have been playing with the nRF24L01 units for awhile now , and I have most of the examples working but I get a compile error when trying to verify the code . the code im trying tomake work is the sensornet pde. but i keep getting eeprom_update_block not declared. I have redone the file paths and and redownloaded the code but i get the same error over and over, and all the other examples work so that would tel me that the file path is fine.

im using 2x UNOs and IDE1.0.1
any ideas to fix this would be great.

the other problem i have is more on of advice needed. i want to use these units as maniacbug did for the sensor net but i want to send GPS data ,voltage and tempreture and date. which example would be best to start with and what would you suggest to use to send this data ?

Did you ever get to the bottom of your issue with "eeprom_update_block" as I'm also getting the same error
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there, quite new with Arduino-nrf24. I was trying scanner.pde of maniacbug libs example. When I run in serial, and the scipt is scanning the channel freqs, I got for instance:
zeros...12102101120101..zeros.
Can anyone give me a shot about the meaning of those outputs?
I found easier to understand Greg's output
055 (2455Mhz): 05 - *****
but I dont know how to implement it. Any help?
Cheers,
ReneX
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

While trying the "GettingStarted" example, I found the following bug:
Code:
 //if ( role == role_ping_out )
  {
    //radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  //else
  {
    //radio.openWritingPipe(pipes[1]);
    //radio.openReadingPipe(1,pipes[0]);
  }

It should be like this (at a minimum):
Code:
 //if ( role == role_ping_out )
  {
    //radio.openWritingPipe(pipes[0]);
    //radio.openReadingPipe(1,pipes[1]);
  }
  //else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }

This change makes sure the program is initialized in receiver mode, which is the default.

Hope it helps someone!

-James Nugen
« Last Edit: April 09, 2013, 03:47:09 am by jnugen » Logged

Kuala Lumpur, Malaysia
Offline Offline
Full Member
***
Karma: 4
Posts: 200
Anything is possible
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I got the attiny85 with nRF24L01 running on mirf85/spi85 library compatible with RF24 library...  smiley smiley

Pls see the link below :-
http://arduino.cc/forum/index.php/topic,115822.msg1194156.html#msg1194156

I've also compile & uploaded all the mentioned files in github repo at :-
https://github.com/stanleyseow/attiny-nRF24L01

Logged

UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been trying to work this out for a while, but need help.

I'm using the sensornet example, but I'm trying to write the data from sensors into a variable.

I guess I'm correct in thinking this is the code that write the data via serial

Code:
RF24NetworkHeader header;
    S_message message;
    network.read(header,&message,sizeof(message));
    printf_P(PSTR("%lu: APP Received #%u %s from 0%o\n\r"),millis(),header.id,message.toString(),header.from_node);

Can someone breakdown whats going on above so I can work out whats going on??

What I'd like to do is import the data into two arrays, "temp_read" and "voltage"
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The only problem I found, and is shown in the screenshot above, is that every module has to be at least one time in transmission mode before it can listen to the other. So, if I power an Arduino through external power the two modules will never start to communicate with each other. The same happens if for a reason there is a power-off to one of them.


Maybe I'll have to change the code so that the module enters the transmission mode for a while, when it powers up, and then return and remain to receive mode.

I had the same problem.  I fixed it by adding the following two lines right after the first instance of:
  //
  // Start listening
  //
    radio.startListening();  <----FIND THIS LINE, somewhere around line 109


      radio.openWritingPipe(pipes[1]);  <---ADD THESE TWO LINES AFTERWARDS
      radio.openReadingPipe(1,pipes[0]);
Logged

Pages: 1 ... 8 9 [10] 11 12 ... 17   Go Up
Jump to: