Codey OnlineBibliothèque de composants Arduino & ESP32 › NRF24L01
NRF24L01
Communication

NRF24L01

Le NRF24L01 est un module émetteur-récepteur sans fil 2,4 GHz pour la communication de données à courte distance entre microcontrôleurs. Il se connecte via SPI et utilise généralement CE, CSN, SCK, MOSI, MISO, IRQ, GND et une alimentation de 3,3 V.

Largeur: 31.1 mm

Brochage — NRF24L01

Broche Signal Description
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.

Exemple de schéma de câblage — NRF24L01

De Vers Fil
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

Exemple de code Arduino — NRF24L01

Cet exemple a été écrit et vérifié à la compilation pour le arduino-uno. Codey Online l'adapte pour vous à toute autre carte prise en charge.

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

Composants similaires

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

Construisez votre projet Arduino ou ESP32 avec l'IA

Décrivez ce que vous voulez créer. Codey Online écrit le code, dessine le schéma de câblage, le compile et flashe votre carte directement depuis le navigateur.

Commencez gratuitement