Basics of LoRa Technology for Crop and Livestock Management

(AE1999, Dec. 2021)
Publication File:

LoRaWan (Long Range Wide Area Network) is a technology that can be used to monitor farm assets and crop and livestock conditions. This technology is an example of the Internet of Things (IoT) or Smart Farming for agriculture.

Lead Author
Lead Author:
John Nowatzki, Professor Emeritus
Web only
Publication Sections

LoRaWan (Long Range Wide Area Network) is a technology that can be used to monitor farm assets and crop and livestock conditions. This technology is an example of the Internet of Things (IoT) or Smart Farming for agriculture.

Agricultural producers and businesses can use data gathered through the IoT for management decisions. This technology allows farmers to install small sensor devices in their crop fields to monitor conditions such as rainfall, soil moisture and temperature. Ranchers could use LoRaWAN technology to monitor the water level in stock tanks in remote pastures. They can view the data on their cellphones or computer monitors.

graphic showing Nodes like the following: air temperature, relative humidity, soil moisture, rainfall, wind speed, wind direction, CO2 emissions, liquid level in tanks, machinery locations, stored grain conditions, building security and livestock locations transmit the information wirelessly to a LoRaWAN Gateway which then sends the information to the internet where it can be accessed by a computer or a cell phone.

LoRaWAN uses a long-range and lower-power wireless network to communicate between LoRaWAN gateways and remote nodes. LoRaWAN uses a license-free radio frequency that enables long-range transmissions (up five miles in rural areas) with low power consumption. The LoRaWAN protocols are defined and maintained by the LoRa Alliance, a nonprofit association of member companies committed to enabling large-scale deployment of LoRaWAN IoT through the development and promotion of open standards. 

The nodes can be small and battery-operated sensor devices, and installed in remote locations. The LoRaWAN gateways communicate with the nodes, receiving the data from the sensor devices and transmitting signals back to the sensor devices so they can be managed remotely. The LoRaWAN gateway also functions to move the data to the Internet so it can be viewed by users.

The LoRaWAN gateway uses high bandwidth networks such as Wi-Fi, Ethernet or cellular to connect to the internet. The cellular connection is used only if a direct connection is not available because of the additional cellular subscription costs.

The LoRaWAN gateways also require electricity to function. The electricity can be supplied by a normal AC electrical supply or by a 12-volt battery. If a battery is used to power the gateway, a solar charger is required to maintain the battery power.

After the data are transferred to the internet, it needs to be managed to make it available to view on websites. There are several options to accomplish this. The method explained in this publication focuses on using an open-source software called The Things Network.

Remote video URL
Remote video URL

Using The Things Network to Manage LoRaWAN Systems

The Things Network (TTN) is an example of a network server that can be used to receive data from gateways and make it available on the internet. The Things Network is a nonprofit, open-source online community dedicated to helping people manage LoRaWAN data from sensor devices and make it viewable on the internet.

The procedure to connect the nodes and LoRaWAN gateways to The Things Network involves several steps. Each LoRaWAN gateway and sensor device has a unique address hard coded into; the address is referred to as an EUI (a globally unique extended unique identifier). Each device’s EUI needs to be registered under an TTN application.

An example of an application on The Things Network could be several soil moisture sensor devices in crop fields all connected to one LoRaWAN gateway using LoRaWAN communication. The application also needs to be set up and registered on The Things Network.

Viewing the Data on myDevices Cayenne

To make the data viewable on the internet, it needs to be displayed on a website. You have several options to accomplish this. The method explained in this publication focuses on using a free and open-source website called myDevices Cayenne. myDevices Cayenne is a server that provides visual dashboards for sensor data collected using LoRaWAN technology. The Cayenne online dashboard allows users to visualize sensor data and define rules to send email or text message alerts if the data reach a specified level.

