You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM band. The transceiver consists of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator, modulator and Enhanced ShockBurst™ protocol engine.

Output power, frequency channels, and protocol setup are easily programmable through a SPI interface. Current consumption is very low, only 9.0mA at an output power of -6dBm and 12.3mA in RX mode. Built-in Power Down and Standby modes makes power saving easily realizable.


Board

Image result for NRF24L01

Communicating with the Board

This board uses SPI, Serial Peripheral Interface.

The SPI bus specifies four logic signals:

  • SCLK: Serial Clock (output from master)
  • MOSI: Master Output Slave Input, or Master Out Slave In (data output from master)
  • MISO: Master Input Slave Output, or Master In Slave Out (data output from slave)
  • SS: Slave Select (often active low, output from master)

Hookup

Sample TX Code

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

/*
 * Sample Transmitter
 * 
 * CLK    14  
 * MOSI   13
 * MISO   12
 * CS     15
 * CE     8
 */

#define CE_PIN    8
#define CS_PIN    15

RF24 radio(CE_PIN,CS_PIN);
byte addresses[][6] = {"i8-00","I8-00"};
char buf[1];
int bufsize=1;


void setup() {
  Serial.begin(115200);
  Serial.println(F("\n\ni8 Tx Started"));
  Serial.println(F("*** PRESS 'B-G' to represent button"));
  
  radio.begin();

  // Set the PA Level low to prevent power supply related issues.
  radio.setPALevel(RF24_PA_LOW);

  radio.setRetries(15,15);
  radio.setPayloadSize(8);
  radio.setDataRate(RF24_1MBPS);
  radio.setAutoAck(1);                     // Ensure autoACK is enabled

  radio.openWritingPipe(addresses[0]);
  radio.stopListening();
  
}

void loop() {

  // process serial requests
  if ( Serial.available() )
  {
    char c = toupper(Serial.read());
    //'B', 'C', 'D', 'E', 'F', 'G'
    if(c >= 'B' && c <= 'G'){ 
      Serial.printf("> %c \n",c);
      
      buf[0]=c;    
      int v = radio.write(&buf, bufsize);
  
      buf[0]=tolower(c);    
      v = radio.write(&buf, bufsize);
    }
  }
  
} 



References

  • No labels