برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

داده هایی در مورد برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

تبلیغات
آخرین نظرات

۴ مطلب با کلمه‌ی کلیدی «nRF24L01» ثبت شده است

RadioLink-Joystick-To-Servos

ShahBaz | سه شنبه, ۲۷ مرداد ۱۳۹۴، ۰۶:۰۰ ب.ظ

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 

 

 

RadioLink-Joystick-To-Servos


UNDER CONSTRUCTION - July 2014: If you try this version, please send problems, feedback, suggestions to terry@yourduino.com

- WHAT IT DOES:
  • Reads Joystick Analog Values on A0, A1 and transmits them over an nRF24L01 Radio Link, using the Radiohead library.
  • Receives Joystick position values from an nRF24L01 Radio Link, positions X and Y Servos (Usually on a Pan-Tilt platform). May point a small laser.

Uses nRF24L01 Radios like these.

 

The TRANSMIT Software Sketch:

(Copy and paste into a blank Arduino IDE page)
/* YourDuinoStarter Example: TRANSMIT nRF24L01 Joystick data to Pan Tilt Over Radio.
   QUESTIONS? terry@yourduino.com
 - WHAT IT DOES: Reads Joystick Analog Values on A0, A1 and transmits
   them over a nRF24L01 Radio Link, using the Radiohead library.
 - TODO! Send the Joystick push-down click to turn Laser on and off
 - SEE the comments after "//" on each line below
 - CONNECTIONS: nRF24L01 Modules See:
 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 8
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED

      -
   Analog Joystick or two 10K potentiometers:
   GND to Arduino GND
   VCC to Arduino +5V
   X Pot to Arduino A5
   Y Pot to Arduino A4
   Click Button to pin 4

   -V2.00 7/12/14  by Noah King
   Based on examples at http://www.airspayce.com/mikem/arduino/RadioHead/index.html
*/

/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries  !!
// NEED the RadioHead Library installed!
// http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.23.zip
#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <SPI.h>


/*-----( Declare Constants and Pin Numbers )-----*/
#define JoyStick_X_PIN     A5  //Pin Numbers
#define JoyStick_Y_PIN     A4
#define ClickPIN           4

#define CLIENT_ADDRESS 1      // For Radio Link
#define SERVER_ADDRESS 2


// Create an instance of the radio driver
RH_NRF24 RadioDriver;

// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
RHReliableDatagram RadioManager(RadioDriver, CLIENT_ADDRESS);// sets the driver to NRF24 and the client adress to 1

/*-----( Declare Variables )-----*/
uint8_t joystick[2];  // 2 element array of unsigned 8-bit type, holding Joystick readings

// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];    // Actually: 28 bytes (32 minus 4 byte header)

void setup()  /****** SETUP: RUNS ONCE ******/
{
  // begin serial to display on Serial Monitor. Set Serial Monitor to 115200
  // See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
  Serial.begin(115200);

  // NOTE: pinMode for Radio pins handled by RadioDriver
  if (!RadioManager.init())   // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
    Serial.println("init failed");

  pinMode(ClickPIN, INPUT);  //Not really needed: pins default to INPUT
}



void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
  //Read the joystick values, scale them to 8-bit type and store them in the joystick[] array.
  Serial.println("Reading joystick values ");
  // Take the value of Joystick voltages which are 0 to 1023 (10 bit), and convert them to 0 to 255 (8 bit)
  joystick[0] = map(analogRead(JoyStick_X_PIN), 0, 1023, 0, 255);
  joystick[1] = map(analogRead(JoyStick_Y_PIN), 0, 1023, 0, 255);

  //Display the joystick values in the serial monitor.
  Serial.print("x:");
  Serial.print(joystick[0]);
  Serial.print("y:");
  Serial.println(joystick[1]);

  Serial.println("Sending Joystick data to nrf24_reliable_datagram_server");
  //Send a message containing Joystick data to manager_server
  if (RadioManager.sendtoWait(joystick, sizeof(joystick), SERVER_ADDRESS))
  {
    // Now wait for a reply from the server
    uint8_t len = sizeof(buf);
    uint8_t from;
    if (RadioManager.recvfromAckTimeout(buf, &len, 2000, &from))
    {
      Serial.print("got reply from : 0x");
      Serial.print(from, HEX);
      Serial.print(": ");
      Serial.println((char*)buf);
    }
    else
    {
      Serial.println("No reply, is nrf24_reliable_datagram_server running?");
    }
  }
  else
    Serial.println("sendtoWait failed");

  delay(500);  // Wait a bit before next transmission
}


 

The RECEIVE Software Sketch:

(Copy and paste into a blank Arduino IDE page)
/* YourDuinoStarter Example:RECEIVE nRF24L01 Joystick data to control Pan Tilt Servos Over Radio.
   QUESTIONS? terry@yourduino.com
 -WHAT IT DOES:
  -Receives Joystick Analog Values over a nRF24L01 Radio Link, using the Radiohead library.
  - Sends Joystick position to 2 servos, usually X,Y to pan-tilt arrangement
  - TODO! Send the Joystick push-down click to turn Laser on and off
 - SEE the comments after "//" on each line below
 - CONNECTIONS: nRF24L01 Modules See:
 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 8
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED


   -V2.00 7/12/14 by Noah King
   Based on examples at http://www.airspayce.com/mikem/arduino/RadioHead/index.html
*/

/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries  !!
// NEED the SoftwareServo library installed
// http://playground.arduino.cc/uploads/ComponentLib/SoftwareServo.zip
#include <SoftwareServo.h>  // Regular Servo library creates timer conflict!

// NEED the RadioHead Library installed!
// http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.23.zip
#include <RHReliableDatagram.h>
#include <RH_NRF24.h>

#include <SPI.h>

/*-----( Declare Constants and Pin Numbers )-----*/
#define CLIENT_ADDRESS     1
#define SERVER_ADDRESS     2

#define ServoHorizontalPIN 3   //Pin Numbers
#define ServoVerticalPIN   5
#define LaserPIN           6

#define ServoMIN_H  0  // Don't go to very end of servo travel
#define ServoMAX_H  160 // which may not be all the way from 0 to 180. 
#define ServoMIN_V  0  // Don't go to very end of servo travel
#define ServoMAX_V  140 // which may not be all the way from 0 to 180. 


/*-----( Declare objects )-----*/
SoftwareServo HorizontalServo;
SoftwareServo VerticalServo;  // create servo objects to control servos

// Create an instance of the radio driver
RH_NRF24 RadioDriver;

// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
RHReliableDatagram RadioManager(RadioDriver, SERVER_ADDRESS);

/*-----( Declare Variables )-----*/
int HorizontalJoystickReceived; // Variable to store received Joystick values
int HorizontalServoPosition;    // variable to store the servo position

int VerticalJoystickReceived;   // Variable to store received Joystick values
int VerticalServoPosition;      // variable to store the servo position

uint8_t ReturnMessage[] = "JoyStick Data Received";  // 28 MAX
// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];

//--------------------------------( SETUP Runs ONCE )-----------------------------------------------------
void setup()
{
  pinMode(LaserPIN, OUTPUT);
  digitalWrite(LaserPIN, HIGH); // turn on Laser

  /*-----( Set up servos )-----*/
  HorizontalServo.attach(ServoHorizontalPIN);  // attaches the servo to the servo object
  VerticalServo.attach(ServoVerticalPIN);      // attaches the servo to the servo object


  // begin serial to display on Serial Monitor. Set Serial Monitor to 115200
  // See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
  Serial.begin(115200);

  if (!RadioManager.init()) // Initialize radio. If NOT "1" received, it failed.
    Serial.println("init failed");
  // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
} // END Setup



//--------------------------------( LOOP runs continuously )-----------------------------------------------------
void loop()
{
  if (RadioManager.available())
  {
 // Wait for a message addressed to us from the client
    uint8_t len = sizeof(buf);
    uint8_t from;
    if (RadioManager.recvfromAck(buf, &len, &from))
 //Serial Print the values of joystick
    {
      Serial.print("got request from : 0x");
      Serial.print(from, HEX);
      Serial.print(": X = ");
      Serial.println(buf[0]);
      Serial.print(" Y = ");
      Serial.println(buf[1]);

      // Send a reply back to the originator client, check for error
      if (!RadioManager.sendtoWait(ReturnMessage, sizeof(ReturnMessage), from))
        Serial.println("sendtoWait failed");
    }// end 'IF Received data Available
  }// end 'IF RadioManager Available
  
  {
    SoftwareServo::refresh();//refreshes servo to keep them updating
    HorizontalJoystickReceived  = buf[1];  // Get the values received
    VerticalJoystickReceived    = buf[0]; 

    // scale it to use it with the servo (value between MIN and MAX)
    HorizontalServoPosition  = map(HorizontalJoystickReceived, 0, 255, ServoMIN_H , ServoMAX_H);
    VerticalServoPosition    = map(VerticalJoystickReceived,   0, 255, ServoMIN_V , ServoMAX_V);
    Serial.print("HorizontalServoPosition : ");
    Serial.print(HorizontalServoPosition);
    Serial.print("  VerticalServoPosition : ");
    Serial.println(VerticalServoPosition);
    // tell servos to go to position
    HorizontalServo.write(HorizontalServoPosition);
    VerticalServo.write(VerticalServoPosition);
    delay(25);                      // wait for the servo to reach the position
  }
}// END Main LOOP


 

 
 

#include <WProgram.h>

RcTractorwizard May 5, 2015

I copied and pasted the receiver sketch into my IDE and I get the error compiling message
Arduino: 1.6.3 (Mac OS X), Board: "Arduino Uno"

In file included from sketch_may04a.ino:28:0:
/Users/Adam/Documents/Arduino/libraries/SoftwareServo/SoftwareServo.h:4:22: fatal error: WProgram.h: No such file or directory
#include <WProgram.h>
^
compilation terminated.
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

an suggestions would be greatly appreciated!

best regards
ADAM

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

  • ShahBaz

راه اندازی ماژول وایرلس nRF24L01 و سروموتور با اردوینو

ShahBaz | سه شنبه, ۲۷ مرداد ۱۳۹۴، ۱۱:۵۶ ق.ظ

 

 

 

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 
 
y...es posible controlar 4 servos con potenciometros con este modulo.... yo no puedo hacerlo ya realize los codigos de TX y RX y solo funciona para dos!!! tal vez mi codigo este malo... alguien podria ayudarme a solucionarlo? gracias dejo los dos codigod para que los vean.

TX 

#include <SPI.h>
#include <nRF24L01.h> 

RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL; 
int msg[1]; 
int potpin_1 = A0; 
int val_1; 
int potpin_2 = A1; 
int val_2;
int potpin_3= A2;
int val_3;
int potpin_4= A3;
int val_4;

void setup(void)
{
radio.begin();
radio.openWritingPipe(pipe); 
Serial.begin(9600);
}
void loop() 
{
val_1 = analogRead(potpin_1);
val_1 = map(val_1, 0, 1023, 0, 127);
msg[0] = val_1;
radio.write(msg, 1);
Serial.print("Valor Val_1:");
Serial.println(val_1);
delay(300);

val_2 = analogRead(potpin_2);
val_2 = map(val_2, 0, 1023, 128, 255);
msg[0] = val_2;
radio.write(msg, 1);
Serial.print("Valor Val_2:");
Serial.println(val_2);
delay(300);

val_3 = analogRead(potpin_3);
val_3 = map(val_3, 0, 1023, 0, 127);
msg[0] = val_3;
radio.write(msg, 1);
Serial.print("Valor Val_3:");
Serial.println(val_3);
delay(300);

val_4 = analogRead(potpin_4);
val_4 = map(val_4, 0, 1023, 0, 127);
msg[0] = val_4;
radio.write(msg, 1);
Serial.print("Valor Val_4:");
Serial.println(val_4);
delay(300);
}



RX

#include <SPI.h>
#include <RH_RF24.h> 
 
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL; 
int msg[1]; 
int data; 
int pos1;
int pos2;
int pos3;
int pos4;
void setup()
{
servo1.attach(3); 
servo2.attach(7);
servo3.attach(5);
servo4.attach(6);
radio.begin();
radio.openReadingPipe(1,pipe); 
radio.startListening();
}
void loop()
{
if (radio.available())radio.read(msg, 1);
if (msg[0] <128 && msg[0] >-1)data = msg[0], pos1 = map(data, 10, 254, 7, 177),servo1.write(pos1);
if (msg[0] >127 && msg[0] <255)data = msg[0], pos2 = map(data, 10, 254, 9, 177),servo2.write(pos2);
if (msg[0] >127 && msg[0] <255)data = msg[0], pos3 = map(data, 10, 254, 9, 177),servo3.write(pos3);
if (msg[0] >127 && msg[0] <255)data = msg[0], pos4 = map(data, 10, 254, 9, 177),servo4.write(pos4);
}
 



 

nRF24L01 2.4GHz Radio/Wireless Transceivers How-To


Having two or more Arduinos be able to communicate with each other wirelessly over a distance opens lots of possibilities:
  • Remote sensors for temperature, pressure, alarms, much more
  • Robot control and monitoring from 50 feet to 2000 feet distances
  • Remote control and monitoring of nearby or neighborhood buildings
  • Autonomous vehicles of all kinds

