What is LoRa module?
Hi guys welcome back here and this is a LoRa module specifically the rylr896 from REYAX. LoRa stands for long range and I mean long as in up to and even more than ten kilometers of range this is with line of sight of course this insane range at low power requirements is not without issue though you are sacrificing speed as well as bandwidth by a lot so don't expect LoRa to replace your Wi-Fi anytime soon but that doesn't mean that you can't use it for most of the type IOT applications you may think of and that is exactly what I am going to show here. You guys can see from here, how you can use LoRa in your IOT projects.
What is LoRa and LoRaWAN?
Before we get started though I want to make one distinction clear to you guys and that is the difference between LoRa and Lora WAN. Lora WAN is a protocol developed by the LoRa Alliance which anybody can use to connect their LoRa enabled devices to the Internet. Similar to how your Wi-Fi enabled devices connect to your Wi-Fi router to access the Internet.
How is LoRa different from Wifi?
But unlike Wi-Fi Lora WAN uses LoRa gateways, works at way longer distances and for small bandwidth data. If you want to get more knowledge about what Lora WAN is then I will suggest you take a look at this video by Andreas he does a really good job of explaining it all but what I'll be showing you here is more like Bluetooth.
How do LoRa modules work?
We will connect two LoRa modules together in a point-to-point network to share data between the two. I'll show you how you can build a simple wireless switch that works at ridiculously long distances and you can expand upon that as you wish now this particular Laura module from REYAX uses UART for communication with your microcontroller that is the same protocol that you use to print to the serial monitor in Arduino.
It’s pretty simple you just use Serial.print () and send whatever you want to send but you do want to send to control this particular module are AT commands AT commands. If you aren't familiar with them are even simpler AT stands for attention like a drill sergeant you shout attention followed by whatever orders you want.
Reyax rylr896 LoRa Module setup –
To send just to demonstrate I'll connect one module to my PC using a USB to TTL converter just connect VCC to 3.3 volt ground-to-ground RX to TX & TX to RX opening a serial monitor at the board rate of 115200 you can send to it AT and like a good little private it will respond with an okay if you want to send a command you say AT plus whatever command you want to send like we can set this module's address to 115 press ENTER and it should return OK for successful execution now we just need to implement this in an Arduino sketch I have already written the sketches one for the transmitter and one for the receiver both of which you can download from the link in the description. I am NOT going to go through the code here because it's boring and no one wants to sit through that.
But I do want to point out a few key things, which you might want to take a note of when you write your own code number one each AT command needs to end with the \r\n this is equivalent to the pressing enter into your keyboard without this the module won't know when the command has ended second each module needs to be the set up before you use this is what the part of the code does you need to set the parameter the bandwidth the network ID and the address while the first three required to be the same for both the transmitter and the receivers the address needs to be unique for each number three to send data the syntax is AT plus send equals the address you want to send to comma the length of data you want to send in bytes comma the data you want to send here we are just sending 0 and 1 depending on what button is pressed whenever data is received it is printed directly into the serial.
The syntax of which is this so you need to look for the string starting with +RCV the part, which we are interested is in between the second and the third comma finally make sure to initialize the serial at 115200 baud rate which is the default rate you can also change it with an AT command if you so wish. After uploading the code to both the Arduino the wiring couldn't be simpler connect VCC to 3.3V RX to TX and from TX to Rx and ground to ground on the board with the transmitter code connect two push buttons to pin five and six the other end of those push buttons goes to ground on the receiver connect the LED between pin five and ground with a resistor power them both on give them a few seconds to complete the setup and now when you press the buttons the LED should switch States but the cool thing is that it works at really large distances before I leave you to play with this though I should mention that different frequencies are permitted in different countries so you should buy only the device that is compatible with your location and set the frequency accordingly this particular module allows for 868 or 915 megahertz which incidentally are allowed in most of the world hopefully this was helpful.