nanoFramework.Iot.Device.Nrf24l01 1.2.864

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Nrf24l01 --version 1.2.864
                    
NuGet\Install-Package nanoFramework.Iot.Device.Nrf24l01 -Version 1.2.864
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Nrf24l01" Version="1.2.864" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Nrf24l01" Version="1.2.864" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Nrf24l01" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Nrf24l01 --version 1.2.864
                    
#r "nuget: nanoFramework.Iot.Device.Nrf24l01, 1.2.864"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Nrf24l01@1.2.864
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Nrf24l01&version=1.2.864
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Nrf24l01&version=1.2.864
                    
Install as a Cake Tool

nRF24L01 - Single Chip 2.4 GHz Transceiver

The nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM band.

Documentation

  • The bindging datasheet can be found here

Board

Sensor picture

Note: the following diagram uses a Raspberry Pi. This can be achieved with any MCU having 2 available SPI.

Connection Diagram

Usage

Hardware Required

  • nRF24L01 × 2
  • Male/Female Jumper Wires

Connection for nRF1

  • VCC - 3.3V (Best)
  • GND - GND
  • MOSI - SPI0 MOSI (GPIO 10)
  • MISO - SPI0 MISO (GPIO 9)
  • SCK - SPI0 SCLK (GPIO 11)
  • CSN - SPI0 CS0 (GPIO 8)
  • CE - GPIO 23
  • IRQ - GPIO 24

Connection for nRF2

  • VCC - 3.3V (Best)
  • GND - GND
  • MOSI - SPI1 MOSI (GPIO 20)
  • MISO - SPI1 MISO (GPIO 19)
  • SCK - SPI1 SCLK (GPIO 21)
  • CSN - SPI1 CS0 (GPIO 16)
  • CE - GPIO 5
  • IRQ - GPIO 6

Code

Important: make sure you properly setup the SPI pins especially for ESP32 before creating the SpiDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the SPI GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.SPI1_MOSI);
Configuration.SetPinFunction(22, DeviceFunction.SPI1_MISO);
Configuration.SetPinFunction(23, DeviceFunction.SPI1_CLOCK);
// Make sure as well you are using the right chip select

For other devices like STM32, please make sure you're using the preset pins for the SPI bus you want to use. The chip select can as well be pre setup.


SpiConnectionSettings senderSettings = new SpiConnectionSettings(1, 42)
{
    ClockFrequency = Nrf24l01.SpiClockFrequency,
    Mode = Nrf24l01.SpiMode
};

SpiConnectionSettings receiverSettings = new SpiConnectionSettings(2, 44)
{
    ClockFrequency = Nrf24l01.SpiClockFrequency,
    Mode = Nrf24l01.SpiMode
};
var senderDevice = SpiDevice.Create(senderSettings);
var receiverDevice = SpiDevice.Create(receiverSettings);

// SPI Device, CE Pin, IRQ Pin, Receive Packet Size
using (Nrf24l01 sender = new Nrf24l01(senderDevice, 23, 24, 20))
{
    using (Nrf24l01 receiver = new Nrf24l01(receiverDevice, 5, 6, 20))
    {
        // Set sender send address, receiver pipe0 address (Optional)
        byte[] receiverAddress = Encoding.UTF8.GetBytes("NRF24");
        sender.Address = receiverAddress;
        receiver.Pipe0.Address = receiverAddress;

        // Binding DataReceived event
        receiver.DataReceived += Receiver_ReceivedData;

        // Loop
        while (true)
        {
            sender.Send(Encoding.UTF8.GetBytes("Hello! .NET Core IoT"));

            Thread.Sleep(2000);
        }
    }
}

private static void Receiver_ReceivedData(object sender, DataReceivedEventArgs e)
{
    var raw = e.Data;
    var msg = Encoding.UTF8.GetString(raw);

    Debug.Write("Received Raw Data: ");
    foreach (var item in raw)
    {
        Debug.Write($"{item} ");
    }
    Debug.WriteLine();

    Debug.WriteLine($"Message: {msg}");
    Debug.WriteLine();
}

Result

Sample result

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.864 223 4/2/2025
1.2.852 214 3/11/2025
1.2.822 154 2/26/2025
1.2.775 154 2/4/2025
1.2.772 161 2/4/2025
1.2.755 161 1/31/2025
1.2.737 122 1/13/2025
1.2.696 160 12/16/2024
1.2.673 176 10/23/2024
1.2.631 179 8/28/2024
1.2.570 170 6/14/2024
1.2.560 180 5/29/2024
1.2.548 132 5/15/2024
1.2.436 295 11/10/2023
1.2.329 230 5/26/2023
1.2.313 211 5/12/2023
1.2.297 217 5/3/2023
1.2.203 388 12/28/2022
1.2.141 477 10/25/2022
1.2.122 490 10/12/2022
1.2.114 442 10/8/2022
1.2.95 524 9/22/2022
1.2.87 567 9/15/2022
1.2.73 483 9/8/2022
1.2.5 516 7/13/2022
1.1.141.41205 535 7/6/2022
1.1.113.2032 516 6/23/2022
1.1.58.10097 515 5/23/2022
1.1.27 528 4/26/2022
1.1.20 529 4/21/2022
1.1.1 527 4/14/2022
1.0.300 510 4/1/2022
1.0.277-preview.125 198 3/25/2022
1.0.277-preview.111 204 3/18/2022
1.0.277-preview.106 205 3/15/2022
1.0.277-preview.98 212 3/8/2022
1.0.277-preview.85 199 2/25/2022
1.0.277-preview.77 198 2/18/2022
1.0.277-preview.68 214 2/9/2022
1.0.277-preview.60 214 2/4/2022
1.0.277-preview.41 214 1/28/2022
1.0.277-preview.32 218 1/27/2022
1.0.277-preview.17 226 1/24/2022
1.0.277-preview.15 206 1/21/2022
1.0.277-preview.1 209 1/11/2022
1.0.259 390 12/9/2021
1.0.221 243 10/19/2021
1.0.219 254 10/19/2021
1.0.218 282 10/18/2021
1.0.155 249 8/31/2021
1.0.136 326 7/17/2021
1.0.135 246 7/16/2021
1.0.134 253 7/15/2021
1.0.133 284 7/14/2021
1.0.129 257 7/6/2021
1.0.125 289 7/5/2021
1.0.121 283 6/29/2021
1.0.119 316 6/28/2021
1.0.58 303 5/25/2021