These are a series of 2.4 GHz Radio modules that are all based on the Nordic Semiconductor nRF24L01+ chip. (Details) The Nordic nRF24L01+ integrates a complete 2.4GHz RF transceiver, RF synthesizer, and baseband logic including the Enhanced ShockBurst™ hardware protocol accelerator supporting a high-speed SPI interface for the application controller. The low-power short-range (200 feet or so)Transceiver is available on a board with Arduino interface and built-in Antenna for less than $3! See it here.

See: EXAMPLE SOFTWARE SKETCHES AT END OF PAGE:
See: NEW EXAMPLE: Radio link transmitting Joystick positions to a receive unit controlling X,Y Servos that follow the remote Joystick. Uses the RadioHead Library.
 

NOTE! Power Problems:

Many users have had trouble getting the nRF24L01 modules to work. Many times the problem is that the 3.3V Power to the module does not have enough current capability, or current surges cause problems. Here are suggestions:
  • Connect a .3.3 uF to 10 uF (MicroFarad) capacitor directly on the module from +3.3V to Gnd (Watch + and - !) [Some users say 10 uF or more..]
    • A separate 3.3V power supply (Maybe this one?)
    • A YourDuinoRobo1 Arduino compatible, which has an added 3.3V regulator (But maybe add a .1 uF capacitor on the radio module).
  • This is especially important if you are connecting the module with jumper wires.
  • If you design a printed circuit board that the module plugs into, add .1uf and 10uf capacitors close to the GND and 3.3V pins.
This is particularly noticeable when 3.3V power comes from a MEGA, Nano etc. that has only 50 ma of 3.3V power available. Newer boards like the YourDuinoRobo1 have 350 ma or more available and can run the high-power modules directly.
 

Range??

Range is very dependent on the situation and is much more with clear line of sight outdoors than indoors with effects of walls and materials. The usual distance quoted by different suppliers for the low-power version module with the single chip is 200 Feet or 100 Meters. This is for open space between units operating at 250KHz. Indoors the range will be less due to walls etc...

We suggest you test two units at your actual locations before making a decision. There are units with an Antenna Preamplifier for the receiver and transmitter power amplifier and external antenna. The range between that type unit and several low-power units will be better than between two low-power units. Every situation is a little different and difficult to get an exact number without actual tests.

Link to nRF24L01+ Data Sheet. You don't have to, but if you want to understand more about what you can do with this "little" radio, download the data sheet. In particular you may want to read pages 7-8-9 ( For Overview and Features), and page 39 (MultiCeiver, which allows 6 Arduinos to talk to a Primary Arduino in an organized manner). Fortunately the board-level products we have take care of many of the physical and electrical details and Antenna Impedance Matching etc., and this library takes care of lots of register initialization and operational details.

There are additional modules which add Transmitter power amplifiers and Receiver preamplifiers for longer distances.. up to 1 Km (3000 feet). See them all here. These modules use an external antenna which can be a simple directly-attached one or a cable-connected antenna with more gain or directivity. Here's what some of these look like:
nRF24L01-3.jpgnRF24L01-4.jpg

 

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 


On the left is the low-power version, with it's built-in zig-zag antenna. On the right you can see the pins sticking down (up in this photo) that connect to Arduino. Later we will show the pinout.

nRF24L01-LN-PA-2.jpgnRF24L01-LN-PA-1.jpg
Above is the version with Transmit Power amplifier and Receive Preamplifier. Our low-cost antenna is on the unit shown on the right. The same 8 pins connect to Arduino and the same software is used.

Here's a link to a Home-Brew antenna design:

These transceivers use the 2.4 GHz unlicensed band like many WiFi routers, some cordless phones etc.

Transceivers like these both send and receive data in 'packets' of several bytes at a time. There is built-in error correction and resending, and it is possible to have one unit communicate with up to 6 other similar units at the same time.

These amazing low-cost units have a lot of internal complexity but some talented people have written Arduino libraries that make them easy to us. We have other pages that show examples and point to the free software libraries you may need. They all use the same pinout as shown in the following diagram, which is a TOP VIEW (Correction!):
24L01Pinout-800.jpg

NRF24L012_BottomView.jpg
BOTTOM VIEW
Here's details of the Pinout and connections to Arduino (updated):

Signal

RF Module

COLOR

Arduino pin for

RF24 Library

Arduino pin for

Mirf Library

MEGA2560 pin

RF24 Library

Arduino Pin for

RH_NRF24

RadioHead Library

MEGA2560 Pin for

RH_NRF24

RadioHead Library

GND

1

Brown

GND *

GND

GND *

GND *

GND *

VCC

2

Red

3.3V *

3.3V

3.3V *

3.3V *

3.3V *

CE

3

Orange

9

8

9

8

8

CSN

4

Yellow

10

7

53

10

53

SCK

5

Green

13

13

52

13

52

MOSI

6

Blue

11

11

51

11

51

MISO

7

Violet

12

12

50

12

50

IRQ

8

Gray

2 *

 

per library

N/C

N/C

 
  • NOTE!! Most * problems with intermittent operation are because of electrical noise on the 3.3V Power supply. The MEGA is more of a problem with this. Solution: ADD bypass capacitors across GND and 3.3V ON the radio modules. One user said, "Just Solder a 100nF ceramic cap across the gnd and 3.3v pins direct on the nrf24l01+ modules!" Some have used a 1uF to 10uF capacitor.
  • NOTE: Pin 8 IRQ is Unused by most software, but the RF24 library has an example that utilizes it.

The COLOR is for optional color-coded flat cable such as THIS. We'll add some photos soon showing easiest ways to cable these...

NOTE: These units VCC connection must go to 3.3V not 5.0V, although the Arduino itself may run at 5.0V and the signals will be OK. The NRF24L01+ IC is a 3.3V device, but its I/O pins are 5 V tolerant , which makes it easier to interface to Arduino/YourDuino.
Arduino UNO and earlier versions have a 3.3V output that can run the low-power version of these modules (See Power Problems at the top of this page!), but the high-power versions must have a separate 3.3V supply. The YourDuinoRobo1 has a higher power 3.3V regulator and can be used to run the high-power Power Amplifier type module without a separate 3.3V regulator.
 

nRF24L01 SOFTWARE AND LIBRARIES:


We will show an example of transmit and receive software below, and there are many examples on the RF24 Library download page. You will need a library of software to run the nRF24L01 radios. There are lots of details but you can ignore many of them that the library will take care of.

Get Maniacbug's excellent RF24 Library:
Download it HERE: (Click "Download ZIP" on the lower right of the page)
Once you have downloaded the ZIP, you should see a folder called RF24-master.ZIP. Change the name of this file to just RF24.ZIP. Double click on the ZIP and you should see a non-ZIP folder also called 
RF24-master. Rename this to just RF24 as well.

Then see our page about installing libraries HERE:
When you have the library installed, you can run the examples below.
 

 

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 

More Information on these pages:

