15.Jun.2023

LoRa technology is a wireless communication technology that is used for long distance communication and does not depend on the internet. LoRa creates its own wireless network and can exchange data between devices without the need for an internet connection.

LoRa is long range wireless communication technology which stands for "Long Range". It stands out with its low power consumption and long range features. In this way, communication between devices can be carried out in a wide coverage area. LoRa is a frequently preferred technology especially in IoT (Internet of Things) applications, remote monitoring, sensor networks, smart cities, agricultural applications.


LoRa uses a proprietary protocol and typically uses unlicensed frequencies in the ISM (Industrial, Scientific, and Medical) bands. In this way, direct communication between devices can be achieved without internet addiction.

However, LoRa technology does not provide an independent internet connection. If devices need to provide access to the Internet, a separate connection method or connecting the LoRa network to a gateway may be required. In this way, it is possible to transmit data received from LoRa modules to the Internet.

LoRa technology has long communication ranges, typically between 2 and 10 kilometers. In addition, it has the ability to pass signals through obstacles. It usually operates in unlicensed ISM (Industrial, Scientific and Medical) bands such as 433 MHz, 868 MHz or 915 MHz. These frequencies offer low power consumption and wide coverage.

LoRa modules typically provide half-duplex communication. This means that they cannot be both a transmitter and a receiver at the same time. That is, they cannot send and receive data at the same time. However, it is possible for the module to operate as a receiver or transmitter at varying time intervals depending on the situation.

Today, LoRa modules can be easily integrated with microcontrollers. On our site, we share some microcontrollers and different modules' wiring diagrams and code examples. We have added the code samples below, which should be written after the Ra-01 LoRa SX1278 module we chose as an example is connected to the Arduino Nano.

Transmitter Connections:

Ra-01 DI0_PIN -> Arduino Nano D2
Ra-01 SCK_PIN -> Arduino Nano D13
Ra-01 MISO_PIN -> Arduino Nano D12
Ra-01 MOSI_PIN -> Arduino Nano D11
Ra-01 SS_PIN -> Arduino Nano D10
Ra-01 RST_PIN -> Arduino Nano D9


Receiver Connections:

Ra-01 DI0_PIN -> Arduino Nano D2
Ra-01 SCK_PIN -> Arduino Nano D13
Ra-01 MISO_PIN -> Arduino Nano D12
Ra-01 MOSI_PIN -> Arduino Nano D11
Ra-01 SS_PIN -> Arduino Nano D10
Ra-01 RST_PIN -> Arduino Nano D9

The codes required for two Ra-01 LoRa SX1278 modules connected to two Nanos to communicate with each other:

Transmitter Code (Transmitter):

#include <SPI.h>
#include <LoRa.h>

const int DI0_PIN=2; // Connect Ra-01 DI0 pin to Arduino Nano D2 pin
const int SCK_PIN=13; // Connect Ra-01 SCK pin to Arduino Nano D13 pin
const int MISO_PIN=12; // Connect Ra-01 MISO pin to Arduino Nano D12 pin
const int MOSI_PIN=11; // Connect Ra-01 MOSI pin to Arduino Nano D11 pin
const int NSS_PIN=10; // Connect Ra-01 NSS pin to Arduino Nano D10 pin
const int RST_PIN=9; // Connect Ra-01 RST pin to Arduino Nano D9 pin

void setup() {
   Serial.begin(9600);
   while (!Serial);

   LoRa.setPins(NSS_PIN, RST_PIN, DI0_PIN);
   SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN);

   if (!LoRa.begin(433E6)) {
     Serial.println("Failed to initialize LoRa. Check!");
     while(1);
   }

   Serial.println("LoRa transmitter started.");
}

void loop() {
   String data="Hello, this is a LoRa test!";
   LoRa.beginPacket();
   LoRa.print(data);
   LoRa.endPacket();

   Serial.println("Data sent: " + data);
   delay(5000); // 5 second wait time
}


Receiver Code (Receiver):

#include <SPI.h>
#include <LoRa.h>

const int DI0_PIN=2; // Connect Ra-01 DI0 pin to Arduino Nano D2 pin
const int SCK_PIN=13; // Connect Ra-01 SCK pin to Arduino Nano D13 pin
const int MISO_PIN=12; // Connect Ra-01 MISO pin to Arduino Nano D12 pin
const int MOSI_PIN=11; // Connect Ra-01 MOSI pin to Arduino Nano D11 pin
const int NSS_PIN=10; // Connect Ra-01 NSS pin to Arduino Nano D10 pin
const int RST_PIN=9; // Connect Ra-01 RST pin to Arduino Nano D9 pin

void setup() {
   Serial.begin(9600);
   while (!Serial);

   LoRa.setPins(NSS_PIN, RST_PIN, DI0_PIN);
   SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN);

   if (!LoRa.begin(433E6)) {
     Serial.println("Failed to initialize LoRa. Check!");
     while(1);
   }

   Serial.println("LoRa receiver started.");
}

void loop() {
   if (LoRa.parsePacket()) {
     while (LoRa.available()) {
       String receivedData=LoRa.readString();
       Serial.println("Received data: " + receivedData);
     }
   }
}

