Crazyradio 2.4Ghz nRF24LU1+ USB radio...
- DISCONTINUED
- On sale!
- -10%
NRF24L01P + PA + LNA Division for the ultra-long-distance data transmission, specially developed high-power and high sensitivity wireless module 2.4G ISM band NRF24L01P + PA + LNA wireless module to work in the license-free that can be point-to-point applications or be composed of a star network.
Digital transmission chip NRF24L01+ with the Division of Professional Design professional full two-way RF power amplifier high power PA and LNA chip, RF switches and band pass filters, makes effective communication distance greatly expand.
RF part, it has been done a lot of optimization matching debugging. The emission efficiency to achieve the highest harmonic minimum and make NRF24L01P + PA + LNA wireless module of RF interference to the external equipment reaches minimum, while not susceptible to interference from other devices.
NRF24L01P + PA + LNA wireless module integration is extremely high, the size is 41mm x 15.5mm to make conveniently embedded.
Package included:
1 x 1100 Meter Long Distance NRF24L01+PA+LNA Wireless Module With Antenna
Example Code:
/** ******************************************************************
** SPI-compatible **
** CS - to digital pin 8 **
** CSN - to digital pin 9 (SS pin) **
** IRQ - to digital pin 10 (IRQ pin) **
** MOSI - to digital pin 11 (MOSI pin) **
** MISO - to digital pin 12 (MISO pin) **
** CLK - to digital pin 13 (SCK pin) **
*********************************************************************/
#include <SPI.h>
#include "API.h"
#include "nRF24L01.h"
//***************************************************
#define TX_ADR_WIDTH 5 // 5 unsigned chars TX(RX) address width
#define TX_PLOAD_WIDTH 32 // 32 unsigned chars TX payload
unsigned char TX_ADDRESS[TX_ADR_WIDTH] =
{
0x34,0x43,0x10,0x10,0x01
}; // Define a static TX address
unsigned char rx_buf[TX_PLOAD_WIDTH] = {0}; // initialize value
unsigned char tx_buf[TX_PLOAD_WIDTH] = {0};
//***************************************************
void setup()
{
Serial.begin(9600);
pinMode(CE, OUTPUT);
pinMode(CSN, OUTPUT);
pinMode(IRQ, INPUT);
SPI.begin();
delay(50);
init_io(); // Initialize IO port
unsigned char sstatus=SPI_Read(STATUS);
Serial.println("*******************TX_Mode Start****************************");
Serial.print("status = ");
Serial.println(sstatus,HEX); // There is read the mode’s status register, the default value should be ‘E’
TX_Mode(); // set TX mode
}
void loop()
{
int k = 0;
for(;;)
{
for(int i=0; i<32; i++)
tx_buf[i] = k++;
unsigned char sstatus = SPI_Read(STATUS); // read register STATUS's value
if(sstatus&TX_DS) // if receive data ready (TX_DS) interrupt
{
SPI_RW_Reg(FLUSH_TX,0);
SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH); // write playload to TX_FIFO
}
if(sstatus&MAX_RT) // if receive data ready (MAX_RT) interrupt, this is retransmit than SETUP_RETR
{
SPI_RW_Reg(FLUSH_TX,0);
SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH); // disable standy-mode
}
SPI_RW_Reg(WRITE_REG+STATUS,sstatus); // clear RX_DR or TX_DS or MAX_RT interrupt flag
delay(1000);
}
}
//**************************************************
// Function: init_io();
// Description:
// flash led one time,chip enable(ready to TX or RX Mode),
// Spi disable,Spi clock line init high
//**************************************************
void init_io(void)
{
digitalWrite(IRQ, 0);
digitalWrite(CE, 0); // chip enable
digitalWrite(CSN, 1); // Spi disable
}
/************************************************************************
** * Function: SPI_RW();
*
* Description:
* Writes one unsigned char to nRF24L01, and return the unsigned char read
* from nRF24L01 during write, according to SPI protocol
************************************************************************/
unsigned char SPI_RW(unsigned char Byte)
{
return SPI.transfer(Byte);
}
/**************************************************/
/**************************************************
* Function: SPI_RW_Reg();
*
* Description:
* Writes value 'value' to register 'reg'
/**************************************************/
unsigned char SPI_RW_Reg(unsigned char reg, unsigned char value)
{
unsigned char status;
digitalWrite(CSN, 0); // CSN low, init SPI transaction
SPI_RW(reg); // select register
SPI_RW(value); // ..and write value to it..
digitalWrite(CSN, 1); // CSN high again
return(status); // return nRF24L01 status unsigned char
}
/**************************************************/
/**************************************************
* Function: SPI_Read();
*
* Description:
* Read one unsigned char from nRF24L01 register, 'reg'
/**************************************************/
unsigned char SPI_Read(unsigned char reg)
{
unsigned char reg_val;
digitalWrite(CSN, 0); // CSN low, initialize SPI communication...
SPI_RW(reg); // Select register to read from..
reg_val = SPI_RW(0); // ..then read register value
digitalWrite(CSN, 1); // CSN high, terminate SPI communication
return(reg_val); // return register value
}
/**************************************************/
/**************************************************
* Function: SPI_Read_Buf();
*
* Description:
* Reads 'unsigned chars' #of unsigned chars from register 'reg'
* Typically used to read RX payload, Rx/Tx address
/**************************************************/
unsigned char SPI_Read_Buf(unsigned char reg, unsigned char *pBuf, unsigned char bytes)
{
unsigned char sstatus,i;
digitalWrite(CSN, 0); // Set CSN low, init SPI tranaction
sstatus = SPI_RW(reg); // Select register to write to and read status unsigned char
for(i=0;i<bytes;i++)
{
pBuf[i] = SPI_RW(0); // Perform SPI_RW to read unsigned char from nRF24L01
}
digitalWrite(CSN, 1); // Set CSN high again
return(sstatus); // return nRF24L01 status unsigned char
}
/**************************************************/
/**************************************************
* Function: SPI_Write_Buf();
*
* Description:
* Writes contents of buffer '*pBuf' to nRF24L01
* Typically used to write TX payload, Rx/Tx address
/**************************************************/
unsigned char SPI_Write_Buf(unsigned char reg, unsigned char *pBuf, unsigned char bytes)
{
unsigned char sstatus,i;
digitalWrite(CSN, 0); // Set CSN low, init SPI tranaction
sstatus = SPI_RW(reg); // Select register to write to and read status unsigned char
for(i=0;i<bytes; i++) // then write all unsigned char in buffer(*pBuf)
{
SPI_RW(*pBuf++);
}
digitalWrite(CSN, 1); // Set CSN high again
return(sstatus); // return nRF24L01 status unsigned char
}
/**************************************************/
/**************************************************
* Function: TX_Mode();
*
* Description:
* This function initializes one nRF24L01 device to
* TX mode, set TX address, set RX address for auto.ack,
* fill TX payload, select RF channel, datarate & TX pwr.
* PWR_UP is set, CRC(2 unsigned chars) is enabled, & PRIM:TX.
*
* ToDo: One high pulse(>10us) on CE will now send this
* packet and expext an acknowledgment from the RX device.
**************************************************/
void TX_Mode(void)
{
digitalWrite(CE, 0);
SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_WIDTH); // Writes TX_Address to nRF24L01
SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH); // RX_Addr0 same as TX_Adr for Auto.Ack
SPI_RW_Reg(WRITE_REG + EN_AA, 0x01); // Enable Auto.Ack:Pipe0
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01); // Enable Pipe0
SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x1a); // 500us + 86us, 10 retrans...
SPI_RW_Reg(WRITE_REG + RF_CH, 40); // Select RF channel 40
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07); // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR
SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e); // Set PWR_UP bit, enable CRC(2 unsigned chars) & Prim:TX. MAX_RT & TX_DS enabled..
SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH);
digitalWrite(CE, 1);
} Related products