Print Friendly

Difficulty level: Beginner

Approx reading time:

Components Required:

1. Raspberry Pi 3 model B – 2

2. MicroSD card 8 or 16 GB (Class 4 and above) with Raspbian – 2

3. Windows PC / Linux PC (Tested on Windows 10, Ubuntu 14.04 LTS)

4. Ethernet cable (Category 5 – also called Cat 5) – 2

5. Micro USB cable – 2

6. Breadboard – 2

7. NRF24L01+ RF Transceiver – 2

8. Jumper Wires (Male to Female, Male to Male)

Way to go ->

1. Login to both your devices using PuTTy or your Ubuntu terminal.

2. Login to both your devices’ GUIs using VNC server (Linux / Windows).

Do the following for both the devices:

3. In the terminal type: 

and press Enter on your PC keyboard.

Follow steps 7 – 9 of RPi 3 Tutorial – 11 for steps 4 – 6.

4. Go to Advanced Options

5. Go to SPI

6. Enable SPI Interface by clicking on <Yes>

7. Reboot the Pi. In the terminal, type: 

8. In the terminal type: 

9. After it has rebooted, install Python development tools. In the terminal, type:

10. Download this package. In the terminal type:

11. In the terminal type: ls to check that you have master.zip in your current working directory.

12. To unzip, in the terminal type: 

13. Remove master.zip: 

14. Navigate to py-spidev-master directory(folder): 

15. Type in the terminal: ls, to view the contents of the directory(folder).

16. In the terminal run the commands:

17. Navigate to the desktop by running the following commands. In terminal type:

Press Enter on your PC keyboard.

Press Enter on your PC keyboard.

18. Create the following directory(folder) and navigate to it. In terminal type:

Press Enter on your PC keyboard.

Press Enter on your PC keyboard.

19. In the terminal type:

20. Navigate to directory just downloaded. In the terminal type:

Press Enter on your PC keyboard.

Press Enter on your PC keyboard.

Press Enter on your PC keyboard.

21. Copy lib_nrf24.py to the NRF24L01 directory. In the terminal type:

 22. Navigate to the NRF24L01 directory:

23. In Python 3 (IDLE), create a new file.

24. The names could be: TransmitPi.py (in one of the devices) and Receive.py (in the other device). Save them in the NRF24L01 directory in both the devices.

25. In the file TransmitPi.py, write the following code with comments (line starting with “#”) for clear understanding and save (press Cntrl + S on your PC keyboard) the file.

26. In the file ReceivePi.py, write the following code with comments (line starting with “#”) for clear understanding and save (press Cntrl + S on your PC keyboard) the file. 

27. Finally, run the script by clicking on Run -> Run Module in the menu bar or by pressing F5 on your PC keyboard.

TransmitPi.py output

TxOutput

ReceivePi.py output

RxOutput

28. For a master/slave setup, follow steps 1 – 23 as above and run the following python scripts Master.py and Slave.py on your respective devices.

Master.py

Slave.py

Master.py output

MasterOutput

Slave.py output

SlaveOutput

Hardware Connections ->

1. Raspberry Pi 3 GPIO Header.

pi3_gpio

2. nRF24L01 pinout

nrf24l01_module_pinout

3. nRF24L01 to Pi connections.

RFToPiConnections

4. Wire up both the devices to the RF modules.

RFToPi_schem

RFToPi_bb

Read full tutorial at

Rating widget: