Wireless Communication Using NRF24L01 Transceiver Module for Arduino Based Projects
by M Hammad Ullah in Circuits > Arduino
7610 Views, 49 Favorites, 0 Comments
Wireless Communication Using NRF24L01 Transceiver Module for Arduino Based Projects
This is my second instructable tutorial about the robots and micro-controllers. It is really amazing to see your robot alive and working as expected and believe me it will be more fun if you control your robot or other things wireless with fast and wide range of communication. That is why this instructable is about wireless communication.
PARTS
For Transmitter
- Arduino Nano or Uno (I’m using Arduino UNO) x1 https://amzn.to/2vTkWzd
- Transceiver module NRF24L01 x1 https://amzn.to/2Q4sHeG
- Dual Axis Joysticks x2. https://amzn.to/2Q4t0Gm
(or other things like push buttons, sensors etc . I’m using Joystick because I want to send data about the position of joystick).
For Receiver:
- Arduino Nano or Uno (I’m using Arduino Nano). x1 https://amzn.to/2E7orqa
- Transceiver module NRF24L01. x1 https://amzn.to/2Q4sHeG
Others:
Jumper wires https://amzn.to/2JBK4m8
Batteries for Arduino supply https://amzn.to/2W5cDyM and https://amzn.to/2W5cDyM
Introduction to NRF and Connections
By the name of Transceiver it is clear that this module can communicate in both ways as a transmitter or as a receiver depends upon programming. It has 8 pins and we are going to use 7 pins. You may observe pins in attached picture.
VCC & GND for supply.
For this purpose we will use 3.3v pin of Arduino.
CE & CSN
Transmitter and receiver pins. We are going to use Arduino (Nano and Uno) Pin 9 for CE and Pin 10 for CSN.
MOSI, MISO & SCK
These are SPI pins.
It communicate with Arduino by SPI pins. Every member in Arduino family has some specific pins for SPI communication.
For Arduino UNO:
SPI pins are
Pin 11 (MOSI)
Pin 12 (MISO)
Pin 13 (SCK)
Arduino Nano SPI pins:
Pin 11 (MOSI)
Pin 12 (MISO)
Pin 13 (SCK)
Same as Arduino UNO.
Now you can make connections for both transmitter and receiver.
Note: You must have a library for NRF24L01 in your Arduino IDE software. Download it by Here.
Introduction to Joystick and Connections.
Joystick in nothing but a simple potentiometer. The 2 axis joystick we are using in this tutorial have 5 pins as shown in picture..
Connections for joystick at transmitter end:
VCC to Arduino 5v pin.
GND to Arduino GND
VRx to Arduino Analogue pin A0
VRy to Arduino Analogue pin A1
SW to any spare digital pin of Arduino. (I'm not using this pin but you may use by a little change in code).
For second Joystick
You may use arduino 5V pin for both joysticks.
VRx to Arduino Analogue pin A2
VRy to Arduino Analogue pin A3
Using two joysticks means you have to transmit 4-6 channels.
Working and Programming Part
After the construction of transmitter and receiver take out output pins from receiver. I'm using Arduino's digital pin 2 to digital pin 5 for my 4 channel wireless communication. You may extend it upto available digital pins. To check the working of system I attached a robotic arm having 4 servo motors at receiver end.
Arduino Nano Digital pin 2 => Channel 1 => THR
Arduino Nano Digital pin 3 => Channel 2 => YAW
Arduino Nano Digital pin 4 => Channel 3 => PITCH
Arduino Nano Digital pin 5 => Channel 4 => ROLL
Codes for transmitter and receiver are attached. Don't forget to include libraries first in your Arduino IDE software before uploading the code to Arduino.
Upgrading
The basic purpose of this tutorial was to cover the part of wireless communication. But you have to make changing according to your purpose and project. For any question and help use the email address given in code files, must watch the video attached at top and subscribe the channel for support, Thank you.