>Projects>NRF24d

NRF24 Daemon

The nrf24 daemon is a service which runs on a raspberry pi used to interface with a nrf24l01+ chip, especially the NRF24 board.

Setup

  1. Open the project with codeblocks and compile the release build.
  2. Open the project directory in bash and run ./install
  3. Change directory to /opt/nrf24d/interrupts/
  4. For each device which may send commands create a script which is simply named by its id (e.g. 1500). The first parameter contains the event id while the second contains its value.

Pinout

Pinouts for NRF24L01+ board (first) and Raspberry Pi (second). The pin in the top left corner is pin 1 and is denoted by a square on the PCB.

The following connection is necessary:

NRF24L01+Raspberry PI
GNDGND
VCC3.3V
CSNSPI CE 0
CEGPIO 3
IRQGPIO 2
SCKSPI SCLK
MOSISPI MOSI
MISOSPI MISO

 

Example Interrupt Script

$ cat /opt/nrf24d/interrupts/1500
#!/bin/sh

# <arg1> = event id
# <arg2> = value
# event = event 0 (in this case turn on/off lamps)

if [ "$1" -eq "0" ]; then
# default case turn off lamps
VAL=0
#if second argument is 0 then turn on lamps
if [ "$2" -eq "0" ]; then
VAL=2
fi
# send commands to lamps
/opt/nrf24d/nrf24ctl 1521 "$VAL" &
/opt/nrf24d/nrf24ctl 1522 "$VAL"
fi

NRF24 control command

The command nrf24ctl can be used to send commands to the lamps via the ipc server.
It has two different command lines:

/opt/nrf24d/nrf24ctl <id> <value>
Sends a command to the board with the specified id to change its PORTB register to the specified value.
This is equivalent to:
/opt/nrf24d/nrf24ctl <id> 4 716 <value>

/opt/nrf24d/nrf24ctl <id> <command> <address> <value>
Sends a command with the specified addres and value to board id.

Downloads

> Download NRF24 daemon including nrf24ctl