NRF24L01 2.4Ghz Wireless Module (NRF24L01) [S275]






https://www.youtube.com/watch?v=CVfX8fmW6Bk


GitHub : https://github.com/rdiot/rdiot-s275.git


* Specs

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. 

Maximum operating speeds up to 2Mbps, GFSK modulation efficiency, Anti-interference ability, Particularly suitable for industrial control applications. 

125 Communications channels, Multi-point communication and frequency hopping to meet the communication needs. 

Built-in hardware CRC error detection, Multipoint communication address control. 

Low-power 1.9 ~ 3.6V, only 1uA on Power down mode. 

Built-in 2.4Ghz antenna. 

Available software to set the address, only received local Address when output data(Provide interrupt instruction), can be directly connected to a variety of microcontrollers, Software programming is very convenient. 

Support 6 Data channels of data reception. 

Standard DIP Pitch Interface for embedded applications. 


* Contents

- Connect 


VCC - 3.3V

CSN - D8

MOSI - D11

IRQ - NONE

GND - GND

CE - D7

SCK - D13

MISO - D12


- parts

Rotary Encoder Module (KY-040) [S120]


- Library : https://github.com/nRF24/RF24

- Tested Library Download : RF24-master.zip



- Key Code

- RF24_TX : https://github.com/rdiot/rdiot-s275/blob/master/RF24_TX.ino

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>


LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display


RF24 radio(7, 8); // SPI Bus CE, CSN 

const byte address[6] = "00001"; // RX = TX same address

int pin = A0; // Rotary Encoder Module (KY-040) [S120] : http://rdiot.tistory.com/126 [RDIoT Demo]


void setup() {

  pinMode(pin, INPUT);

  

  Serial.begin(9600);

  

  radio.begin();

  radio.openWritingPipe(address);

  radio.setPALevel(RF24_PA_MIN); // Power Level : accoding to distance : RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX


  radio.stopListening();  // TX 


  lcd.init(); // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD1602");

  delay(1000);

  lcd.clear();

    

}


void loop() {

  lcd.setCursor(0,0);

  lcd.print("S275:RF24L01 TX");

  

  int readVal = analogRead(pin);

  readVal = map(readVal, 0, 1023, 0, 179);

  Serial.println(readVal);


  lcd.setCursor(0, 1);

  lcd.print("msg=>" + String(readVal) + "  ");

   

  char buf[4];

  itoa(readVal, buf, 10);

    

  radio.write(&buf, sizeof(buf)); //send messages to RX 

  delay(10);

  

}


- RX24_RX : https://github.com/rdiot/rdiot-s275/blob/master/RF24_RX.ino

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <SPI.h> 

#include <nRF24L01.h>

#include <RF24.h>

#include <Servo.h> 


LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display


RF24 radio(7, 8); // SPI Bus CE, CSN 

const byte address[6] = "00001"; // TX = RX same address


Servo myservo; 

int servoPin = 4; 


void setup() {


  Serial.begin(9600);

  

  radio.begin();

  radio.openReadingPipe(0, address);

  radio.setPALevel(RF24_PA_MIN); // Power Level : accoding to distance : RF24_PA_MIN / RF24_PA_LOW / RF24_PA_HIGH / RF24_PA_MAX


  radio.startListening(); // RX


  myservo.attach(servoPin); 


  lcd.init(); // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD1602");

  delay(1000);

  lcd.clear();

 

}


void loop() {

  lcd.setCursor(0,0);

  lcd.print("S275:RF24L01 RX");


  lcd.setCursor(0, 1);

  if (radio.available()) {    

    char text[4] = "";

    

    radio.read(&text, sizeof(text));

    Serial.println(text);

    

    lcd.print("rcv=>" + String(text) + "     ");


    int value = atoi(text);

     myservo.write(180-value);

  }


  delay(10);

  

}


- how to debug radio details 

#include <printf.h>


  printf_begin();

  radio.printDetails();





Posted by RDIoT
|

nRF905 Wireless Module 433,868,915Mhz (NRF905) [S117]



 


 

https://www.youtube.com/watch?v=IgzJsUzVhBk


GitHubhttps://github.com/rdiot/rdiot-s117.git


