[EDIT] - I uploaded a script in the next post that does everything I explained below
I have installed MINImal raspBIAN which is a raspBIAN without a gui. So this should work for you guys.
First of all you have to
1. Undo your Overclock. If you have any. (SPI does not like Overclocked pi's)
2. Enable SPI
Details:
On a normal raspbian image this can be done either on a fresh install (when you config your pi) or you can type in terminal sudo raspi-config
From there you go into ADVANCED OPTIONS -> SPI
On a minimal image you don't have the luxury of raspi-config. You have to manually activate it.
(I already had it enabled but you can check)
(If you don't have sudo installed on your image just run apt-get install sudo
)
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Make sure there IS a # before blacklist spi-bcm2708, so it looks like this…
#blacklist spi-bcm2708
If there is no line like that, you can add it. It won't do any harm.
CTRL+O - Save
ENTER - Confirm
CTRL+X - Exit
or
CTRL+X - Exit
y - I want to save the file
ENTER - Confirm
We have to edit now the config.txt.
sudo nano /boot/config.txt
add this to the end of the line
dtparam=spi=on
Save and exit.
Reboot your pi.
sudo reboot
Enjoy using SPI. (Source)
3.Downloading the files
Details:
You have 2 options. wget and git-clone. I'll start with:
a. git-clone
If you don't have git-clone you need to install the git tools. (Yes, git is related to github)
sudo apt-get install git
After you installed git you simply navigate to the folder that you wish to install the program and type:
sudo git-clone https://github.com/mysensors/Raspberry.git
This will download a zip, unarchive it and.. It does all the jobs for you.
b. wget
Some ppl are old-school and go the hard way or they just enjoy it done this way.
Navigate to the folder that you wish to install the program and type:
wget https://github.com/mysensors/Raspberry/archive/master.zip
(this will download you the zip)
Unzip the file
If you don't have unzip installed just type
sudo apt-get install unzip
unzip master.zip -d /home/pi/Raspberry
(you can specify any directory that you want instead of the /home/pi/Raspberry)
4.Edit and compile what you downloaded
In the Raspberry folder you have some files and some folders.
The majority of ppl (including me) forget to complile the libs for the NRF24l01.
This is the library provided by [TMRH20]{http://tmrh20.github.io} (He has some interesting stuff there including an audio library for NRF24l01.)
Back to our stuff.
Go to the Raspberry folder then into librf24-bcm.
cd Raspberry/librf24-bcm/
Type
make
Go back to the Raspberry folder
cd ..
Type
make
5.Connecting the NRF
Mister TMRH20 tells us that we need to connect the NRF24l01 this way
PIN NRF24L01 RPI RPi -P1 Connector
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 Not Connected
Connect everything like that except for the CE pin
Run the PiGatewaySerial
./PiGatewaySerial
It shoud prin something like this:
Starting PiGatewaySerial...
Protocol version - 1.4
Created PTY '/dev/pts/1'
Gateway tty: /dev/ttyMySensorsGateway
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO25
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x00 0x00 0x20 0x00 0x00 0x00
EN_AA = 0x3b
EN_RXADDR = 0x07
RF_CH = 0x10
RF_SETUP = 0x23
CONFIG = 0x0e
DYNPD/FEATURE = 0x3f 0x06
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
Look at line 7 CE Pin = Custom GPIO25
Connect the CE pin where it says you should.
Here are some pictures with the GPIO connector on the rPi.
https://www.google.ro/search?q=raspberry+pi+gpio&tbm=isch