RF24 Library and Examples: Many good details and more features like error correction and Networking.
RF24 Network System information: A many-node network under development
ManiacBug's Blog entry and discussion of the Network
 

RadioHead: A very full-featured Library with support for may different radios, not just nRF24L01:

http://www.airspayce.com/mikem/arduino/RadioHead/index.html

Mirf Library Example: A simpler demonstration



 

EXAMPLE ARDUINO SKETCHES:


Example: Transmit the position of a Joystick X and Y with one nRF24L01 to another nRF24L01 that will receive and display the Joystick position.


There are two sketches that you can cut and paste into a blank Arduino IDE windows and then save. Upload one to the Arduino that has an nRF24L01 connected, and the joystick or Potentiometers connected. Upload the other into an Arduino with an nRf24L01.


YD_nRF24L01_Transmit_JoyStick
 
/* YourDuinoStarter Example: nRF24L01 Transmit Joystick values
 - WHAT IT DOES: Reads Analog values on A0, A1 and transmits
   them over a nRF24L01 Radio Link to another transceiver.
 - SEE the comments after "//" on each line below
 - CONNECTIONS: nRF24L01 Modules See:
 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 9
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED
   - 
   Analog Joystick or two 10K potentiometers:
   GND to Arduino GND
   VCC to Arduino +5V
   X Pot to Arduino A0
   Y Pot to Arduino A1
   
 - V1.00 11/26/13
   Based on examples at http://www.bajdi.com/
   Questions: terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10
#define JOYSTICK_X A0
#define JOYSTICK_Y A1

// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe


/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/*-----( Declare Variables )-----*/
int joystick[2];  // 2 element array holding Joystick readings

void setup()   /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  joystick[0] = analogRead(JOYSTICK_X);
  joystick[1] = analogRead(JOYSTICK_Y);
  
  radio.write( joystick, sizeof(joystick) );

}//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

//NONE
//*********( THE END )***********


 


YD_nRF24L01_Receive_JoyStick
 

/* YourDuinoStarter Example: nRF24L01 Receive Joystick values

 - WHAT IT DOES: Receives data from another transceiver with
   2 Analog values from a Joystick or 2 Potentiometers
   Displays received values on Serial Monitor
 - SEE the comments after "//" on each line below
 - CONNECTIONS: nRF24L01 Modules See:
 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 9
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED
   
 - V1.00 11/26/13
   Based on examples at http://www.bajdi.com/
   Questions: terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10

// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe


/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/*-----( Declare Variables )-----*/
int joystick[2];  // 2 element array holding Joystick readings

void setup()   /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);
  delay(1000);
  Serial.println("Nrf24L01 Receiver Starting");
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();;
}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  if ( radio.available() )
  {
    // Read the data payload until we've received everything
    bool done = false;
    while (!done)
    {
      // Fetch the data payload
      done = radio.read( joystick, sizeof(joystick) );
      Serial.print("X = ");
      Serial.print(joystick[0]);
      Serial.print(" Y = ");      
      Serial.println(joystick[1]);
    }
  }
  else
  {    
      Serial.println("No radio available");
  }

}//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

//NONE
//*********( THE END )***********




Another interesting example: Chat between radios:
https://github.com/stanleyseow/RF24/tree/master/examples



---------------------( COPY: Post for people having nRF24L01 Problems )---------------------

nRF24L01 Intermittent / No operation.

ALWAYS check 3.3V power. Many times intermittent operation is due to power supply regulation issues. Even though the average current may be less than 15ma, apparently there are quick transients when each transmit burst happens.
I used to have nRF24L01 problems. Worked one day / one minute, failed the next. Now I put a 1uf to 10uf capacitor right from GND to 3.3V pins on the modules, and things are MUCH better.

These modules are designed to plug into a baseboard that usually has significant bypass capacitors. If you have them on the end of jumper wires you need extra bypass capacitors.
Try it and let us know here!
-----------------( END COPY )----------------------

 

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 

 

 
 
 

Hit and miss transmissions fixed !!!

dadeeoh Jun 13, 2015

ARG! I meant to start a new discussion. How do you delete/edit a comment? Anyway ...

I spent a long night troubleshooting my hit and miss transmissions. My program takes one character from serial input and transmits it. If I typed fast, about half of the characters made it. I tried several capacitors and a couple of different power supplies to no avail.

Finally, I threw in a radio.powerUp() immediately before the radio.write. It fixed 99.9% of my problems. Adding a 3 millisecond delay between the powerUp and write fixed the other 0.1%.

None of the sample code I've looked at requires this. Is there a "Delay after powering up/before sending" setting I'm missing? Maybe it's still a power supply problem and this just works around the spike?

Here's what I ended up with ...

radio.powerUp();
delay(3);
writeSuccess = radio.write( incomingByte, sizeof(incomingByte) );

Thanks!

Disclaimer: My background is in programming ... I'm just learning about electronics.

 

No communication

bramwerbrouck Apr 22, 2015

Hi, I have 2 different modules both connected to an arduino Nano, one is a NRF24L01+PA+LNA SMA Antenna Wireless Transceiver communication module 2.4G 1100m, the other one is an Arduino NRF24L01+ 2.4GHz Wireless Transceiver Module, but I have no communication with each other, when I take 2 of the Arduino NRF24L01+ 2.4GHz Wireless modules, than I have communication... What's wrong here?
I use the sketch "YD_nRF24L01_Transmit_JoyStick" and "YD_nRF24L01_Receive_JoyStick"

 

Using this library for TI Launchpads

noobtechie Apr 8, 2015

Hi, I have a TI Tiva C Launchpad which uses Energia an Arduino fork. Is it possible to use the Mirf library with the Energia IDE?

 

If nRF24L01 not working

Uldis.s Mar 30, 2015

Hi!
I had a problem, when nRF24L01 not working. Tried to add cap between Vcc and GND, but still no succsess. So, I added another one 0.1uF between antenna and GND (see picture). In my board there is a empty pads, and it helps!

https://lh3.googleusercontent.com/-O_-IePs63yM/VRo3YwbylnI/AAAAAAAABHQ/_2gduPOBWRg/w958-h719-no/2015-03-31%2B08.53.18.jpg

 

Sending a String

Josu_Arduino Mar 26, 2015

Hi there! I´m new with the nRF24L01 transceivers and in my code I need to send a string from an Arduino to another one. I tried to change the radio.write( string, sizeof(string) ) but it didnt work at all. Can someone help me and expalin how does the radio.write function works? Thank you very much.

 

programming code not working

mistercrazyboy21 Jan 4, 2015

he, 
I just copied your joystick code and added the library in arduino but now the code doesn't compile because 'RF24 doesn't name a type'. 
thank you :D

 
RukLo Jun 24, 2015

hi, could you fix this problem?

RukLo Jun 24, 2015

hi, could you fix this problem?

 

Can you tell me how the ones listed in the link compair to this link?

Lee_lvd Nov 6, 2014

http://www.dx.com/p/nrf24l01-2-4ghz-wireless-transceiver-module-126467
I ordered these thinking they would be easy to use and finding they are not 802 wireless as I thought they were. I have learned a lot but I have not even powered the pair of these up so far.

 

Intermittent receive, improved capacitor fix

chrisc28 Oct 30, 2014

Like many, I was having issues with poor reception of packets. Thanks to this HowTo for finally cluing me into the cause. I tried a 0.1uF SMD ceramic cap soldered directly to the VCC/GND header pins of the nRF24L01+ module. This improved things slightly, at least letting me know I was on the right track. Increasing the value in increments, each increase showed further improvement, but I was still getting about 40% packet loss even at 47uF. I must have a particularly noisy power supply! So I decided to try a different approach than increasing the cap value even further. In fact, I decreased the cap to 10uF, but also connected VCC and GND from the radio module to the main board through a pair of 1 ohm resistors. This forms an RC filter, more effectively reducing noise entering the module than any reasonably-sized cap alone could. I'm happy to say reception is finally rock solid. I just joined to share this, and am not familiar with wiki editing, but perhaps this may be helpful enough to others that someone might consider adding it to the guide.

 

Can I plug the receiver into different pins?

barnettech Sep 20, 2014

I'm trying to get this to work with a Zumo Shield and the 9,10,11,12, and 13 pins are already taken on the Ardruino Uno Board, can I plug it instead into pins 1-5 ?

 
Josu_Arduino Mar 26, 2015

I dont know if you can do that. Can you change the pins which are already taken? That may be an option, I hope i had helped you

 

Best wireless routers

phanajan Apr 10, 2014

Best wireless routers 
[url=http://www.bestwirelessrouterrewiews.com]best wireless router[/url]

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

 

 

  • ShahBaz

Connecting and programming nRF24L01 with Arduino and other boards

ShahBaz | دوشنبه, ۲۶ مرداد ۱۳۹۴، ۱۰:۱۲ ب.ظ
Discovering Arduino and fascinating world of electronics

Connecting and programming nRF24L01 with Arduino and other boards

Posted: December 4th, 2014 | Author:  | Filed under: howto | Tags: , ,  | 21 Comments »

Connecting nRF24L01 and Arduino

Now, when we know nRF24L01 module pinout we can now connect it to Arduino or some other board. Just connect pins on the same name on Arduino board and nRF24L01 wireless module:

Connecting nRF24L01 and Arduino

Connecting nRF24L01 and Arduino4

Schematic is very universal and  fits for all the Arduino’s: UNO, DUE, MEGA, Leonardo, Yun etc. (Arduino 1.0 (R3) standard, but also with older boards)

SPI signals are in the ICSP connector. For connecting we suggest using female/female jumper wires (type FF). The rest of the signals can be connected using a female/male jumper wires (type FM).

Connect power pins from nRF to Arduino as shown below:

nRF24L01 ARDUINO
VCC 3.3V
GND GND

CE and CSN pins can be connected to any digital pins. Then in RF24 library, you can specify which pins you used. I chose pins 7 and 8 because I will use them in the examples.

On Arduino UNO boards SPI pins are connected with some digital pins. While using modem you most remember that these digital pins won’t be available.

  •     MOSI is connected to the digital pin 11
  •     MISO is connected to the digital pin 12
  •     SCK is connected to the digital pin 13
  •     SS (not used, but also blocks) is connected to the digital pin 10

The Arduino MEGA 1280 and 2560 have a similar situation.

  •     MOSI is connected to the digital pin 51
  •     MISO is connected to the digital pin 50
  •     SCK is connected to the digital pin 52
  •     SS is connected to the digital pin 53

On the Arduino DUE, Yun and Leonardo SPI pins are on ICSP connector, and are independent 

of the digital pins.

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

Programming nRF24L01

Having module connected, we need to program it. First program you probably know, we’ll make traditional “Hello World”.

We will make one device (with the modem), will send the string to the other device. The second device will send the received string to a stationary computer and them will display it in the Arduino Serial Port Monitor.

In this project we used RF24 library, which can be found on Github: RF24 library on Github.You only need to click on “Download ZIP” button and it’ll start downloading all necessary things.  You can install the library in Arduino IDE using Sketch-> Import library-> Add library. Another way is to extract the zip file to your Arduino home directory: Arduino/libraries on Linux or Documents/ Arduino/libraries in Windows.

Transmitter program will look like:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8);

const byte rxAddr[6] = "00001";

void setup()
{
  radio.begin();
  radio.setRetries(15, 15);
  radio.openWritingPipe(rxAddr);
  
  radio.stopListening();
}

void loop()
{
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  
  delay(1000);
}

At the beginning of the sketch we infrom the program that we’ll use libraries.

  • SPI.h – to handle the communication interface with the modem
  • nRF24L01.h – to handle this particular modem driver
  • RF24.h – the library which helps us to control the radio modem

Next, we need to create an object called “radio

RF24 radio(7, 8);

This object represents a modem connected to the Arduino. Arguments 7 and 8 are a digital pin numbers to which signals CE and CSN are connected. If you have connected them to other pins can change this arguments. Then I create a global array called “rxAddr“.

const byte rxAddr[6] = "00001";

In this array we wrote the address of the modem, that will receive data from Arduino. Address has value “00001”, but if you want you can change it to any other 5-letter string. The address is necessary if you have a few modems in the network, thanks to the address, you can choose a particular modem to which you are sending the data. In the “setup” function we call the method “radio.begin ();” . It activates the modem.

Next we call “radio.setRetires(15, 15);” function. It shows how many times the modem will retry to the send data in case of not receiving by another modem. The first argument sets how often modem will retry. It is a multiple of 250 microseconds. 15 * 250 = 3750. So, if the recipient does not receive data, modem will try to send them every 3.75 milliseconds. Second argument is the number of attempts. So in our example, modem will try to send 15 times before it will stop and finds that the receiver is out of range, or is turned off.

The method of “radio.openWritingPipe (rxAddr);” sets the address of the receiver to which the program will send data. Its argument is an array previously made with the receiver address.

The last method in the “setup” function is “radio.stopListening ();“. It switch the modem to data transmission mode.

In the “loop” function, we start with creating a string that we want to send using modem.

const char text[] = "Hello World";

It’s an array of characters/letters to which we assigned a “Hello World” text. Then, using the method of “radio.write (& text, sizeof (text));” we send text through the radio to the modem (the address of the modem was set up earlier using “openWritingPipe”). First argument is an indication of the variable that stores the data to send. That’s why we used  “&” before the variable name, so we can make an indicator from this variable. The second argument is the number of bytes that the radio will take from a variable to be sent. Here we used the function “sizeof ()“, which automatically calculates the number of bytes in a “text” string.