* Specs

Tri-band transceiver operating frequency for the international ISM band 433/868/915MHz GMSK modulation, anti-interference ability, especially for industrial control applications using the DSS + PLL frequency synthesizer technology, excellent frequency stability, high sensitivity, to achieve - 100dBm low operating voltage (2.7V), low power consumption, standby only 1uA maximum transmit power of +10 dBm with multiple channels (up to more than 170) meet the requirements for low-power devices, in particular, to meet the needs of multi-channel work of special occasions, the work rate up to 76.8 Kbps

External components of at least (10), the basic need to debug. Low transmit power and high receive sensitivity of the design, the use of the license required to apply for open use at distances up to 1000m and the specific use of the environment and component parameters.


Electrical Characteristics:

NRF905 work band: 433/868/915MHz

Channel number: 170

Function: transmitter / receiver

Frequency stabilization method: PLL

Modulation mode: the FSK / GMSK

Maximum output power: +10 dBm

Sensitivity:-100dBm

Maximum operating rate: 76.8Kbit / s

Working voltage :2.7 - 3 .3 V


Application areas:

Vehicle monitoring, remote control, telemetry, small wireless network, wireless meter reading, access control systems, residential paging, industrial data acquisition systems, wireless tags, identification, non-contact RF smart cards, small wireless data terminals, security, fire systems, wireless remote control system, bio-signal acquisition, hydrological and meteorological monitoring, robot control, wireless 232 data communications, wireless 485/422 data communications, digital audio, digital image transmission.


* Contents

 

 

 

- Connect

VCC ---- Power supply.
TXE ---- RF module mode selecting.
CE ---- Enable RF module for transmit and receive.
PWR ---- Power up chip.
CLK ---- Output clock, divided crystal oscillator full swing clock.
CD ---- Carrier detect.
AM ---- Address matched.
DR ---- Receive and transmit ready.
MISO ---- SPI master input slave output.
MOSI ---- SPI mater output slave input.
SCK ---- SPI clock.
CSN ---- SPI enable.
GND ---- Ground
GND ---- Ground

 

- KOR : 919.7Mhz, 921.7Mhz, 923.1Mhz


- Reference Source : http://www.electrodragon.com/wp-content/uploads/2011/11/NRF905-for-arduino.zip

 

- Changed Code Library

PROGMEM unsigned const int freq_tab[10] = {
 

- TX Source : https://github.com/rdiot/rdiot-s117/blob/master/nRF905_TX.ino

#include <NRF905.h>
#include <SPI.h>

#define BUF_LEN          32
#define CONF_LEN         10

#define NRF905_CSN       10

unsigned char tx_buf[BUF_LEN]= "RDIoT TX CNT:  \r\n";
unsigned char read_config_buf[CONF_LEN];

byte tx_address[4]= {0xcc,0xcc,0xcc,0xcc};

void setup()
{
    unsigned char i;
   
    pinMode(NRF905_CSN,OUTPUT); //to make sure SPI works
   
    nrf905=NRF905(NRF905_CSN);
   
    nrf905.init();


    /**
        default configuration, need to specify frequency
        choose Z-Wave frequency band, support :
        US  908.42Mhz
        EUROPE  868.42MHz
        AFRICA  868.42MHz
        CHINA  868.42MHz
        HK  919.82MHz
        JAPAN  853.42MHz
        AUSTRALIA 921.42MHz
        NEW_ZEALAND 921.42MHz
        BRASIL  921.42MHz
        RUSSIA  896MHz
    */
    nrf905.write_config(US);
 
 
    nrf905.read_config(read_config_buf);

    Serial.begin(9600);

    for(i=0; i<10; i++)
    {
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }
   
    tx_buf[12] = '0';
}

void loop()
{
    /** transmit data packet with default TX Address */
    nrf905.TX(tx_buf);
   
    /** transmit data packet with specified TX Address */
//    nrf905.TX(tx_buf, tx_address);
   
    // NOTE: TX_Address and RX_Address must be the same
   
    /** Count Sending times */
    tx_buf[12]++;
    if(tx_buf[12] == 0x3A){
      tx_buf[12] = '0';
    }
    delay(50);
}

 


 

- RX Source : https://github.com/rdiot/rdiot-s117/blob/master/nRF905_RX.ino

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#include <NRF905.h>
#include <SPI.h>
#define BUF_LEN          32
#define CONF_LEN         10

//NRF905 nrf905;

unsigned char rx_buf[BUF_LEN]= {0};
unsigned char read_config_buf[CONF_LEN];
unsigned char rx_address[4]= {0xcc,0xcc,0xcc,0xcc};
String str1="";

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display

void putstring(unsigned char *str)
{
   
    while(*str){
        str1 += char(*str++);
        //Serial.write(*str++);  
       
    }
}

void setup()
{
    char i;
    pinMode(10,OUTPUT);
    nrf905=NRF905(10);
   
    /** pin/port configuration */
    nrf905.init();

 
    /***************************************************
        default configuration, need to specify frequency
        choose Z-Wave frequency band, support :
        US  908.42Mhz
        EUROPE  868.42MHz
        AFRICA  868.42MHz
        CHINA  868.42MHz
        HK  919.82MHz
        JAPAN  853.42MHz
        AUSTRALIA 921.42MHz
        NEW_ZEALAND 921.42MHz
        BRASIL  921.42MHz
        RUSSIA  896MHz
    */
 nrf905.write_config(US);  
   
    /***********************************************************
 read register configuration, check register value written */
    nrf905.read_config(read_config_buf);
   
    /** serial communication configurate */
    Serial.begin(9600);
   
    /** test configuration */
    for(i=0; i<CONF_LEN; i++){
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }

  lcd.init();  // initialize the lcd
  lcd.backlight();
  lcd.print("start LCD2004");
 
  delay(1000);
 
  lcd.clear();
   
}

void loop()
{

    lcd.setCursor(0,0);
    lcd.print("S117:nRF905 RCV");
 
    /** recieve data packet with default RX address */
    nrf905.RX(rx_buf);
   
    /** recieve data packet with specified RX address */
    //    nrf905.RX(rx_buf, rx_address );
   
    // NOTE: TX_Address and RX_Address must be the same
   
    /** send recieved data to PC through serial port */       
    putstring(rx_buf);

    lcd.setCursor(0,1); 
    lcd.print(str1);
    str1 = "";
  
    delay(1);
}


 

Posted by RDIoT
|

MQTT + Kafka + Raspberry Pi ElasticSearch Cluster [P016]






https://www.youtube.com/watch?v=coKGRMDqAJk


* GitHub : https://github.com/rdiot/rdiot-p016


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea : for Kafka Cluster

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 4ea : for ElasicSearch Cluster

- USB Power Supply

- Ethernet Hub


* Contents

1. Raspberry Pi ElasticSearch Cluster Setup

- version : elasticsearch 2.4.6

- master config
 : 
https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-master-01.yml

- data node config 

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-01.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-02.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-03.yml




2. logstash configuration

https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-airGrade.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-cds.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-humidity.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-temperature.conf


3. start logstash script example

#!/bin/sh

export LS_HEAP_SIZE="500m"

/data1/logstash/logstash/bin/logstash -f /data1/logstash/logstash-kafka-elasticsearch-temperature.conf -l logstash.log &


4. Kafka logstash Monitoring


5. ElasticSearch data node shard


6. Grafana Setup

- Install in Raspberry Pi

$ sudo apt-get install libfontconfig

$ curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.0.1/grafana_4.0.1-1480722482_armhf.deb -o /tmp/grafana_4.0.1-1480722482_armhf.deb

$ sudo dpkg -i /tmp/grafana_4.0.1-1480722482_armhf.deb


$ sudo vi /etc/grafana/grafana.ini

# The ip address to bind to, empty will bind to all interfaces

http_addr = 192.168.0.20


$ sudo systemctl enable grafana-server

$ sudo systemctl restart grafana-server


- Connect Grafana WebAdmin

http://92.168.0.20:3000

id/pwd : admin/admin


- Add Data Sources : http://192.168.0.20:3000/datasources/new


- edit data source examples


7. Grafana Dashboard 

- Kafka-Sensor-Monitoring

 : Temperature, Humidity, Cds, AirGrade


Posted by RDIoT
|