Reyax RYLR998 LoRa Module with Arduino.

Reyax RYLR998 LoRa Module with Arduino.

  • In this article we will learn about LoRa and also make a small home-Automation system using a Reyax LoRa RYLR998 Module.
  • Here LoRa stands for Long Range, LoRa is a wireless transmission protocol, and consume very low power and has very long range of transmission distance, we can transmit data near about 10km , Unlike WIFI and blue-tooth which has range of only few meters.
  • LoRa transmission range depends upon which type of LoRa module we are using, some module has range 100’s of kilometer.

  • LoRa modules are very small in size and available in a very cheap price, so we can use these LoRa modules in place of WIFI and blue-tooth modules , which are very expensive.
  • LoRa modules are very useful in remote locations where internet connection is not available.
  • In this article, I am going to use RYLR998 LoRa module from Reyax , which  can be easily control by AT Commands. and also I will make a small home-automation system by using this module with Arduino Uno & Nano Boards.

Configuring LoRa Module.

To use these modules in projects first we need to set frequency band, Network ID and address of transmitter and receiver, for that we have to connect these LoRa modules with our computer via USB to serial interface. 

Now connect FTDI232 Interface module with LoRa module as per schematic shown below.

  • VDD TO VCC.
  • GND TO GND.
  •  RX PIN OF LORA TO TX OF PIN OF FTDI232 MODULE.
  • TX PIN OF LORA TO RX PIN OF FTDI232 MODULE.

And one most important thing, On the FTDI232 module you have to select logic level 3.3.

After making the connection now connect the USB to serial interface module with your computer to set the parameters.

This is the LoRa AT command guide for Reyax LoRa module.

Now open Arduino ide, and then open tools, there  you have to select the right com port. After selecting port open serial monitor.

You have to select the baud rate 115200 which is default baud rate of LoRa modules

 and select both NL and CR.

let test it, Type AT and hit enter,  If you get +OK  response from module that’s means LoRa module is now communicating with our computer.

Now lets configure the parameters of the LoRa module, By using  AT command.

Type AT+ADDRESS=1 , this address 1 is for the transmitter and for the receiver it will be 2, 

You could give any address you want, Address could be in between  0 to 65000.

Type AT+NETWORKID=5 again you can give any number in between 3 to 15.

And this Network ID will be same for both transmitter as well as for receiver.

And in similar manner we have to configure the frequency band of this LoRa modules

and one most important thing there are some allowable frequency band which you can only use in wireless transmitter, to know the eligible band in your country just search on google , In my case it is Approx 865Mhz.

Type AT+BAND=865000000 and here we got ‘Ok’ that’s means band is successfully setup.

Schematics.

Transmitter Circuit.

Make the transmitter part of circuit as per the schematic shown below.

Receiver Circuit.

Make receiver part of circuit as per diagram shown below.

If you don’t have this PCB, Still you can make this project, just follow the below schematics.

Designing the PCB.

To design the circuit and PCB, we used EasyEDA which is a browser based software to design PCBs.

Designing the circuit works like in any other circuit software tool, you place some components and you wire them together. 

Then, you assign each component to a footprint.

Having the parts assigned, place each component. When you’re happy with the layout, make all the connections and route your PCB.

Ordering the PCBs at PCBWay.

This project is sponsored by PCBWay. PCBWay is a full feature Printed Circuit Board manufacturing service.

Turn your DIY breadboard circuits into professional PCBs – get 10 boards for approximately $5 + shipping (which will vary depending on your country).

Once you have your Gerber files, you can order the PCB. Follow the next steps.

1. Download the Gerber files – click here to download the .zip file.

2. Go to PCBWay website and open the PCB Instant Quote page. 

3. PCBWay can grab all the PCB details and automatically fills them for you. Use the “Quick-order PCB (Autofill parameters)”.

4. Press the “+ Add Gerber file” button to upload the provided Gerber files.

And that’s it. You can also use the Online Gerber Viewer to check if your PCB is looking as it should.

Now select the shipping method , the one you prefer and has cost efficient.

You can increase your PCB order quantity and change the solder mask color. I’ve ordered the Green color.

PCBWay has lots of other staggering solder mask, Now they can produce pink, orange, grey, even the transparent solder mask. 

Apart from this they also provide Black core PCB

Once you’re ready, you can order the PCBs by clicking “Save to Cart” and complete your order.

After approximately one week using the DHL shipping method, I received the PCBs at my place.

As usual, everything comes well packed, and the PCBs are really high-quality. 

The letters on the silkscreen are really well-printed and easy to read. Additionally, the solder sticks easily to the pads.

CODE.

Code for transmitter.

Download this transmitter part of code and upload to the transmitter part of circuit.

String lora_band = "865000000"; //enter band as per your country
String lora_networkid = "5";    //enter Lora Network ID
String lora_address = "2";      //enter Lora address
String lora_RX_address = "1";   //enter Lora RX address (for sending)

#define RelayPin1 10 
#define RelayPin2 11

String incomingString;

void setup()
{
  
  pinMode(RelayPin1, OUTPUT);
  pinMode(RelayPin2, OUTPUT);
  
  
  Serial.begin(115200);
   
  
  delay(1500);
  Serial.println("AT+BAND=" + lora_band);
  delay(500);
  Serial.println("AT+NETWORKID=" + lora_networkid);
  delay(500);
  Serial.println("AT+ADDRESS=" + lora_address);
  delay(1000);
  
}

void loop()
{ 
    if(Serial.available()) {
    incomingString = Serial.readString();
    //Serial.println(incomingString);
    if(incomingString.indexOf("FB") >0) {
        digitalWrite(RelayPin1, !digitalRead(RelayPin1));
      
    }
    if(incomingString.indexOf("RB") >0) {
         digitalWrite(RelayPin2, !digitalRead(RelayPin2));
      
      
    }
     
    
     
    }
    
    }

Code for Receiver.

Download this receiver part of code and upload to the receiver circuit of project.

String lora_band = "865000000"; //enter band as per your country
String lora_networkid = "5";    //enter Lora Network ID
String lora_address = "1";      //enter Lora address
String lora_RX_address = "2";   //enter Lora RX address

#define button1 8  
#define button2 9
   
void setup()
{
  // put your setup code here, to run once:
 // Serial.begin(9600);
  Serial.begin(115200);

  
  delay(1500);
  Serial.println("AT+BAND=" + lora_band);
  delay(500);
  Serial.println("AT+ADDRESS=" + lora_address);
  delay(500);
  Serial.println("AT+NETWORKID=" + lora_networkid);
 delay(1500);


  pinMode(button1, INPUT_PULLUP);
  pinMode(button2, INPUT_PULLUP);

}

void loop()
{
   if (digitalRead(button1) == LOW){
  Serial.println("AT+SEND="+ lora_RX_address +",2,FB");
  delay(50);
   }
    if (digitalRead(button2) == LOW){
  Serial.println("AT+SEND="+ lora_RX_address +",2,RB");
  delay(50);
   }   
}

Video Tutorial.

Leave a Reply

Your email address will not be published.