NRF24L01 / NRF24L01+ radios are a low-cost way to go wireless for limited resource Hardware such micro-controllers or small computer. This radios are popular among in the sensor arena and typical arduino(AVR), STM or other mcu projects to interact with other sensors or devices. Boros RF2 enable to integrate this kind of devices and DYI projects with regular computers running linux or Windows 10 and high-level development technologies like ruby ,python or nodejs. OIT/SmartHome frameworks such Node-RED, MySensors, OpenHab, AdafruitIO, AzureIoT... also support NRF24L01 radios integrate sensors and actuators.
Boros RF2 offer a dual header for up to two NRF24L01 / NRF24L01+ radios connected to your Raspberry Pi (or similar SBCs).
The typical applications of this radios:
- Hubs/Gateways for sensors networks.
- Radio Mesh networks.
- Over the air Software updates.
- Wireless audio transmission.
- Radio to TCP/IP radio links.
- Radio repeaters/range expanders.
- Remote controls of motors and relays.
- Radio controllers toys, robots, drones, etc...
- Protocol analyzers.
- 2.4GHz Band scanners, sniffers, ...
... and much more.
Boros RF2 help hobbists and makers to use integrate radio communication in their projects/products without dealing with the complexities of hardware interfaces with nRF24L01 radios. Makers can focus on their project and speed up the development.
You can buy assembled boards on Tindie: Boros Store
Boros RF2 hardware enable seamless integration of Pi-like SBCs/SOCs using built-in SPI support of SBC boards. With the following features:
- Small form factor compatible with Raspberry PI Zero / Pi Zero W Hat (pHat) specification but compatible with regular Raspberry Pi (3,2,B,B+,A+) or other SBC with same pinout (40-pin/2x20pin) like Orange Pi, Banana Pi, NanoPi, Ordoid, Thinker Board, Pine , ...
- Dual NRF24L01 / NRF24L01+ headers.
- Stackable design with standard mounting holes.
- Dedicated power regulator to avoid power shortages or unstable power lines.
- Beefy decoupling capacitors to radio sensibility and reduce transmission errors. This is specially relevant in long range applications with amplified (PA+LNA) versions of the radios.
- Robust & tested routing signal to minimize signal losses.
- Support for optional IRQ lines.
Boros RF2 include a optional accurate RTC based on Maxim DS3231 chipset that will enable:
- High accurate timekeeping with a back-up super capacitor.
- Calendar and alarm management with hardware interrupts.
- Programable square wave output.
- SQW/IRQ, RTS and 32Khz RTC break out pins for custom applications.
- I2C/TWI interface with the RTC up to 400kHz(fast I2C) frequency. No additional GPIO are wasted.
- Seamless integration with linux via kernel available kernel modules.
- Integrated temperature sensor.
caveat: The power supply provided by the super capacitor is designed as back-up for time-keeping only. The energy stored in the super-capacitor will to keep the internal oscillator of the clock running for several hours. On the other hand, charging the capacitor only a couple of minutes of main power supply is needed.
Boros RF2 use a minimal set of GPIO of your board.
Check some examples of pinouts:
Raspberry Pi 2,3 B,B+,A+ 40pin-20x2:
Physical Pin | RPI GPIO # | Orange Pi GPIO | Notes |
---|---|---|---|
19 | IO10/SPI0 MOSI | PC0/SPI0 MOSI | SPI data |
21 | IO09/SPI0 MISO | PC1/SPI0 MISO | SPI data |
23 | IO11/SPI0 SCLK | PC2/SPI0 SCK | SPI clock |
24 | IO08/SPI0 CSN0 | PC3/SPI0 CSN0 | SPI Chip Select 0* |
26 | IO07/SPI0 CSN1 | PA21 (#21) | SPI Chip Select 1* |
22 | IO25 | PA2 (#2) | Radio 1 CE * |
15 | IO22 | PA3 (#3) | Radio 1 IRQ * |
18 | IO24 | PC7 (#71) | Radio 0 CE * |
13 | IO27 | PA0 (#0) | Radio 0 IRQ * |
For I2C | |||
1 | 3.3V | 3.3V | Power supply for RTC |
3 | GPIO2/I2C-1 SDA | PA12/I2C-0 SDA | I2C |
5 | GPIO3/I2C-1 SCL | PA11/I2C-0 SCL | I2C |
(*) Pins marked can be used for other purposes if radio is not connected.
Note: Orange PI GPIO code to GPIO number is calculated with this formula : (position of letter in alphabet - 1) * 32 + pin number
Notes on SPIDEV: SpiDev is a portable access to SPI devices in linux. Boros RF2 is compatible with native BCM modules and libraries and other libraries to access GPIO SPI like WiringPi or MRAA. It is recommended to use SPIdev unless you have specific requirements.
Boros RF2 schematic can be found here: Boros RF2 v1
Plug & Go, no cabling or soldering needed
- Disconnect your Raspberry Pi/SBC from power to avoid any electrical socks.
- Plug one or two radios radios in the NRF24L01 / NRF24L01+ headers (J2/J3).
- Plug Boros RF2 to GPIO expansion port. Please check the pinout of your board as the pin header in inverted in some boards such the case of Orange Pis.
- Fast Hat board with suitable pcb spacers or standoffs if needed.
- Power up your Raspberry PI and Go.
Check the video for mounting:
There are several ways to interact with nRF24L01 radios in linux environments. For standard purposes the recommended software are:
@kiwiBryn has created a set of solutions for field gateways/hubs for AzureIoT and AdafruitIO. Check his blog post here. Code repositories are here for AzureIoT and AdafruitIO.
Also a RF24 driver for in C# for .NET framework can be found here.
nRF24 is a stable and optimized library enable control radios in linux with the same primitives of the Arduino environment.
There are other resources available to work in C/C++. nrf24 library is recommended as it well supported and include lots of examples.
There are several npm packages to available. Recommended packages are:
For Node-RED: node-red-contrib-nrf24
nRF24 C++ library offer a python wrapper and several examples.
Pure ruby Gem: https://github.com/eflukx/nrf24-ruby
MySensors platform supports out of the box communication via nRF24L01 radios. You can found the detailed tutorials here and here.
Optional RTC module can be used under linux without programing as the linux kernel supports this RTC out of the box.
For modern linux distibutions such Raspbian/DietPi jessie or stretch (based on mainline kernel and systemd) you can follow this tutorial. This will enable the RTC and use systemd to sync time with via NTP if needed.
For older versions rc.local
init script should be used to configure the RTC. You can follow this tutorial.
Typical commands in linux console to work with the driver are (require root/sudo):
Init the driver manually
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
Read time in the RTC
hwclock -r
Set the RTC with current system time
hwclock -w
Set the system time with the time stored in the RTC
hwclock -s
The RTC include a temperature sensor that can be monitor the temperature of the RTC chip. The RTC temperature is updated once a minute (68s) and could provide information about the ambient temperature or the temperature inside your case. Temperature sensor can be read using sysfs under the following path: /sys/class/hwmon/hwmon0/temp1_input
. To convert to human readable centigrade temperature you can use this simple one-liner:
Read temp / 1000 in Celsius
cat /sys/class/hwmon/hwmon0/temp1_input | awk '{print $1/1000 " C"}'
example output
28.25 C
For custom or advanced user could interact directly with the RTC using i2c-dev interface or specific libraries.
- nRF24L01 radios: Original and clones.
- Raspberry PI (using modern Raspbian & DietPi stretch):
- Zero
- Zero W
- 3 B
- Raspberry PI 3B Windows 10 (only RF interfaces)
- Orange Pi (using armbian mainline ubuntu xenial or Debian Strech):
- Orange Pi (H3)
- Orange Pi zero (H2+)
- Orange Pi zero plus (H5)
Testing feedback on other boards and operating systems are welcome.
Please open an issue in github to report any relevant. Please have in mind that issues related software or library usage should be sumbitted to library/software maintaners. On the other, have in mind that the market is full of fake radios that could cause several communication and stability problems. Problems related with fake radios are also not covered here.
- V1: First version.