Through this method, you can send up to 32 bytes at one time. Because that is the maximum size of a single packet data modem. If you need confirmation that the receiver received data, the method “radio.write” returns a “bool” value. If it returns “true” , the data reached the receiver. If it returns “false” this data has not been received.


The “radio.write” method blocks the program until it receives the acknowledgment or until you run out of all attempts to transmit established methods set in “radio.setRetires“.


The last part of the “loop” function is “delay (1000);“. It blocks the program for 1000 milliseconds, or one second. It makes the program will sent “Hello World” every second to 

the receiver.

دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

The receiver

The program of the receiver in the second modem device will look like this:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8);

const byte rxAddr[6] = "00001";

void setup()
{
  while (!Serial);
  Serial.begin(9600);
  
  radio.begin();
  radio.openReadingPipe(0, rxAddr);
  
  radio.startListening();
}

void loop()
{
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    
    Serial.println(text);
  }
}

The program looks quite similar to the program of the transmitter. First we selected libraries which will be used and then we creates a “radio” object with selected control pins. In the next line you can see a table with the address of the receiver – the same as in the transmitter. At the beginning of the “setup” function we set the object “Serial” for communication Arduino  with the computer.

while (! Serial);

This part is waiting for the Arduino USB port switches to serial COM port when You connect USB cable. That is true for Arduino with ATmega32u4 – like Leonardo, for ATmega328 based boards, which have separate chip for USB/Serial communication Serial is available always. The method of “Serial.begin (9600);” sets the baud rate with the computer via USB / COM.

The next part of the function is to set the nRF24L01 modem. Like before we used “radio.begin ();” method. The next line of the program is “radio.openReadinPipe (0, rxAddr);“, which determines the address of our modem which receives data. The first argument is the number of the stream. You can create up to 6 streams that responds to different addresses. We created only address for the stream number 0. The second argument is the address to which the stream will react to collect the data. In this example we set the address assigned to a “rxAddr” array.

The next step is to enable receiving data via modem using the method “radio.startListening ();“. From that moment the modem waits for data sent to the specified address. In the “loop” function, program performs the following operations. First checks whether any data have arrived at the address of the modem using the method “radio.available ();“. This method returns a “true” value if we received some data, or “false” if no data.

char text[32] = {0};

If the data was received, then it creates a 32-element “char” type array called “text” and filled with zeros (later the program will fill it with the received data). To read the data we use the method “radio.read (& text, sizeof (text));“. The first argument is an indicator of the variable to which you want to save the data received by the modem. To present a variable as an indicator we applied the “&” character in front of its name. The second argument is the amount of data to be stored in a variable. Here, we again have used the “sizeof ()” function, which automatically calculates the size of the “text” array.

When data is received, it send’s it to the “Serial.println (text);” method. Then the received text is being sent to a computer, where you can see it in the “Serial Port Monitor” using the Arduino IDE.  If you did everything ok and there are no mistakes in connections, you should see the same values in your Serial Port Monitor:

Serial Port Monitor showing communication

Serial Port Monitor showing communication

Stay tuned for next articles. We have connected nRF24L01 with Arduino,  we will coverTeensy 3.1 and smaller µc like ATtiny



دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی


21 Comments on “Connecting and programming nRF24L01 with Arduino and other boards”

  1. 1
    Kumaran said at 16:27 on February 3rd, 2015:

    I was having problem with NRF24 for almost 2 weeks now (Arduino and Raspberry Pi). This is due to many misleading information out there that doesn’t work or confusing or too much information that not required for basic “Hello World” program.

    After spending lots of time trying sample scripts that doesn’t work, I was almost gave up. Finally, found your website with super simple script and worked like charm on first attempt.

    Your graphical guide (clean and clear) helps a lot in getting the pins connected without mistakes.

    Step by step explanation on script lines helps to understand it’s function more clearer. In fact it’s a great “Hello World” tutorial that everyone can get started without issue.

    Now only I know that only few lines of codes needed and it’s enough to test NRF24 “Hello World” program.

    Keep up your good work. Thank you.

  2. 2
    nettigo said at 18:19 on February 3rd, 2015:

    Hi Kumaran,
    We are glad You found these posts useful :)
  3. 3
    Joseph Chrzempiec said at 00:09 on February 18th, 2015:

    Hello i tried your sketch and it works thank you. But the problem I’m having is that the delay receiving it on the serial monitor is very slow it’s like instead of 1 second i get like a 5 second delay. i try to take out the delay that seems to go faster but then i get instead of a hello world once i get it like 3 times at once. can someone please help me out? thank you.

  4. 4
    nettigo said at 12:49 on February 19th, 2015:

    @Jospeh
    Hard to say what is wrong.

    If there are radio interferences nrf makes few tries to send – maybe this is the case? Something is interfering – can You make test in another environment?

    Second guess is that after some work we find that Mirf library (https://github.com/stanleyseow/arduino-nrf24l01 ) is much better in terms of stability. We will write some examples in future, but right now You can take a look at codehttps://github.com/nettigo/TinnySensorModule This sketch is for ATtiny84, but inside is folder with code for UNO to receive data.

  5. 5
    Luke said at 03:42 on March 12th, 2015:

    Hi, I tried your code and it works for one or two lines but then it starts outputting gobbeltygook forever.

    I’m not sure what’s going on here. At first I had the pins you point out as 7 and 8 as 9 and 10 so I changed them to 7 and 8 but it does the same thing.

  6. 6
    nettigo said at 15:22 on April 2nd, 2015:

    @Luke
    So it works, first two times and later goes bananas? Frankly I don’t have idea… You use exactly code as in examples on our blog?
  7. 7
    Topcorner said at 18:39 on April 14th, 2015:

    new to all this – getting ARduino IDE 1.6.3 compile error shown below. I have a feeling something is pointing to the wrong area so it is not picking up all the libraries but cannot figure it out. I’ve tried changing the in the include statements to “xxx” but no change. Would greatly appreciate any help you can offer.

    Arduino: 1.6.3 (Windows 7), Board: “Pro Trinket 3V/12MHz (FTDI)”

    Using library SPI in folder: C:\Users\Top\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\libraries\SPI
    Using library RF24-master in folder: C:\Users\Top\Documents\Arduino\libraries\RF24-master (legacy)

    C:\Users\Top\AppData\Roaming\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino2/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=12000000L -DARDUINO=10603 -DARDUINO_AVR_PROTRINKET5FTDI -DARDUINO_ARCH_AVR -IC:\Users\Top\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino -IC:\Users\Top\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\variants\eightanaloginputs -IC:\Users\Top\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\libraries\SPI -IC:\Users\Top\Documents\Arduino\libraries\RF24-master C:\Users\Top\AppData\Local\Temp\build8004962604088768678.tmp\RF24_Hello_World_tx.cpp -o C:\Users\Top\AppData\Local\Temp\build8004962604088768678.tmp\RF24_Hello_World_tx.cpp.o
    RF24_Hello_World_tx.ino: In function ‘void setup()':
    RF24_Hello_World_tx.ino:13:31: error: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘uint64_t {aka long long unsigned int}’ [-fpermissive]
    In file included from RF24_Hello_World_tx.ino:3:0:
    C:\Users\Top\Documents\Arduino\libraries\RF24-master/RF24.h:324:8: error: initializing argument 1 of ‘void RF24::openWritingPipe(uint64_t)’ [-fpermissive]
    void openWritingPipe(uint64_t address);
  8. 8
    nettigo said at 19:05 on April 14th, 2015:

    Hi!
    Thank You for trying our examples. RF24 was our first choice when we started projects with nRF modules, however now we prefer https://github.com/aaronds/arduino-nrf24l01 Mirf library. Less features but more stable.

    These errors are related to changes in newer IDE and compiler. I think if You fallback to 1.5.x it will work.

    We plan to rewrite examples to Mirf library using newer IDE, but I can not give any estimate when it can happen.

  9. 9
    Topco said at 19:37 on April 14th, 2015:

    Thank you for the info. I’ll keep plugging away at it.

  10. 10
    Ed said at 00:05 on April 15th, 2015:

    Since NRF24l01 sends max of 32 bytes at a time, how do you go about sending a set of information that has 150 bytes?

    What if instead of test you are sending numbers?

    I am trying to send a bunch of data from some sensors.

    Thanks

  11. 11
    nettigo said at 22:19 on April 23rd, 2015:

    @Ed
    There is no support for that AFAIK, Your software has to split message into smaller chunks and put them back on the other side…
  12. 12
    Maciek said at 18:58 on May 2nd, 2015:

    Nie działa. Ani na Arduino IDE 1.0.5-r2, ani na 17.2
    radio.openReadingPipe(0, rxAddr);

    sketch_may02c.ino: In function ‘void setup()':
    sketch_may02c:15: error: invalid conversion from ‘const byte*’ to ‘uint64_t’
    sketch_may02c:15: error: initializing argument 2 of ‘void RF24::openReadingPipe(uint8_t, uint64_t)’
  13. 13
    spikes556 said at 01:41 on May 14th, 2015:

    I was having trouble with the Arduino Micro and the NRF24l01. I found the solution on this web page

    http://minspan.blogspot.com/2014/06/nrf24l01-rf24-radio-on-arduino-micro.html

    Basically, the ICSP are not hooked up or hooked up wrong. You will have to use pin 11 for MISO, pin 9 for SCK, pin 10 for MOSI. The mentioned website explains it further.

  14. 14
    Divyesh said at 02:22 on May 16th, 2015:

    Hello,

    Very nice and simple Hello world example. It is pretty useful as a beginner.

    No I have a question for you. Have tried to set a network of more than one nrf24l01?

    i am working on the project where I am making a network4 nrf24l01 transceivers, such that one can broadcast the text message from one transceiver at the base station to all the other transceivers connected to it. After receiving the message, the transceiver should reply back to the base station in same manner.

    I need your some guidance in the coding. What should be the code at base station and what could be the code at other node?

    Please help..It’s urgent!!!

    Thank you

  15. 15
    afzal rehmnai said at 07:56 on May 24th, 2015:

    can u post the schemetics for the both the transmitter and the reciever i am confused ….

    should i use 2 arduino and 2 nrfl01 for communications ????? plz help some

  16. 16
    TeDe123 said at 09:38 on June 11th, 2015:

    Hi,

    Thanks a lot for this tutorial. It’s great and probably the best in whole web.

    I’ve run this exaple on my Arduino Due boards. I’ve just needed to write #define RF24_DUE in the code to make it works. Everything is correct and i am sending and receiving messegas on my boards.

    Now I have to use the nrf24lo1 transmission with my usb host shield which uses SPI too. Does somebody knows how to initialize SPI in code for two devices – usb host shield and nrf24l01 in this case, (maybe some hardware changes are needed?)

    I found the information in datasheet that shield uses pin 10 as a CS PIN, so i’ve changed it for nrf to pin 4. When i did that and stopped using port 10 for nrf24l01 my program doesn’t work anymore. I cannot even write anything on terminal using Serial.println() function.

    If i use pin 10 for nrf CS again Serial port works, but nrf transmission doesn’t work.

    Maybe somebody could help me.

  17. 17
    AhmarSultan said at 12:48 on June 12th, 2015:

    I have an UNO and on the other hand a MEGA. The UNO works fine as a transmitter when I connect it with an external power supply where the MEGA is connected as the receiver to the computer. But when i do the vice versa of it (MEGA as transmitter and UNO as receiver) and i connect MEGA to the external power supply, no packets are received and no change is captured. Can you suggest me a solution to my problem?

    I will be grateful.
    Thanks.
  18. 18
    Brian said at 23:49 on July 12th, 2015:

    These instructions worked great!

    I have the ADDICORE nRF24L01+ kit and had this running within an hour. The kit comes with Male-Female connectors so it was easier to connect from the RF board to the Arduino on the digital input pins (11, 12, 13) instead of the ICSP pins.

    How do I send numeric data? I need to send a byte, not text.

    Thanks in advance to whoever can post some simple Arduino code to answer this question.

  19. 19
    Brian said at 13:40 on July 13th, 2015:

    I figured out one way to send a number instead of a string:

    //define
    byte msg[1];

    void loop()
    msg[0] = any_byte_number;
    radio.write(msg, 1);
  20. 20
    Dario said at 14:53 on July 13th, 2015:

    Hi!
    Your explanation is complete and straightforward, much more than any other confusing website on the web

    Thanks a lot!

  21. 21
    Hiloliddin said at 19:28 on August 10th, 2015:

    Hello

    I have error in compiling here:

    radio.openWritingPipe(rxAddr);

    error message is here:

    Arduino: 1.6.6 Hourly Build 2015/08/07 05:34 (Windows 8.1), Board: “Arduino Uno”

    transmittr.ino: In function ‘void setup()':
    transmittr:15: error: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘uint64_t {aka long long unsigned int}’ [-fpermissive]
    In file included from transmittr.ino:5:0:
    C:\Users\a\Documents\Arduino\libraries\RF24/RF24.h:324:8: error: initializing argument 1 of ‘void RF24::openWritingPipe(uint64_t)’ [-fpermissive]
    void openWritingPipe(uint64_t address);
    ^
    invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘uint64_t {aka long long unsigned int}’ [-fpermissive]

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

    can help please

    thanks

  • ShahBaz

راه اندازی ماژول وایرلس nRF24L01 با اردوینو

ShahBaz | يكشنبه, ۲۵ مرداد ۱۳۹۴، ۱۱:۳۳ ب.ظ



nRF24L01 Wireless Module with Arduino

Now we have a demo show how to use the Arduino controlling the nRF24L01 module , and you need two Arduino boards and two modules, one to transmit and the other receive. The connection of two part is the same but the different software.

The nRF24L01 module is worked at 3V voltage level , so the Arduino 5V pins may destroy it , so we need to add some resister to protect the module – using the 10K and the 15K resister to reduce the voltage is a usual method.

Connect the module pins to Arduino as below:
CS – D8 , CSN – D9 , SCK – D10 , MOSI – D11 , MISO – D12 , IRQ – D13
 

Download the code below into the TX Arduino  (transmit) — This code will drive the nRF24L01 module to send out data form 0×00 to 0xFF .
void setup()
{
  SPI_DIR = ( CE + SCK + CSN + MOSI);
  SPI_DIR &amp;=~( IRQ + MISO);
  Serial.begin(9600);
  init_io();
  TX_Mode();
}
void loop()
{
  unsigned char status=0;
  unsigned char key=0;
  for(;;)
  {
    tx_buf[1]=key;
    key++;
    status=SPI_Read(STATUS);
    if(status&amp;TX_DS)
    {
      SPI_RW_Reg(FLUSH_TX,0);
      Serial.println(tx_buf[1],HEX);
      SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH);
    }
    SPI_RW_Reg(WRITE_REG+STATUS,status);
    delay(1000);
  }
 
}

