Codey OnlineLibreria di componenti Arduino ed ESP32 › NRF24L01
NRF24L01
Comunicazione

NRF24L01

Il NRF24L01 è un modulo ricetrasmettitore wireless a 2,4 GHz per la comunicazione dati a corto raggio tra microcontrollori. Si collega tramite SPI e in genere usa CE, CSN, SCK, MOSI, MISO, IRQ, GND e un'alimentazione a 3,3 V.

Larghezza: 31.1 mm

Pinout — NRF24L01

Pin Segnale Descrizione
GND ground Ground reference for the nRF24L01 module and SPI interface.
CE enable Chip enable control for RX/TX mode operation, driven by the MCU.
CSN chip-select Active-low SPI chip select for addressing the nRF24L01.
SCK SCK SPI clock input from the microcontroller.
VCC power 3.3V power input for the nRF24L01 radio module; do not connect to 5V.
MISO MISO SPI data output from the nRF24L01 to the microcontroller.
MOSI MOSI SPI data input to the nRF24L01 from the microcontroller.
IRQ interrupt Active-low interrupt output for receive, transmit, or error events.

Schema di cablaggio di esempio — NRF24L01

Da A Filo
board:3.3V x1:VCC darkorange
board:GND x1:GND black
board:D9 x1:CE green
board:D10 x1:CSN blue
board:D13 x1:SCK yellow
board:D12 x1:MISO purple
board:D11 x1:MOSI cyan

Codice Arduino di esempio — NRF24L01

Questo esempio è stato scritto e verificato in compilazione per arduino-uno. Codey Online lo adatta a qualsiasi altra scheda supportata.

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

// NRF24L01 wiring on Arduino Uno:
// CE  -> D9
// CSN -> D10
// SCK -> D13
// MISO-> D12
// MOSI-> D11
// VCC -> 3.3V
// GND -> GND

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "1Node";

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ;
  }

  Serial.println(F("NRF24L01 basic transmit example"));

  if (!radio.begin()) {
    Serial.println(F("Radio hardware not responding! Check wiring and 3.3V power."));
    while (1) {
      delay(1000);
    }
  }

  radio.setPALevel(RF24_PA_LOW);
  radio.setDataRate(RF24_1MBPS);
  radio.setChannel(76);
  radio.openWritingPipe(address);
  radio.stopListening();

  Serial.println(F("Radio initialized and ready to send messages."));
}

void loop() {
  const char message[] = "Hello NRF24L01";
  bool ok = radio.write(&message, sizeof(message));

  Serial.print(F("Sending: "));
  Serial.print(message);
  Serial.print(F(" -> "));
  Serial.println(ok ? F("success") : F("failed"));

  delay(1000);
}

Componenti correlati

CC1101 RF Module

CC1101 RF Module

HC-05 Bluetooth

HC-05 Bluetooth

Logic Level Shifter 4-channel

Logic Level Shifter 4-channel

Logic Level Shifter 8-channel

Logic Level Shifter 8-channel

Crea il tuo progetto Arduino o ESP32 con l'AI

Descrivi cosa vuoi realizzare. Codey Online scrive il codice, disegna lo schema di collegamento, lo compila e programma la tua scheda direttamente dal browser.

Inizia gratis