Simple scripts to make an arduino and raspberry pi communicate with each other using nrf24l01 modules.
To start, you need to install the RF24 library on both RPi and arduino board : https://github.com/nRF24/RF24
start by enabling SPI : sudo nano /boot/config.txt
uncomment dtparam=spi=on
. (You can also activate it by using sudo raspi-config
)
Install the required package for following instructions : sudo apt-get update
and sudo apt-get install git
Create a new directory where you want to make your project : mkdir yourDirectory
and then clone the github repository : git clone https://github.com/TRMh20/RF24.git
.
It will create a new directory named RF24.
We will now navigate to the newly create directory : cd R24
and then compile and install : make
, sudo make install
.
The library is now installed and ready for C/C++ use. If we need the Python support too : sudo apt-get install python-dev python-setup-tools libboost-python-dev
then cd pyRF24
and ./setup.py build
in the library manager search for RF24 library by TRMh20 and install it.
The scripts are written for Arduino=transmitter and RPi=receiver.
To compile the RPi script, go to RF24/examples_linux
, copy the file there and edit Makefile sudo nano Makefile
to add the name of the script to PROGRAMS= ...
Connect the nrf24l01 as follow