These codes use the LoRa library and require SPI connectivity. The SS_PIN, RST_PIN, DI0_PIN,MOSI_PIN, MISO_PIN and SCK_PIN values indicate the pins of the LoRa module that are connected to the Arduino Nano. Power Supply must be configured correctly (3.3V and GND)

After uploading the code, the data sent by the transmitter Arduino Nano will be received by the receiving Arduino Nano and displayed on the serial monitor.

Before using the code, the LoRa library (LoRa.h) must be loaded on both Arduino Nanos. LoRa library can be found and loaded via "Library Manager" in Arduino IDE.
If it is desired to communicate on a different frequency, the following line should be changed:

if (!LoRa.begin(433E6)) : The value of 433E6 in this line indicates 433 Mhz. Other frequency options are:
For 868MHz: 868E6 (Ra-02)
For 915MHz: 915E6 (Ra-02)

Note:

While the LoRa Ra-01 module works in the 433 MHz frequency band, the LoRaRa-02 module can operate in the 433 MHz, 868 MHz and 915 MHz frequency bands. The Ra-02 offers a wider frequency range, giving the user a choice.

İlgili Haberler

What is Colpitts oscillator? What are the Working Principles?

Working principles and elements of Colpitts oscillator. Information on electronic circuits, RF applications and frequency generator design

18.10.2023

Frequently used units in electronics

Basic units used in electronics

07.04.2023

Evolution of Bluetooth Technology: Versions After Bluetooth 5.0

Evolution of Bluetooth technology: Versions after Bluetooth 5.0. Faster, safer and more efficient wireless communication.

22.10.2023

Antenna Types

Types of antennas for radio frequency circuits

07.04.2023

Types of Transistors

Transistors, one of the most basic elements of electronic circuits

08.04.2023

Resistor Color Codes

resistor colors, measuring resistance, circuit elements

08.04.2023

2SC3355 Transistor: An Ideal Component for RF Applications

Technical article with detailed information about the 2SC3355 transistor. An ideal component for RF applications and high frequency circuits

26.10.2023

What are the Modulation Types?

Frequencies and modulations

10.04.2023

Learning Microcontroller Chips: Why Is It Necessary?

Learning microcontroller chips, developing electronic projects, working in industrial applications and gaining career opportunities

02.11.2023

Button Cell Types and Standards

Button Battery types and standards

10.04.2023

Quantum Computer: Comparison with Classical Computers

Quantum computers, comparison with quantum computers

04.11.2023

OV7670 CMOS VGA MODULE

Information about the technical specifications and usage areas of the OV7670 CMOS image sensor.

05.11.2023

What is a diode? What are its types and uses?

Basic electronics information, diodes, usage areas of diodes

12.04.2023

What is PCB?

PCB Manufacturing, Design

15.04.2023

What is ESP-IDF?

ESP-IDF is a powerful IoT software development framework developed by Espressif Systems. Offers low-level control and expandability for WiFi and Bluetooth-enabled microcontrollers such as ESP32 and ESP32-S2

19.11.2023

What is Frequency Shift Modulation (FSK)?

In this article, we basically explain FSK, which is one of the modulation types.

20.04.2023

AD9280: Advanced Sampling and Wide Application Areas with High-Speed 8-Bit ADC

The AD9280 is a high-performance ADC at 8-bit, 32 MSPS. Ideal for precise measurements in RF, imaging, automotive and industrial applications

30.11.2023

What is FPGA?

What is FPGA? What are the differences with the CPU? How is it programmed? What applications are FPGAs used in?

22.04.2023

What is PSK (Phase Shift Keying)?

What are the modulation types? Overview of the PSK modulation concept

23.04.2023

What is a Hall Effect Sensor?

Hall effect sensors are used to detect the magnetic field. A simple application example is presented with the A3144 example and Arduino integration.

28.12.2023

What is MOSFET?

Basic information about MOSFET, usage areas

25.04.2023

What is IR LED?

Basic information and applications about IR LEDs, which are very common in electronic systems.

29.04.2023

What is a sensor? What is a transducer?

Types of sensors, types of transducers and their uses

30.04.2023

USB (Universal Serial Bus) Standards

Technical review of USB ports

25.05.2023

What is NFC? What are the Application Areas?

NFC details, usage areas, application example

26.05.2023

IoT and IIoT: Differences and Technologies Used

Discover the differences between IoT and IIoT and the technologies used. While IoT is consumer-focused, IIoT enables efficiencies in industrial processes  

08.02.2024

Collecting Data from Multiple Sensors - 74HC4067

This article examines the use of the 74HC4067 chip and its capabilities to collect data from multiple sensors. The 74HC4067 is an analog multiplexer and demultiplexer chip used to route multiple analog signals on a single chip. The article explains the chip's technical features, operating principles and application areas, and highlights how multiple sensors facilitate the data collection process in electronic systems. Accurate capture, conversion and processing of analog data from sensors forms the basis for data-driven decision-making in industrial, scientific and medical applications. This article aims to present effective and precise data collection strategies in electronic systems by addressing methods of collecting data from multiple sensors using the 74HC4067 chip."

07.06.2023

What is Arduino Mega 2560?

A comprehensive article on the Arduino Mega 2560. The technical features, application areas and usage potential of Arduino Mega 2560 are emphasized. With its large input/output pin count, expanded memory capacity and powerful performance, Arduino Mega 2560 meets the needs of users in many projects from robotic projects to industrial automation, from 3D printers to data acquisition systems.

09.06.2023

Voltage Clipper with Zener Diode

Zener diodes: Powerful tools in electronics. In this article, get in-depth information about the function, usage areas and advantages of Zener diodes.

13.03.2024

Wearable Technologies and Sensors (Sensor and Transducers)

Wearable Technologies and Sensors. In this article, learn about the use of wearable technologies and the various sensors and transducers that support them. Discover detailed information about sensors such as motion sensors, heart rate sensors, skin temperature and electrodermal activity sensors, GPS and location sensors, temperature sensors and touch sensors. Learn how wearables are used in health, fitness, safety and more

16.07.2023

Li-Fi: The Future Wireless Communications Technology of Light

Li-Fi technology is a wireless communication technology that can transmit data via light waves. Unlike Wi-Fi, it uses the visible light spectrum and transfers data from LED or other lighting sources with fast flashing signals.

18.07.2023

Filters as Frequency Separation and Cleaning Tools

In this article, learn how filters are an indispensable tool in the electronic world, with their ability to separate and clean signals by frequency.

14.08.2023

What is ASK Modulation?

Amplitude Shift Keying (ASK) is a modulation technique used in communication systems. The amplitude of a carrier signal carrying digital data bits is varied according to the data bits.

14.08.2023

What is Frequency Modulation?

Frequency Modulation (FM) is a method used in communication. Voice or data signals are transmitted by changing the carrier wave frequency.

15.08.2023

What is LoRa-WAN?

What is LoRa-WAN?

19.04.2022

What is E-Commerce?

e-commerce news

23.04.2022

What is Boolean Mathematics?

In the world of digital electronics, Boolean mathematics forms the basis of logical expressions and operations.

20.08.2023

Memory and Controllers: The Role of Flip-Flops in Digital Electronics

Flip-flops are used as memory cells in digital electronics. They provide data storage and control with types such as D type, JK, T type and S-R

26.08.2023

Logic Circuit Elements: Differences Between NOT, Buffer and Schmitt Trigger

Understand the differences between NOT, Buffer and Schmitt Trigger, which are the basic elements in digital logic circuits

28.08.2023

What is T Type Flip Flop?

Toggle logic of T-type flip-flop and complex functions of JK-type flip-flop.

03.09.2023

D Type Flip Flop Ring Counter

What is a ring counter? Rotation counting, use of flip-flops and internal feedback

03.09.2023

Ripple Counter (Asynchronous Counter)

How to count/divide with MOD-16 Ripple counter and T-type flip-flop?

03.09.2023

How Is Frequency Divided? Why Do We Divide?

Learn about the importance and wide application areas of frequency divider circuits used in digital circuits.

04.09.2023

What is solder? What are the types?

What is solder and what are its types? Information about basic components, usage areas and solder paste.

06.09.2023

Communication Standards in Electronics: Connection Fundamentals

Learn about communication standards in electronics: RS-232, USB, Ethernet and more.

07.09.2023

Control Chips: Directive Power of Systems

About chip types and applications: Differences of PLC, PIC, MCU, CPU and more. FPGA, DSP, GPU, ASIC and SoC review.

07.09.2023

Opamp Inverting and Non-Inverting Amplifier Circuits: Basic Principles and Applications

Inverting and non-inverting amplifier circuits related to opamps. Essential components for signal processing

11.09.2023

What is Smart Sensor?

Smart sensor developments and usage areas of smart sensors

13.09.2023

Increasing the Efficiency of Home Heating Systems with Smart NTC Sensors

Information about NTC (Negative Temperature Coefficient) thermistors and their usage areas. Electronics, automotive, medical devices and smart NTCs

15.09.2023

3D Printers: Basic Principles and Applications

This technical article examines the working principles, different types and wide application areas of 3D printers

18.09.2023

What is a MEMS microphone?

How do MEMS microphones work? Usage areas

16.01.2023

What is an Electret Microphone? How does it work?

Power and Design Differences of Electret and Dynamic Microphones

27.09.2023

What is a MEMS microphone?

How do MEMS microphones work? Usage areas

16.01.2023

Colpitts Oscillator

How does the Colpitts Oscillator work?

17.01.2023

Comparison of 4G and 5G Technical Structures

4G and 5G technical structures are compared. The effects of 5G on industrial changes are examined.

27.09.2023

What's the Difference Between Bluetooth 4.0 and Bluetooth 5.0?

Bluetooth 4.0 and Bluetooth 5.0

19.01.2023

Frequency Band Frequency Typical Application

Frequency Band Frequency Typical Application table

20.01.2023

Air Core Coil Calculation

Air Core Coil

22.01.2023

What is IMU Sensor?

IMU Sensor

26.01.2023