element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Just Encase
  • Challenges & Projects
  • Design Challenges
  • Just Encase
  • More
  • Cancel
Just Encase
Blog Monitoring an irrigation canal using LoRa #2
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Just Encase to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: redcharly
  • Date Created: 12 Feb 2022 5:33 PM Date Created
  • Views 894 views
  • Likes 4 likes
  • Comments 0 comments
  • Arduino MKR WAN 1300
  • Hammond Manufacturing Enclosures
  • lora
  • MKR1300
  • Lora Send / Receive
  • hammond
  • just_encase
  • just encase
Related
Recommended

Monitoring an irrigation canal using LoRa #2

redcharly
redcharly
12 Feb 2022

Hi, I'm Carlo Russo and I would like to talk today about the Arduino MKR1300 boards and the LoRa protocol.
The Just Encase kit is full of interesting components and I decided to start using the Arduino MKR1300.

image

I've been wanting to test LoRa connectivity for a long time now. As a network teacher, I find this technology very interesting, as it combines considerable distances covered with reduced power consumption.

This is the right opportunity to work with LoRa connectivity and I will start, step by step, to use the board starting from a simple initial configuration and gradually adding the sensors and the boards that will be needed to complete my project.
The first step is to study the connectivity between the two boards.

From the hardware point of view, I will only have to power the boards after connecting the antenna (not included in the Arduino MKR1300 package!).

image


The programming of the two boards was done using two example codes contained in the LoRa library, in particular the two codes are LoraSender.ino and LoRaReceiver.ino.

Here you will find the two codes.

LoRaSender:

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

int counter = 0;

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

  Serial.println("LoRa Sender");

  if (!LoRa.begin(915E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);

  // send packet
  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(5000);
}
 

 image

and LoRaReceive:

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

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

  Serial.println("LoRa Receiver");

  if (!LoRa.begin(868E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet: ");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print(" with RSSI ");
    Serial.println(LoRa.packetRssi());
    
  }
}
 

image

It is impressive to see how with very few lines of code, the two boards begin to communicate with each other.

As always, Arduino devices are noteworthy for their extreme ease of use.

We will start from these two simple sketches to realize our project, modifying the code and adding more to adapt it to our needs.

In the next blog, I will discuss the use of sensors in this project.

Now I would like to talk about LoRa and LoRaWAN technologies, to briefly describe them (https://lora-alliance.org/about-lorawan/) and highlight the advantages and disadvantages of their use.

LoRa

LoRa® is the physical layer or the wireless modulation utilized to create the long-range communication link. LoRa® is based on chirp spread spectrum modulation, which maintains the same low power characteristics as FSK modulation but significantly increases the communication range.

Chirp spread spectrum has been used in military and space communication for decades due to the long communication distances that can be achieved and robustness to interference, but LoRa® is the first low-cost implementation for commercial usage.

The great advantage of LoRa® is in the technology’s long-range capability. A single gateway or base station can cover entire cities or hundreds of square kilometers but, obviously, the range highly depends on the environment or obstructions in a given location.

One technology cannot serve all of the projected applications and volumes for IoT.

WiFi and BTLE (Bluetooth Low Energy) are widely adopted standards and serve the applications related to communicating personal devices quite well. Cellular technology is a great fit for applications that need high data throughput and have a power source. LPWAN offers a multi-year battery lifetime and is designed for sensors and applications that need to send small amounts of data over long distances a few times per hour from varying environments

 image

Figure 1. Bandwidth Vs Range (https://www.semtech.com/lora)

LoRaWANTm

LoRaWANTm defines the communication protocol and system architecture for the network while the LoRa® physical layer enables the long-range communication link.

The protocol and network architecture have the most influence in determining the battery lifetime of a node, the network capacity, the quality of service, the security, and the variety of applications served by the network.

  

Network Architecture

Many existing deployed networks utilize a mesh network architecture. In a mesh network, the individual end-nodes forward the information of other nodes to increase the communication range and cell size of the network.

While this increases the range, it also adds complexity, reduces network capacity, and reduces battery lifetime as nodes receive and forward information from other nodes that is likely irrelevant for them.

In a LoRaWANTm network, nodes are not associated with a specific gateway. Instead, data transmitted by  a node is typically received by multiple gateways. Each gateway will forward the received packet from the end-node to the cloud-based network server via some backhaul (either cellular, Ethernet, satellite, or Wi-Fi).

Problems with LoRaWAN

Despite its strenghts, LoRaWAN has a couple of serious drawbacks as well.

  1. Lack of network infrastructure: while with cellular IoT you can deploy anywhere in the world and find a carrier with coverage, that's not usually the case with LoRaWAN. There are a lot of LoRaWAN service providers but many countries, regions and cities have none, so if you want to deploy there, you have to build the infrastructure
  2. Extremely limited messaging capabilities: LoRaWAN networks can’t handle very much communication. In fact, with LoRaWAN, you can only send a limited number of messages per day. For example, you may only allow a device to use the frequency band as little as 1% of the time.
  3. LoRaWAN gateways can’t transmit and receive at the same time: you need to limit traffic, for example, acks to message arrived, even sending firmware updates to your device to fix bugs or vulnerabilities will make them unavailable. 

Next time we will talk about sensors.

Bye

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube