How to connect SX1278 LoRa module with Arduino development board
Update Time: 2020-12-08 18:01:40
In 2020, there will be 2.5 billion devices connected to the Internet worldwide. With the rapid spread of the concepts of IoT and Industry 4.0, IoT cars, and smart cities, we already have some wireless protocols, such as BLE, Wi-Fi, Cellular, etc., but these technologies are not suitable for IoT sensor nodes because they need to Transmission of information over long distances without using too much power. Therefore, LoRa technology has emerged because it can perform ultra-long-distance transmission with low power consumption.
With the ESP module becoming synonymous with Wi-Fi applications, this LoRa technology also can build a huge network like the Internet. We have previously built many IoT-based projects using ESP8266 and Arduino, in this article we will learn about LoRa and how to use it with the Arduino development platform.And how to use the Arduino development board to connect the SX1278 LoRa module.
What is LoRa?
The term LoRa stands for long-distance and is a radio frequency technology introduced by Semtech. This LoRa technology can be used to transmit two-way information over long distances without consuming too much power. Remote sensors can use this attribute, and only need to operate a small battery to transmit data.
Under normal circumstances, Lora can reach a distance of 15-20km and can use the battery for many years. Please remember that LoRa, LoRaWAN, and LPWAN are three different terms and should not be confused with each other.
Understanding LoRa technology
In any typical IoT solution provided for warehouse management or on-site monitoring, hundreds of sensor nodes will be deployed in the field, and these nodes will monitor important parameters and send them to the cloud platform for processing. But these sensors should be wireless, and small batteries should be used for portability. Wireless solutions like RF can send data to long distances, but require more power for battery operation. On the other hand, BLE can work with very little power but cannot send data over long distances. So this is why LoRa is needed.
In LoRa, we can achieve high-distance communication without using a lot of power, thus overcoming the shortcomings of Wi-Fi and BLE communication. But how is it possible? If this is the case, why do BLE and RF still exist?
That's because LoRa has its shortcomings. To achieve the long-range of high-power LoRa bandwidth, it can operate on very low bandwidth. The maximum bandwidth of Lora is about 5.5 kbps, which means you can only send a small amount of data through LoRa. Therefore, you cannot send audio or video through this technology, it is only suitable for transmitting less information, such as sensor values. The figure below shows the location of LoRa compared to Wi-Fi, Bluetooth, and Cellular cellular devices.
Many people compare LoRa with Wi-Fi or Bluetooth, but the two are not close to LoRa. Bluetooth is used to transfer information between two Bluetooth devices, and Wi-Fi is used to transfer information between an access point (router) and a station (mobile). But LoRa technology was not invented mainly to transmit data between two LoRa modules.
You can think of LoRa as more like cellular communication. The signal from one LoRa node reaches another node through the LoRa gateway, as shown in the figure below.
These gateways then transfer the information to the Internet, and finally to the end-user through the application program interface. Similarly, the data from the user will also reach the node through the web server and gateway.
LoRa nodes usually run on batteries and consist of radio modules and microprocessors. The microprocessor is used to read data from the sensor and send it in the air through the radio module, and then receive it by the LoRa gateway. LoRa gateways also have radio modules and microprocessors, but they usually run on AC power because they require more power. A single LoRa gateway can monitor multiple LoRa nodes, and a single LoRa node can also send information to multiple gateways so that the information from the nodes will be connected to the gateway without being lost. When the information id is sent from the node to the gateway, it is called uplink, and when it is sent from the gateway to the node, it is called the downlink.
LoRa belongs to the LPWAN category, where LPWAN stands for Low Power Wide Area Network. Not only LoRa can run on LPWAN，we also have other technologies, such as NB-IOT, Sigfox, etc., which can run in the same LPWAN. Once LoRa technology was introduced, it required all manufacturers to follow certain protocols, so the LoRa Alliance was formed, and then LoRaWAN was introduced. LoRaWAN is a modified form of LPWAN, which specifies how LoRa in the physical layer should be used to send and receive data between nodes, gateways, and the Internet.
How far can I use LoRa to communicate?
Official information about LoRa claims that it can reach a line-of-sight distance of 715 kilometers. That is when there is no barrier between the node and the gateway. Few people even communicate between the ground and the ground at 212 kilometers or even use weather balloons to reach 702 kilometers.
LoRa SX1278 and Arduino
The above theory is enough for us to build it ourselves and examine how it works. The LoRaWAN protocol does not allow communication between two LoRa modules, but there is a technology called the radio header method, which follows the LoRaWAN protocol, but allows us to communicate with two LoRa modules! So let's use two LoRa modules and two Arduino boards to send data from one board and then receive data on the other board. We will use Arduino Uno on the transmitter side and Arduino Nano on the receiver side.
The LoRa module I used here is SX1278 Ra-02, with a working frequency of 433MHz. The license-free frequency here ranges from 865MHz to 867MHz, so I don't allow the 433MHz frequency module to be used for a long time in law instead of for educational purposes. Similarly, check the allowed range in your country/region and make sure you can use a specific frequency range. LoRa modules have different frequency ranges, the most common are 433MHz, 915MHz, and 868MHz. The working frequency of the module will be mentioned at the end of the module. You can also buy LoRa as a module or just a chip. If you plan to only get chips, then make sure your soldering technique is good because it is a good job to solder to LoRa chips. The following are the versions of the module and chip bonding wires, as shown below.
The next important thing about your LoRa module is your antenna. Please remember that you must use the antenna to operate the LoRa module, otherwise the output transmit power will damage the module. I am using a 433Mhz Lora module, so the rated frequency of my antenna is 433MHz, you have to choose the antenna accordingly. My LoRa module and antenna are shown below.
Transmitter-Connect LoRa SX1278 and Arduino UNO
For the sending end, we will use Arduino UNO and our LoRa module. The circuit diagram to connect Arduino UNO with LoRa is shown below
The LoRa module consists of 16 pins, with 8 pins on each side. Among these 16 pins, 6 are used by GPIO pins, ranging from DIO0 to DIO5, and 4 of them are used by ground pins. The module works at 3.3V, so the 3.3V pin on LoRa is connected to the 3.3V pin on the Arduino UNO board. Then we connect the SPI pin on LoRa to the SPI pin on the Arduino board as shown above.
I use a connecting cable to establish a connection between the Arduino UNO and LoRa Module. The settings are as follows. The entire setup can be powered by a mobile power supply, making it movable to test the range.
Receiver-Connect LoRa SX1278 and Arduino Nano
For the receiving end, we will use the LoRa module and Arduino Nano. You can use any Arduino board for transmitter and receiver, but make sure to connect them accordingly. The circuit diagram to connect Arduino Nano with LoRa is shown below
Except for a small change, the connection remains almost unchanged. The 3.3V pin of the LoRa module is not powered by the Arduino Nano, but by an external 3.3V regulator. This is because the on-board voltage regulator on the Arduino Nano cannot provide enough current for the LoRa module to operate. Otherwise, the connection remains the same.
I established the connection on the breadboard and used the reliable old breadboard power supply we built earlier. Please also note that the LoRa module I used is not very suitable for breadboards, so I used two small breadboards to connect as shown below.
The above is the introduction of how to use the Arduino development board to connect the SX1278 LoRa module, I hope it will be helpful to those who want to know.
Previous: Amplifier PT2399 debugging guide
SD/HD-limited EQ+receiver with audio (li >
Connector Accessories Safety Clip for Ca >
Current Limit SW 1-IN 1-OUT 1.1V to 3.6V >
Ultra Small 1-Line ESD Protection >
IC DIGITAL BASEBAND LORA >
Ultra Low Capacitance TVS Arrays >
11.3GB/s EML Driver with Integrated Limi >
UCLAMP3311Z.TFT 3.3V Z PACKAGE >
ESD Suppressor TVS 5V 3Pin SLP T/R >
Diode TVS Single Bi-Dir 5V 30W 2Pin SLP >
uClamp® 01005 Size, Single Line, Bidirec >
4/5 WIRE RESISTIVE TOUCH ; HT SUSA CODE: >
TVS DIODE 12V 25V >