Codey OnlineBiblioteka komponentów Arduino i ESP32 › NRF24L01
NRF24L01
Komunikacja

NRF24L01

NRF24L01 to bezprzewodowy moduł transceivera 2,4 GHz do krótkodystansowej komunikacji danych między mikrokontrolerami. Łączy się przez SPI i zwykle używa CE, CSN, SCK, MOSI, MISO, IRQ, GND oraz zasilania 3,3 V.

Szerokość: 31.1 mm

Pinout — NRF24L01

Pin Sygnał Opis
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.

Przykładowy schemat połączeń — NRF24L01

Z Do Przewód
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

Przykładowy kod Arduino — NRF24L01

Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.

#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);
}

Podobne komponenty

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

Zbuduj swój projekt Arduino lub ESP32 z pomocą AI

Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.

Zacznij za darmo