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

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

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

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

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

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

راه اندازی ماژول وایرلس 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 &=~( 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&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&=~ ( 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&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

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

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

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی