Reader small image

You're reading from  Arduino Data Communications

Product typeBook
Published inNov 2023
PublisherPackt
ISBN-139781837632619
Edition1st Edition
Right arrow
Author (1)
Robert Thas John
Robert Thas John
author image
Robert Thas John

Robert Thas John is a data engineer with a career that spans two decades. He manages a team of data engineers, analysts, and machine learning engineers – roles that he has held in the past. He leads a number of efforts aimed at increasing the adoption of machine learning on embedded devices through various programs from Google Developers and ARM Ltd, which licenses the chips found in Arduinos and other microcontrollers. He started his career as a software engineer with work that has spanned various industries. His first experience with embedded systems was in programming payment terminals.
Read more about Robert Thas John

Right arrow

Communicating with LoRaWAN

In this chapter, you will learn about the network implementation of LoRA, called LoRaWAN, and an infrastructure implementation called The Things Network (TTN). You will also learn about the hardware components that are needed to make creating LoRaWAN networks a possibility. Finally, you will learn how you can communicate with your APIs over LoRaWAN.

By the end of this chapter, you will have set up a gateway device and an end device to send data to TTN.

In this chapter, we are going to cover the following main topics:

  • Introduction to LoRa and LoRaWAN
  • Working with The Things Network
  • Purchasing and setting up radios and gateways

Let’s consider what we will need to complete this chapter.

Technical requirements

You will need the following in order to complete the tasks in this chapter:

  • Arduino IDE
  • Arduino MKR WAN 1310
  • Arduino WisGate Edge Lite 2
  • Arduino MKR ENV Shield
  • Arduino Portenta H7 and Portenta Vision Shield – LoRa (optional)

The code for the exercises in this chapter can be found at the following GitHub URL: https://github.com/PacktPublishing/Arduino-Data-Communications.

Introduction to LoRa and LoRaWAN

A Wide Area Network (WAN) can be loosely defined as any technology that can connect devices across a large geographical area, and in some cases, even across the world. Working backward, we see that LoRaWAN is a WAN that we can set up using LoRA, which is a long-range, low-power technology. LoRaWAN is a type of Low-Power WAN (LPWAN) connectivity protocol. LoRa is the physical communication layer that powers LoRaWAN.

LPWAN setups do not provide a large bandwidth, meaning that devices can only send small amounts of data at any point in time, and usually at a periodic interval, such as hourly. It is important to note that you cannot send a continuous stream of data on a LoRaWAN network. You can’t send accelerometer data, for example. You also can’t send images and videos on the network. If you wish to conserve power, you will need to use a fire-and-forget methodology where you program devices to send messages without waiting for confirmation...

Working with The Things Network

TNN is a public LoRaWAN network server that makes it easy to register gateways, applications, and devices (nodes) and to transmit data from nodes to the network server via the registered gateways.

TTN enforces a few constraints that you need to be aware of before you start using it. These include the following:

  • Only transmitting binary data
  • Keeping data sizes as small as possible
  • Avoiding continuous data transmission
  • Utilizing an Adaptive Data Rate (ADR)
  • Avoiding downlink messages if possible
  • Avoiding confirmed uplinks

You can get started by visiting https://www.thethingsnetwork.org/ and creating an account. When you log in, you will be met with a console that lets you manage either applications or gateways. The top of the console looks like the following.

Figure 7.2 – TTN console

Figure 7.2 – TTN console

Let’s take a look at gateways.

Understanding gateways on TTN

When you visit the Gateways...

Purchasing and setting up radios and gateways

There is a multitude of device manufacturers; the quickest way of finding devices that are certified for LoRaWAN would be to visit the following URL: https://lora-alliance.org/showcase/search/?_sfm_lorawan_certified_device=certified. You will find various devices, both ready to use, as well as modules that you can integrate into your projects.

TTN sells a LoRa gateway device. You can find out all about it at the following URL: https://www.thethingsnetwork.org/docs/gateways/gateway/.

Since this is a book about Arduino, my examples are written using Arduino hardware. Let’s consider these options.

Buying LoRaWAN-certified gateways

Arduino manufactures two LoRaWAN gateways, one for indoor use and a second for outdoor use. You can get more information about these gateways from the following URL: https://www.arduino.cc/pro/lora-gateways/.

I will be making use of the indoor gateway, called the WisGate Edge Lite 2. You can...

Summary

In this chapter, you learned how to set up an account on a public LoRaWAN server and configure a gateway and an end device to send data to the server. You also learned how to transmit data from the server using both REST and MQTT.

In the next chapter, you will learn how to work with SigFox, another LPWAN technology.

Further reading

To learn more about the topics covered in this chapter, you can visit the following links:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Arduino Data Communications
Published in: Nov 2023Publisher: PacktISBN-13: 9781837632619
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Robert Thas John

Robert Thas John is a data engineer with a career that spans two decades. He manages a team of data engineers, analysts, and machine learning engineers – roles that he has held in the past. He leads a number of efforts aimed at increasing the adoption of machine learning on embedded devices through various programs from Google Developers and ARM Ltd, which licenses the chips found in Arduinos and other microcontrollers. He started his career as a software engineer with work that has spanned various industries. His first experience with embedded systems was in programming payment terminals.
Read more about Robert Thas John