# Wireless data exchange between two arduinos using NRF24L01

**URL:** <https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278>\
**Category:** Programming\
**Created:** [January 26, 2025, 9:10pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278 "2025-01-26T21:10:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 26, 2025, 9:10pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/1 "2025-01-26T21:10:30Z")

</div>

Good luck guys. I have an Arduino project that I use. It includes sensors (voltage/temperature and fan control) and LCD Keypad Shield. I want to add NRF24L01 to my project to be able to transfer data wirelessly without changing the original code and without experiencing pin conflicts. The Arduino that the sensors I am currently using are connected to will be the master and transmitter. Apart from the receiver, I want to see the values ​​coming from the transmitter on the LCD keypad shield screen with an Arduino. I would be very happy if you could help me. I am sharing the original code with you. I have two Arduino Uno, two LCD keypad shields and two NRF24L01 modules.

```arduino
// PA-Monitor-SG-Lab-2GHz4-V2.ino ---------- c 2020 by DC5ZM -------------------------------------------------------
//
// PCB for UNO and NANO are available by weber.r1@t-online.de
//
// ---------------------------------------------- include libraries --------------------------------------------------
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// ---------------------------------------------- define constants ---------------------------------------------------
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //allocate uno pins to LCD diplay pins(rs,enable,DB4,DB5,DB6,DB7)

#define ONE_WIRE_BUS 12 // Data wire is plugged into pin 12 on the Arduino
#define TEMPERATURE_PRECISION 13
#define FAN_PIN 11
#define NO 0
#define YES 1

// **************************************************************variables to be changed for calibration*********
// use http://www.xuru.org/rt/PR.asp#CopyPaste for calculation coefficients * *
// formula used: y = a +b*x + c*x*x *
// *
float a_drv = -0.087, b_drv = 13.615, c_drv = 61.081; // coefficients of polygon approximation DRV *
float a_fwd = 0.491, b_fwd = -1.099, c_fwd = 1.661; // ... FWD *
float a_ref = 0.491, b_ref = -1.099, c_ref = 1.661; // ... REF *
float scc_drv = 1.0, scc_fwd = 1.0, scc_ref = 1.0; // Shift_Calibration_Curve 0.93=7%> 1.07=7%< *
float power_drv_min = 1; // minimal power for calculation and display *
byte power_fwd_min = 1, power_ref_min = 1, power_drv_max = 50; // min. power for calc. and display *
byte temp_fan_on = 45, voltmeter_full_scale = 30; // fan on at overtemperature, adjust att. R1 *
// ****************************************************************************************************************

unsigned long time;
uint16_t temp_integer; // uint16_t = 16 bit integer

char temp_string[8], power_fwd_string[8], power_ref_string[8], power_drv_string[8], swr_string[8];
char pa_voltage_string[8], temp_fan_on_string[8];

float reflexion_coefficient, swr, power_fwd, power_ref, power_drv, voltage_fwd, voltage_ref, voltage_drv;
float voltage_fwd_peak = 0, voltage_ref_peak = 0, voltage_drv_peak = 0;
float temperature, tmp_old = 0, pa_voltage;

byte temp_byte, temp_bar_max = 100, power_drv_int, iii = 0;
byte menu = 1, temp_fan_on_marker;
boolean fwd_too_low = NO, ref_too_low = NO, fan_active = NO, error_fwd = NO, error_ref = NO, error_swr = NO;

OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire); // Pass oneWire reference to Dallas Temperature

// ###################################################################################################################
void setup(void) {
  lcd.begin(16, 2); // display with 16 colum and 2 lines
  sensors.begin(); // Start up the library
  pinMode(FAN_PIN, OUTPUT);

  read_temperature();
  lcd.print("PA M O N I T O R");
  lcd.setCursor(0, 1); // colum, line nr.
  delay(500);
  lcd.print("TR 2024 ");
  delay(500);
  lcd.print("by ");
  delay(500);
  lcd.print("TA4DC");
  delay(1500);
  lcd.clear();
}
// ###################################################################################################################
void loop(void) {
  select_menu();
  read_temperature();
}
// ###################################################################################################################
void select_menu() {
  if (analogRead(A0) < 1000) menu++; // if any of 5 keys pressed change menu
  while (analogRead(A0) < 1000)
    ; // wait for key released
  if (menu > 3) menu = 1;
  if (menu == 1) menu_directional_couplers();
  if (menu == 2) menu_temperature();
  if (menu == 3) menu_supply_fan();
}
// -------------------------------------------------------------------------------------------------------------------
void menu_directional_couplers() {
  for (iii = 0; iii < 20; iii++) // Take 20 samples and save the highest value
  {
    voltage_fwd = analogRead(A1);
    voltage_ref = analogRead(A2);
    voltage_drv = analogRead(A3);
    if (voltage_fwd > voltage_fwd_peak) voltage_fwd_peak = voltage_fwd; // safe the peak of 10 measurements
    if (voltage_ref > voltage_ref_peak) voltage_ref_peak = voltage_ref;
    if (voltage_drv > voltage_drv_peak) voltage_drv_peak = voltage_drv;
  }
  voltage_fwd = voltage_fwd_peak; // use peak voltage for processing
  voltage_ref = voltage_ref_peak;
  voltage_drv = voltage_drv_peak;
  // ---------------------------------------- calculate coupler values -------------------------------------------------
  voltage_fwd = voltage_fwd * 5 / 1023 * scc_fwd; // normalize measured value FWD to 5V x scc_fwd
  voltage_ref = voltage_ref * 5 / 1023 * scc_ref; // ... REF to 5V x scc_ref
  voltage_drv = voltage_drv * 5 / 1023 * scc_drv; //... DRV to 5V x scc_drv

  power_fwd = a_fwd + b_fwd * voltage_fwd + c_fwd * voltage_fwd * voltage_fwd; // polygon approximatiion equation fwd
  if (power_fwd < 0) power_fwd = 0; // avoid negativ values

  power_ref = a_ref + b_ref * voltage_ref + c_ref * voltage_ref * voltage_ref; // polygon approximatiion equation ref
  if (power_ref < 0) power_ref = 0;

  power_drv = a_drv + b_drv * voltage_drv + c_drv * voltage_drv * voltage_drv; // polygon approximatiion equation drv
  if (power_drv < 0) power_drv = 0;

  if (power_fwd < power_fwd_min) error_fwd = YES; // check for errors
  else error_fwd = NO;
  if (power_ref < power_ref_min) error_ref = YES;
  else error_ref = NO;
  if ((power_fwd <= power_ref) || (error_fwd == YES) || (error_ref == YES)) error_swr = YES;
  else error_swr = NO;

  display_coupler_values();
  voltage_fwd_peak = 0; // set peak voltages back to 0
  voltage_ref_peak = 0;
  voltage_drv_peak = 0;
}
// -------------------------------------------------------------------------------------------------------------------
void display_coupler_values() {
  lcd.setCursor(0, 0);
  lcd.print("FWD W REF W");

  lcd.setCursor(4, 0);
  if (error_fwd == NO) {
    dtostrf(power_fwd, 2, 0, power_fwd_string); // variable for converting float type numbers
    lcd.print(power_fwd_string);
  } else {
    lcd.print("<");
    lcd.print(power_fwd_min);
  }

  lcd.setCursor(13, 0);
  if (error_ref == NO) {
    dtostrf(power_ref, 2, 0, power_ref_string); // variable for converting float type numbers
    lcd.print(power_ref_string);
  } else {
    lcd.print("<");
    lcd.print(power_ref_min);
  }

  // .................................................... line 2 of lcd display ......................................
  lcd.setCursor(0, 1);
  lcd.print("DRV mW SWR ");

  lcd.setCursor(4, 1);
  if ((power_drv < power_drv_max) && (power_drv >= power_drv_min)) {
    dtostrf(power_drv, 2, 0, power_drv_string); // variable for converting float type numbers
    lcd.print(power_drv_string);
    lcd.setCursor(2, 1);
    lcd.print("V");
  }

  if (power_drv < power_drv_min) {
    lcd.setCursor(5, 1);
    lcd.print(power_drv_min);
    lcd.setCursor(4, 1);
    lcd.print("<");
    lcd.setCursor(6, 1);
    lcd.print("mW ");
  }

  if (power_drv >= power_drv_max) {
    lcd.setCursor(4, 1);
    lcd.print(power_drv_max);
    lcd.setCursor(3, 1);
    lcd.print(">");
  }

  if (error_swr == NO) {
    lcd.setCursor(13, 1);
    {
      reflexion_coefficient = sqrt(power_ref / power_fwd); // calculate SWR
      if (reflexion_coefficient <= 0.8) {
        swr = (1 + reflexion_coefficient) / (1 - reflexion_coefficient);
        dtostrf(swr, 2, 1, swr_string);
        lcd.print(swr_string); // display SWR
      } else lcd.print(">10"); // SWR too high
    }
  } else // display PA temperature
  {
    dtostrf(temperature, 2, 0, temp_string);
    lcd.setCursor(9, 1);
    lcd.print("TMP \xDF");
    lcd.setCursor(13, 1);
    lcd.print(temp_string);
    if (fan_active == YES) {
      lcd.setCursor(15, 1);
      delay(150);
      lcd.print(" ");
      delay(150);
    }
  }
  delay(200);
}
// -------------------------------------------------------------------------------------------------------------------
void menu_temperature() {
  dtostrf(temperature, 4, 1, temp_string); // variable for converting float type numbers
  lcd.setCursor(0, 0); // colum, line nr.
  lcd.print("PA TEMP.: ");
  lcd.print(temp_string);
  lcd.print("\xDF"); // character sign °
  lcd.print("C");

  // .................................................... line 2 of lcd display ......................................
  lcd.setCursor(0, 1);
  lcd.print("0 ____________ 100");
  lcd.setCursor(1, 1);
  if (temperature < 0) temperature = 0;
  if (temperature > 100) temperature = 100;
  temp_byte = temperature;

  temp_byte /= 7.14; // 0 to 100 normalized to0 bis 14
  for (iii = 0; iii <= temp_byte; iii++) lcd.print("\xFF"); // \xFF = special character black rectangle

  if (fan_active == YES) {
    lcd.setCursor(14, 0);
    delay(150);
    lcd.print(" ");
    delay(150);
  }
  delay(250); // delay prevents flickering of the display
}
// -------------------------------------------------------------------------------------------------------------------
void menu_supply_fan()

{
  pa_voltage = 0;
  for (iii = 0; iii < 10; iii++)
    pa_voltage = pa_voltage + analogRead(A4);
  pa_voltage /= 9; // average of 10 measurements

  pa_voltage = pa_voltage * voltmeter_full_scale / 1023; // adjust R1 when changing voltmeter_full_scale

  lcd.setCursor(0, 0);
  lcd.print("PWR SUPPLY V");
  lcd.setCursor(11, 0);
  dtostrf(pa_voltage, 3, 1, pa_voltage_string); // variable for converting float type numbers

  lcd.print(pa_voltage_string);

  // .......................................... line 2 of lcd display ................................................

  lcd.setCursor(0, 1);
  lcd.print("FAN ON TMP >");

  dtostrf(temp_fan_on, 2, 0, temp_fan_on_string); // variable for converting float type numbers to strings
  lcd.print(temp_fan_on_string);

  lcd.print("\xDF");
  lcd.print("C");

  if (fan_active == YES) {
    lcd.setCursor(4, 1);
    delay(300);
    lcd.print(" ");
    delay(300);
  } // flash word "ON"
}
// -------------------------------------------------------------------------------------------------------------------
void read_temperature() {
  if ((millis() - time) > 5000) // The sensor is only read out every 5s
  {
    sensors.requestTemperatures(); // because the process takes 750ms
    temperature = sensors.getTempCByIndex(0); // in high resolution mode.
    time = millis();
  }

  if (temperature >= temp_fan_on) {
    digitalWrite(FAN_PIN, HIGH);
    fan_active = YES;
  } else {
    digitalWrite(FAN_PIN, LOW);
    fan_active = NO;
  }
}
// 

```

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [January 26, 2025, 11:01pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/2 "2025-01-26T23:01:02Z")

</div>

So do you have a question?  
Have you worked through the examples in the [RF24 Library](https://github.com/nRF24/RF24/tree/master) or perhaps the [Robin2 Tutorial](https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123)?

---

<div class="post-metadata">

**Author:** ![JCA34F](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jca34f/32/340148_2.png) [@JCA34F](https://forum.arduino.cc/u/JCA34F)\
**Post date:** [January 27, 2025, 1:23am UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/3 "2025-01-27T01:23:15Z")

</div>

> [@escapeebay](#):
>
> I am sharing the original code

Could you share the wiring diagram?

---

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 27, 2025, 12:05pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/4 "2025-01-27T12:05:36Z")

</div>

I want to add NRF24L01 to this code and have it transfer data wirelessly to another Arduino. In other words, I want to see the information on the LCD screen that works with the original code I shared wirelessly on another Arduino screen. The sensors will be connected to the main Arduino. But I will see the information on both the main Arduino and the other Arduino screen wirelessly.

---

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 27, 2025, 12:08pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/5 "2025-01-27T12:08:52Z")

</div>

![Fig-4-v2-768x204](https://europe1.discourse-cdn.com/arduino/original/4X/3/8/d/38d41428e553ee168ab2de65a3caeb68b693ded8.jpeg)  
 ![Fig-5-v2-768x519](https://europe1.discourse-cdn.com/arduino/original/4X/1/8/f/18fdac1c5a417da602270e561348711017a24176.jpeg)  
 ![Fig-6-a-b-v2-1024x513](https://europe1.discourse-cdn.com/arduino/original/4X/d/6/b/d6bef98f884334c2bfa37fed13522b2001c1d61d.jpeg)

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [January 27, 2025, 12:09pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/6 "2025-01-27T12:09:05Z")

</div>

> [@escapeebay](#):
>
> I want to add NRF24L01 to this code and have it transfer data wirelessly to another Arduino.

That's what you said in your first post. Did you do this?

> [@gfvalvo](#):
>
> Have you worked through the examples in the [RF24 Library](https://github.com/nRF24/RF24/tree/master) or perhaps the [Robin2 Tutorial](https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123)?

---

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 27, 2025, 12:09pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/7 "2025-01-27T12:09:29Z")

</div>

![Fig-7-a-v2-768x545](https://europe1.discourse-cdn.com/arduino/original/4X/4/0/9/409477b309b2d6b6c9856998ca6e12466a599941.jpeg)  
 ![Fig-7-b-v2-768x769](https://europe1.discourse-cdn.com/arduino/original/4X/2/a/b/2aba03ccabf25270fae3a19e8c1f14ebca9e12de.jpeg)

---

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 27, 2025, 12:14pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/8 "2025-01-27T12:14:01Z")

</div>

I couldn't do it. I don't have any knowledge about coding. I need help. I want to add to the original code and use it as a transmitter. and I want to run another orduino with a receiver code.

---

<div class="post-metadata">

**Author:** ![escapeebay](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/escapeebay/32/1187606_2.png) [@escapeebay](https://forum.arduino.cc/u/escapeebay)\
**Post date:** [January 27, 2025, 12:16pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/9 "2025-01-27T12:16:33Z")

</div>

Can I transfer the information in this project wirelessly to another Arduino screen?

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [January 27, 2025, 12:19pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/10 "2025-01-27T12:19:46Z")

</div>

> [@escapeebay](#):
>
> I couldn't do it. I don't have any knowledge about coding.

That's why there's example code. Follow [Robin2's Tutorial](https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123?_gl=1*1njy22q*_up*MQ..*_ga*Njc1OTY0NzU0LjE3Mzc5ODAxODc.*_ga_NEXN8H46L5*MTczNzk4MDE4Ni4xLjAuMTczNzk4MDE4Ni4wLjAuNDY3Nzc2Njcz).

> [@escapeebay](#):
>
> I want to add to the original code and use it as a transmitter.

First, use the tutorial and example code to learn how to do a simple data transfer. Then, incorporate that into your existing code. Folks on the forum will help you, but not do it for you. You must put in the effort.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 26, 2025, 12:20pm UTC](https://forum.arduino.cc/t/wireless-data-exchange-between-two-arduinos-using-nrf24l01/1347278/11 "2025-07-26T12:20:12Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
