Connecting LCD Shield and nrf24l01+ transmitter on Arduino UNO

In my current setup I have two Arduino UNO boards that I want to interact via nrf24l01+ transmitters. On the "transmitter node" I have an LCD display shield connected onto the arduino with an nrf24l01+ module (connected to pin 2,3,13,11,12), while on the "receiver node" I have an active buzzer and another nrf24l01+ module (7,8,13,11,12). Here is some test code below that I am using:

transmitter node:

#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>
#include <LiquidCrystal.h>

RF24 radio(2,3);
LiquidCrystal lcd(8,9,4,5,6,7);
RF24Network network(radio);
const uint16_t this_node = 01;
const uint16_t other_node = 00;
const unsigned long interval = 5000; 

unsigned long last_sent;

struct payload_t {
  char message[20];
};

void setup() {
  Serial.begin(115200);
  lcd.begin(16, 2);
  radio.begin();
  radio.setChannel(90);
  network.begin(this_node);
  lcd.print("Welcome");
}

void loop() {
  network.update();
  unsigned long now = millis();
  if (now - last_sent >= interval) {
    last_sent = now;
    payload_t payload;
    strcpy(payload.message, "Ready to go");
    RF24NetworkHeader header(other_node);
    bool ok = network.write(header, &payload, sizeof(payload));
    Serial.println(ok ? "Sent" : "Failed");
  }
}

receiver node:

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

RF24 radio(7, 8);
RF24Network network(radio);
const uint16_t this_node = 00;
const uint16_t other_node = 01;
const int buzzerPin = 4; 

struct payload_t {
  char message[20];
};

void setup() {
  Serial.begin(115200);
  radio.begin();
  radio.setChannel(90);
  network.begin(this_node);
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  network.update();
  while (network.available()) {
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header, &payload, sizeof(payload));
    Serial.print("Received message: ");
    Serial.println(payload.message);
    if (strcmp(payload.message, "Ready to go") == 0) {
      digitalWrite(buzzerPin, HIGH);
      delay(500); // Beep for half a second
      digitalWrite(buzzerPin, LOW);
    }
  }
}

For test purposes, right now I am simply sending a message from the transmitter node with the lcd display to the receiver node every 5 seconds, to which the receiver node, once having received the message, plays a beep for half a second.

The issue that I am having is that the transmitter node which has the lcd display and nrf24l01+ transmitter is not sending the message if the lcd display is connected (radio.begin(); is false), but it works exactly as intended when the lcd display is disconnected.

At first I thought it was a power issue, but the board is being powered using a rechargeable 5400mWh 9V battery which seems to be outputting a consistent 5V to the nrf24l01+ after checking with a voltmeter.

The SPI pins are shared (13,12,11) but from researching online, this should be fine as long as the CE and CSN pins on the nrf24l01+ board are not being used, hence the use of the 2 and 3 pins.

I am not really quite sure what is preventing the nrf24l01+ module from working, I have used different boards and different nrf24l01+ modules to no avail. Any advice would be appreciated!



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