NFR24L01 problem [basic]

Hi,

I’m trying to follow this instruction: http://www.elec-cafe.com/multiple-nodes-nrf24l01-wireless-temperature-ds18b20-with-arduino-uno-2-transmitter-1-receiver/

I have double checked the wiring and have replaced parts twice, but it’s not working. I have removed lcd parts because I don’t have a display.

TX code:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#include <printf.h>
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

float temp1;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
printf_begin();
sensors.begin();
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipes[1]);
radio.startListening();
radio.printDetails();
}

void loop(void)
{
sensors.requestTemperatures();
temp1 = sensors.getTempCByIndex(0);
radio.write(&temp1, sizeof(temp1));
Serial.print(temp1);
delay(10);
}

RX code:

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

float temp1, temp2;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
printf_begin();
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.openReadingPipe(2, pipes[2]);
radio.startListening();
radio.printDetails();
Serial.print("nRF24L01+ Temp");
delay(1000);
Serial.print("Connecting.....");
delay(1000);
}

void loop(void)
{
delay(500);
if ( radio.available() )
{
delay(50);
radio.read(&temp1, sizeof(temp1));
Serial.print("Temp 1");
Serial.print(temp1);
Serial.print(" C");

delay(50);
radio.read(&temp2, sizeof(temp2));
Serial.print("Temp 2");
Serial.print(temp2);
Serial.print(" C");
}
else
{
Serial.println("No radio available");
}
delay(1000);
}

Serial outputs can be seen from the attached screenshot.

Any hints?

Maybe there's good reason for this, but why in the world are you using 3 pipes? You only need one pipe shared between the modules. That should fix things IMHO.

I don't know. I assumed it was something related for the instruction's two transmitters. But I didn't figure out why three instead of two pipes. I'm only using one transmitter, at this first stage.

I edited it like this, on both codes: const uint64_t pipes[1] = { 0xF0F0F0F0E1LL };

No effect, still not working.

Edit: Tried also two pipes.

Edit2: Any hints to start debugging this? Does the radio info look normal on the serial output?

Well, it really doesn't change anything, but you shouldn't use an array to store a single value.

Just to clarify: TX Arduino and RX Arduino each have only one transceiver?

Debugging advice: Learn the basics of both how the module works and how the library works. A good hour with documentation solves a lot of problems usually. Also, use a simple sketch on each MCU just to see if you can send a single byte (i.e. Constantly send 0x8 or something). Once you can do that, then you can move on to bigger stuff like temp sensors. Also, try using a different wifi module demo.

Have a look at this Simple nRF24L01+ Tutorial.

Get one of the examples working properly and then see about adding the temperature sensor code.

Also make sure you can get the temperature sensor working properly in a simple program without any nRF24.

And please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum
…R

Thanks, I will read the manual.

Temperature sensors are working well, got the readings correctly at the first place.

Now it works. I replaced the chinese Uno with genuine Uno. Is this chinese Uno broken or is there some antipiracy protection which detects non-genuine board?

Board info shows:

Genuine: BN: Arduino/Genuino Uno VID: 2341 PID: 0043 SN: xxxxx32343430xxxxxxx

Chinese: BN: Unknown board VID: 1A86 PID: 7523 SN: Upload any sketch to obtain it

Didn't work with chinese Nano 3 either.

If you are powering the nRF24 from the Arduino 3.3v pin it could be that the cheap versions don't provide enough current.

But you are telling us very little about your system.

...R

Yes, that could be it. I will try to power nrf24 from different power source or adding the capacitor.

Very little? :) What would you like to know? Did you check the web page I linked in the first post, which shows the wiring etc? :)

ECE9: Did you check the web page I linked in the first post, which shows the wiring etc? :)

No.

I will look at stuff on this Forum.

And as far as I can tell that is a link about how someone else claims to have done something - not information taken directly from YOUR project.

...R

Mm, okay..

Hey, I just looked at the website you liked to and I see it has 3 Arduinos in the project, but you only posted code for two? What happened to the third’s code? Maybe this is why your project wasn’t working properly (in addition to your Chinese clone board).