Download the code below into the RX Arduino (receive) – This code will drive the nFR24L01 module to receive the data that transmit form the TX module and print it to serial port.

void setup()
{
  SPI_DIR = ( CE + SCK + CSN + MOSI);
  SPI_DIR&amp;=~ ( IRQ + MISO);
  Serial.begin(9600);
  init_io();
  RX_Mode();
}
void loop()
{
  unsigned char status=0;
  unsigned char key=0;
  for(;;)
  {
    tx_buf[1]=key;
    key++;
    status=SPI_Read(STATUS);
    if(status&amp;TX_DS)
    {
      SPI_RW_Reg(FLUSH_TX,0);
      Serial.println(tx_buf[1],HEX);
      SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH);
    }
    SPI_RW_Reg(WRITE_REG+STATUS,status);// clear RX_DR or TX_DS or MAX_RT interrupt flag
    delay(1000);
  }
}

Now power on both Arduino , and connect the RX one to PC via USB. Open the IDE serial port monitor , change the baud rate to 9600 bps , and you can see the data that received.

If you want to change Arduino pin connecting to module , just modify the define on the NRF24L01.h .

All the project here(include API.h and NRF24L01.h)

  nRF24L01 Demo code for Arduino (unknown, 4,705 hits)

You can fine the cables , resisters and the nRF24L01 module that used in the demo on our webshop.


http://blog.iteadstudio.com/nrf24l01-wireless-module-with-arduino/



دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی


NRF24L01 Radio 2.4GHz Transmitter Receiver On Arduino

Charles W. | May 4, 2014

NRF24L01 is a 2.4GHz wireless radio frequency module that can be used to transmit and receive data. This is a great wireless module suitable for short range 100m remote control at 250kbps data rate. Let us look at how to setup NRF24L01 radio frequency transmitter and receiver on the Arduino. For simplicity, let us pick a simple joystick module as the data source where we transmit the X and Y values of the joystick to the receiver via wireless radio frequency at 2.4GHz frequency band. We will have to setup the transmitter and receiver. There are 8 pins on the NRF24L01 RF module, with 2 power pins for the VCC and GND, the CE pin, SCN pin, SCK, MOSI, MISO and IRQ pin. Refer below for the hardware and software setups.

Setup NRF24L01 2.4GHz Radio Frequency Module On Arduino As Transmitter

To setup the NRF24L01 as transmitter on the Arduino, connect the VCC and GND of the module to 3.3v and GND on the Arduino respectively. The CE is connected to pin 9, the SCN is connected to pin 10, the SCK is connected to pin 13, the MOSI is connected to pin 11, the MISO is connected to pin 12 and the IRQ is left unconnected. The joystick module is powered by 5V and GND on the Arduino, while Horizontal (x axis) is set to A0 and Vertical (y axis) is set to A1 of Arduino, we leave the Select (Z axis for “1″ and “0″) unconnected.

NRF24L01 Transmitter

Our intention is to have the A0 and A1 analog pins to collect the X and Y values of the joystick, and send the data wirelessly via NRF24L01 module. Download the RF24 Library for NRF24L01, and write below sketch to be uploaded to the Arduino.

NRF24L01 Transmitter Sketch

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
#define JOYSTICK_X A0
#define JOYSTICK_Y A1

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN);
int joystick[2];

void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
}

void loop()
{
joystick[0] = analogRead(JOYSTICK_X);
joystick[1] = analogRead(JOYSTICK_Y);
radio.write( joystick, sizeof(joystick) );
}

Setup NRF24L01 2.4GHz Radio Frequency Module On Arduino As Receiver

To setup the NRF24L01 RF module as a receiver to sync the data at 2.4GHz band, setup a separate Arduino and NRF24L01 module as in the setup in below picture. Power up the NRF24L01 module with VCC  and GND connected to 3.3V and GND on the Arduino. The CE is connected to pin 9 on the Arduino, the SCN is connected to pin 10, the SCK is connected to pin 13, the MOSI is connected to pin 11, the MISO is connected to pin 12 and IRQ is left unconnected.

NRF24L01 Receiver

Upload the sketch below to the Arduino to open up the reading pipe, listen and read the joystick X and Y data wirelessly via radio frequency. The data is then serial printed and can be checked via the Serial Monitor on the Arduino software.

NRF24L01 Receiver Sketch

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN);

int joystick[2];

void setup()
{
Serial.begin(9600);
delay(1000);
Serial.println(“Nrf24L01 Receiver Starting”);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();;
}

void loop()
{
if ( radio.available() )
{
bool done = false;
while (!done)
{
done = radio.read( joystick, sizeof(joystick) );
Serial.print(“X = “);
Serial.print(joystick[0]);
Serial.print(” Y = “);
Serial.println(joystick[1]);
}
}
else
{
Serial.println(“No radio available”);
}

}

Check NRF24L01 Result Via Serial Monitor

Connect the receiver to the computer, open up the Arduino software and Serial Monitor, the X and Y data of the joystick shall be printed out as in below picture.

NRF24L01 Arduino Joystick Test Result

http://www.bashmodulo.com/arduino/nrf24l01-radio-frequency-transmitter-receiver-on-arduino/


دانلود آموزش فارسی  راه اندازی ماژول وایرلس NRF24L01

+کدهای گیرنده و فرستنده+کتابخانه+پاورپوینت توضیحات و شماتیک 

در قالب یک پروژه کاملا عملی

  • ShahBaz