Setup a LoRaWAN System on TTN

  1. Access the Things Network (TTN) 
    1. Scroll to “The workbench to get you started with IoT”.
    2. Click on “Create an Account”.
  2. Create an account, log in and open the Console on TTN (www.thethingsnetwork.org/).  https://console.cloud.thethings.network/
  3. Create an Application.
    1. Click “Add Application”
    2. For Application ID, choose a unique ID of lowercase, alphanumeric characters.
    3. For Application name, enter any name appropriate to the application.
    4. For Application Description, enter any descriptive for the new application.
    5. Click “Create application”.
    6. Click “Register” to finish.
  4. Adding end devices (sensors).
    1. Open the application TTN and click “Add end device.”
    2. Under “Select the end device”, scroll down the list of available Brands, and select the device brand name of your device.
      1. Under “Model”, select the model of your device.
      2. Under “Hardware Version”, if you know the hardware version, select “Unknown Version”.
      3. Under “Firmware Version”, enter the firmware version provided by the manufacturer.
      4. Under “Profile (Region)”, for the United States, select “US_902_928”.
    3. Under “Enter registration data”:
      1. For “Frequency plan”, scroll down and select “United States 902-928 MHz, FSB 2”
      2. For “AppEUI” fill the box with zeros.
      3. For “DevEUI” type in the EUI labeled on the device.
      4. For “AppKey”, click on the “Generate” tab.
      5. For “End device ID”, enter any readable identification of your choice.
    4. To complete adding the device to the application, click on “Register end device”.
  5. Adding a gateway to The Things Stack Community Edition
    1. Sign into your user account on TTN server.
    2. Click on the “Gateways” icon.
    3. Click on the “Add gateway” icon. Complete the following steps:
      1. Gateway ID: Enter a any unique identifying name.
      2. Gateway EUI: Enter the EUI provided by the gateway manufacturer.
      3. Gateway name: Enter any readable name.
      4. Description: Enter a brief description.
      5. Gateway Server address: This will be entered automatically.
      6. Required authenticated connection: Leave unchecked.
      7. Gateway status: The “Public” box can be checked to left unchecked.
      8. Gateway location: The “Public” box can be checked to left unchecked.
      9. Frequency Plan: Choose “United States 902-928 MHz, FSB2”.
      10. Schedule downlink late: The “Enabled” box can be checked to left unchecked.
      11. Enforce duty cycle: Check the “Enabled” box.
      12. Scheduled any time delay: Enter 530 milliseconds.
      13. Gateway updates: Check the “Enabled” box.
      14. Channel: Select “Stable”.
      15. To complete adding the gateway, Click the “Create gateway” icon.

Add a Cloud Integration to the Application.

Cloud integrations allow users to visualize the sensor data, setup text and email messages from the sensor data, and share the data with others. This example provides a step-by-step procedure to setup an integration on Cayenne.

  1. Create an account on myDevices Cayenne and log in 
  2. On the Cayenne Web page, “Add New”, and then choose “Device/Widget”
    1. In the “Search” box, enter the name and model of the device to add. The device name will be displayed.
    2. Click on the device name. An “Enter Setting” column will be displayed.
    3. In the DevEUI field, add the DevEUI of your device.
    4. Select “Add a Device.”
  3. To integrate, you only need to fill out the “Webhook” field
    located in the left column of the Application on The Things Stack Web page.
    1. Click on the “+ Add webhook” icon.
    2. Web names will be displayed. Click on the “Cayenne” icon.
    3. For Webhook ID, type “cayenne-demo”.
    4. Click “Create cayenne webhook”.
  4. The visualization of the sensor device data will be viewable on the myDevices Cayenne website

Develop Dashboard on myDevices Cayenne

  1. Create an account on myDevices Cayenne and log in.
  2. Select “Add a Device.”
  3. Search for the specific device to add. Devices can be searched by name or manufacturer.
  4. Add the device EUI in the “DevEUI” section.
  5. Click “Add Device.”
  6. The visualization of the sensor device data will be viewable on the myDevices Cayenne website