By: Daryl R. Miller, Head of Solutions Engineering, Machinechat
LoRa adoption continues to grow rapidly with over 191 million end nodes according to Semtech, the developer of the technology. Its benefits include sensor battery life that can last for years, range that spans kilometers, and no monthly communication service fees, to name a few. LoRa is applicable in many verticals including agriculture, healthcare, environmental monitoring, retail, and smart metering. Use cases that don’t require low latency or high bandwidth are a good fit for LoRa.
In this guide, you will be briefly introduced to LoRa and learn how to build a private, edge-based LoRaWAN IoT sensor network using off the shelf hardware and software.
LoRa and LoRaWAN Introduction
The name LoRa is derived from Long Range and refers specifically to the spread spectrum modulation technique used to send and receive data at a “bits” (physical) level over impressive distances. LoRaWAN is the low power, wide area networking (LPWAN) standard that sits atop LoRa providing bidirectional communications, end-to-end security and more. (For technical details, please see the publication, What are LoRa® and LoRaWAN®?).
Network operators like Helium and The Things Network provide LoRaWAN Public networks as a paid service. Another option is to setup a private, edge-based, LoRaWAN long-range IoT sensor network. There are many benefits from doing this including:
- Maintaining end-to-end privacy and control over data
- Complete control over software and infrastructure updates and upgrades
- Edge-based. No dependency on Internet connectivity
- No recurring service fees
In many IoT applications, the sensors are all within a confined geographic location, ideally suited to a private network.
Building a private LoRaWAN IoT Sensor Network
There are four parts needed to build and operate a Private LoRaWAN IoT sensor network:
- Application software - Machinechat JEDI Pro SSE
- LoRaWAN Network server software - ChirpStack
- LoRaWAN Gateways - Seeed Studio SenseCAP Gateways
- LoRaWAN Sensors - Seeed Studio SenseCAP Sensors
The following diagram shows these 4 components along with the default communications protocols between them:
1. Applications Software
The applications software enables the collection of sensor data and helps you to act on it through dashboards, rules, actions, notifications, and network monitoring. Machinechat JEDI Pro Seeed Studio Edition (SSE) is a software application that is installed on your server to provide these functions and more. JEDI Pro SSE has a built-in data collector that communicates seamlessly with the ChirpStack network server described below to receive LoRaWAN data from Seeed’s SenseCAP sensors.
Installing Machinechat JEDI Pro SSE
- Download and Install JEDI Pro SSE on the Ubuntu Linux machine along with the Network Server software or on another Windows PC, Mac, Raspberry Pi, or BeagleBone.
- Add and configure the SenseCAP Data Collector.
- Get started using JEDI Pro SSE. A few ideas:
- Create dashboards to provide users with the information they need to make informed decisions. Real time and historical data can be visualized with line, area, tile, radial and data grid charts
- Send text or email alerts: for example, when the soil moisture drops below a certain percentage, if the LoRaWAN gateway goes offline, or the outdoor temperature is above a specific threshold
- Calculate and display the number of sensors that are above or below a certain threshold
- Collect, display, store, and act on other data via HTTP, MQTT, TCP, and Web socket APIs. JEDI Pro SSE supports 200 simultaneous devices
- Add virtual data sensors to model use case scenarios
- Monitor the LoRaWAN gateway and other critical network resources
2. Network Server Software
ChirpStack is an open-source LoRaWAN network server. This software runs locally, gathering the sensor data forwarded from the gateways. It then deduplicates, decrypts and converts it into a common data format. This data is available via several integrations including MQTT and HTTP. ChirpStack provides a web-based interface to quickly onboard and manage devices and gateways.
A machine (PC or SBC) running Debian or Ubuntu is necessary for installing ChirpStack. Ubuntu OS installation instructions can be found here.
Now install the ChirpStack components, including the Gateway Bridge, Network Server, and the Applications Server. The following dependencies are also required: mosquitto, mosquitto-clients, redis-server, redis-tools, and postgresql. The ChirpStack installation link above outlines how to install them as well.
HTTP is used to communicate between ChirpStack and JEDI Pro SSE. When setting up the “Applications” within ChirpStack, make sure to enable the HTTP Integration. Set the marshaller to “JSON” and the endpoint to the IP address of the machine where JEDI Pro SSE is running, i.e., “http://192.168.1.101:8090”. Make sure the port number (8090 in this example) is the same within the ChirpStack HTTP Integration and the JEDI Pro SSE data collector configuration. It should be a unique, unused port number (not 80, 8000, 8080, etc.)
Finally, add the Seeed SenseCAP LoRaWAN gateway and sensors (described below) to the ChirpStack installation. This requires entering the EUI (printed on the product label) and the app key which has to be retrieved online; see section 4.1 of this helpful document. The app key is NOT printed on the product. You will also need to install the CODEC for SenseCAP sensors found here into ChirpStack. The codec is required for all LoRaWAN systems to translate the raw sensor information into a more standardized format.
All LoRaWAN gateways provide the function of gathering the wireless information from sensors and then forward this data to the network server software using IP networking (wired Ethernet, Wi-Fi, Cellular). There are several manufacturers including Seeed Studio, MultiTech and Laird. The Seeed Studio SenseCAP Outdoor Gateway has an IP66 enclosure and supports an extended operating temperature range, making it suitable for industrial applications in both indoor and outdoor environments.
For installations that span many kilometers or involve challenging terrain, multiple gateways may be required. There is no one-to-one relationship between LoRa-based devices and gateways in a LoRaWAN network; messages sent to and from end devices travel through all gateways within range. Deduplication of the same messages arriving from multiple gateways is handled by the network server. Gateways can forward messages from any brand of LoRaWAN sensors if the frequency bands and sub-bands are configured appropriately.
There are many readily available LoRaWAN sensors on the market. The LoRaWAN standard is well defined, making LoRaWAN products from different manufacturers interoperable. While one may be tempted to build their own sensors, off-the-shelf products are tested, certified and ready to be deployed. They are available for a broad range of applications and come integrated with batteries, antennas, and in some cases IP-rated enclosures suitable for outdoor use. Seeed Studio SenseCAP line of LoRaWAN sensors have a built-in battery that lasts up to 3 years (using the default configuration that sends messages once per hour).
When selecting sensors and gateways it is important to choose devices that operate in the frequency bands approved for the country where the system is being deployed. A quick reference can be found within the document here.
By using off the shelf hardware and software, building and operating a private, edge-based LoRaWAN IoT sensor network is easier than ever before. The solution presented in this guide gives you end-to-end ownership and control and alleviates the need for custom software development and maintenance. It also eliminates cloud service fees that add up over time and dependence on persistent Internet connections. Best of all, you will have a robust IoT solution running on your terms!
Headquartered in San Jose, California, Machinechat’s mission is to be the leading supplier of IoT data management solutions that dramatically reduce the cost and time spent developing and deploying IoT projects. Leveraging software-defined networking principles, Machinechat’s easy-to-use and affordable solutions enable IoT solution architects, developers, and networking OEMs to quickly add data collection, processing of streaming data, data monitoring, and policy-based data management to their products and solutions. Machinechat is the developer of the JEDI One and JEDI Pro software solutions. Learn more at www.machinechat.io
About Seeed Studio
Seeed Studio, headquartered in Shenzhen, China, has been serving the global developer community since 2008, by providing open technology and agile manufacturing services, with the mission to make hardware more accessible and lower the threshold for hardware innovation. With Shenzhen’s vast resources and trusted technology and distribution partners around the world, Seeed strives to be the most integrated platform for creating hardware solutions for IoT, edge AI applications. By integrating the latest technology resources, Seeed offers the next generation hardware to help emerging applications scale. Learn more at www.seeedstudio.com