nRF24L01+ Communication between 2 arduinos

Hi everyone, I'm Jonathan and this is my very first post in the forum.

I'm currently building a home project on which I can monitor temperature sensor data between 2 arduinos over a nRF24L01+ wireless communication set. As soon as this communication is properly working, it will be sent to a RPI runing Node-Red + InfluxDB + Grafana to visualize the data over the serial port, which btw is already working fine. Everything that is RPI-related is out of the scope of my request, but would be more than happy to share it if requested.

My setup is as follows:

Transmitter:

  • Arduino Pro Mini
  • nRF24L01+ module with a 3.3v regulator
  • MAX6675 K-Thermocouple sensor

Receiver:

  • Arduino UNO
  • nRF24L01+

Challenges:

  1. I have read on different forums about creating a data bus for the MISO/MOSI communications, so I made it as it is shown on the diagram attached.
  2. Also read that I could use a different pin on Pro Mino for CS for the MAX6675, so I set it up on pin 7

Request for assistance:

  1. Can you help me confirm if my connections are correct? If not, what changes should I make?
  2. No information is being received on the UNO, as I am monitoring the serial port for debuging the received data

I'm attaching the diagram and codes for both boards.

Your help is truly appreciated.

Regards!

Transmitter code:

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

MAX6675 ktc(6, 7, 12); // Create a Module (CLK, CS, SO)
RF24 radio(9, 10); // Create a Radio (CE, CSN)

const byte address[6] = "00001";

void setup(){

  Serial.begin(9600);
  delay(500);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
  
}

void loop() {

  double jobTemp = ktc.readFahrenheit();
  Serial.println(jobTemp);
  // char text[] = "Hello World"; //double T1 = ktc.readCelsius();
  //Serial.println(text);
  //radio.write(&text, sizeof(text)); //radio.write(&T1, sizeof(T1));
  radio.write(&jobTemp, sizeof(jobTemp));
  delay(2000);
  
}

Receiver code:

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

RF24 radio(9, 10); // Create a Radio (CE, CSN)

const byte address[6] = "00001";
int tempF;

void setup(){

  Serial.begin(9600);
  delay(500);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
  
}

void loop() {
  //tempF = "";
  radio.read(tempF, sizeof(tempF));
  Serial.println(tempF);
  delay(200);
  
}

I've noy been running the RF24 stuff.

However I wonder about the different ways You use radio.write and radio.read. radio.write uses a pointer to the variable but radio.read uses the variable directly. Is that the way it should be?

Also, jobTemp is declared as "double" but in reality You get a float variable as I have understood. The sizeOf- function ought to return an integer…… Looks difficult to me.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

...R

Fritzing are not regarded as diagrams.

Your Tx does not show any 3v3 adaptor for the NRF24 unit, and so "diagram" is incorrect and will blow the module as shown.

The receiver run on voltage from the Arduino may well work but if you persist using this method, it will be the source of a problem sometime in the future.
Use the adaptors, that's what they are designed for.