nRF24L01

Raspberry Pi 2 and Arduino with nRF24L01 radios

Intro

This is awesome! Finally got my RPi2 talking to an Arduino using the nRF24L01 radios!

 

Config the Raspberry Pi 2 (Model B v1.1)

  • connect radio
NRF24L01  Pin NRF24L01 RPi2 RPi2 РConnector Pin
1 GND rpi-gnd (25)
2 VCC rpi-3v3 (17)
3 CE rpi-gpio22 (15)
4 CSN rpi-gpio8 (24)
5 SCK rpi-sckl (23)
6 MOSI rpi-mosi (19)
7 MISO rpi-miso (21)
8 IRQ

 

  • config pi to turn on SPI

sudo raspi-config
-> Select Advanced and enable the SPI kernel module

  • download drivers

wget http://tmrh20.github.io/RF24Installer/RPi/install.sh
chmod +x install.sh
./install.sh

  • test

cd rf24libs/RF24/examples_RPi
cp gettingstarted.cpp mytest.cpp
sudo nano mytest.cpp

change the pipe address
// Radio pipe addresses for the 2 nodes to communicate.
//const uint8_t pipes[][6] = {"1Node","2Node"};
//my address
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

build the program
sudo g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall -I../ -lrf24-bcm mytest.cpp -o mytest

run
sudo ./mytest

runnrfpi1

 
 
 

Config the Arduino (UNO, Pro Mini….)

  • connect radiopinNRF
  • download and install RF24 libraries
    https://github.com/maniacbug/RF24
  • load sketch
    File->Examples->RF24->GettingStarted
  • test
    arduino_rf24_test1

 
 
 

Putting it all together

Finally, set the role on the RPi2 to ping_out.

 

arduino_rf24_test2

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>