Uncategorized

Raspberry Pi 3 Tutorial 14 – Wireless Pi to Arduino Communication with NRF24L01+

Raspberry Pi 3 Tutorial 14 – Wireless Pi to Arduino Communication with NRF24L01+

Raspberry Pi 3 Tutorial 14 – Wireless Pi to Arduino Communication with NRF24L01+

Print Friendly, PDF & Email

Difficulty level: Beginner

Approx reading time:

Components Required:

1. Raspberry Pi 3 model B

2. Arduino Uno

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

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

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

6. Micro USB cable and USB cable type A/B (for Arduino)

7Breadboard

8NRF24L01+ Transceiver – 2

9Jumper 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 name could be: ReceiveArduino.py. Save it in the NRF24L01 directory(folder).

25. In the file ReceiveArduino.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. Open the Arduino IDE.

 26

27. In the above menu bar go to: Sketch -> Include Library -> Manage Libraries…

27

28. Search for RF24, select RF24 by TMRh20 Version 1.1.6 and click Install. After installation close the library manage.

28

29. Write the following program in the Arduino IDE and Upload it to the Arduino. Send.ino

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

ReceiveArduino.py output

RPiArduinoRxOutput

31. For a master/slave setup.

SendReceiveArduino.py(Pi)

SendReceive.ino(Arduino)

SendReceive.ino(Arduino) output

SlaveArduino

SendReceiveArduino.py(Pi) output

MasterPi

Hardware Connections ->

1. Raspberry Pi 3 GPIO Header.

pi3_gpio

2. nRF24L01 pinout

nrf24l01_module_pinout

3. nRF24L01 to Pi connections.

RFToPiConnections

RFToPi_schem

RFToPi_bb

4. nRF24L01 to Arduino Uno connections.

RFToArduinoConnections

ArduinoToRF_schem

Read full tutorial at

Rating widget:

No Comments Yet

Leave a Reply

Your email address will not be published.

.END

Categories: Uncategorized

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.