Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

What are the programming essentials for LoRa nodes?

By Ayush Jain February 27, 2024

LoRa (long-range) technology ensures reliable long-range communication between a node and gateway, making it well-suited for a range of Internet-of-Things (IoT) applications. The purpose of building a LoRa node is to reduce costs while ensuring long-term, low-power use for devices. LoRa’s low power is affected by several features, covered below.

Figure 1. Basic LoRa architecture.

Features
Smart programming. The written code must be “smart,” ensuring deep sleep when not in use. For example, the networking part of forest fire detection sensors remains in sleep mode if no fire is detected at the sensor level. This is to optimize power when needed. This approach ensures that the power-intensive networking functionality is activated only when necessary, conserving energy when the sensors detect no fire.

Battery selection. The battery is critical, especially if the node is to be deployed for years. If so, the battery’s self-discharge current must remain very low. An ideal battery will have a low self-discharge rate, particularly for devices that consume low power. Otherwise, the battery will lose its charge over time, regardless of its calculated capacity, and stop working. Batteries like LiSoCl2 are often favorable.

Figure 2. The LiSoCL2 3.6V battery.

Components selections. Even though LoRa is of low power, it does not mean all of the components are also of low power. For example, an ultrasonic distance measurement sensor requires a lot of power, so this must be a part of the component consideration.

When choosing sensors, it’s crucial to prioritize long battery life by selecting components that operate on low power, even when in use. The role of a sensor is to notify or trigger a device by transmitting data over the network. Therefore, all of the components used with a sensor should have very low power ratings. This ensures the sensor does not consume excessive power, allowing for extended battery life and efficient device operation.

In this article, we’ll explore the basics of LoRa nodes, as well as their programming and ideal hardware selections.

Figure 3. LoRa-based smart building fire prevention.

Classes of nodes
In LoRaWAN — the Low Power Wide Area Network (LPWAN) protocol that works with LoRa-based modulation — there are three classes of nodes with different capabilities in terms of their ability to receive and transmit data:

  • Class A
  • Class B
  • Class C

Class A nodes
Class A’s are the simplest and most common type of LoRaWAN node. They’re designed for applications that require infrequent uplink communication, such as sending sensor data, tracking assets, or monitoring environmental conditions. Class A nodes are characterized by their low power consumption and asymmetric communication mode, where they can receive data at any time but can only transmit data immediately after receiving it or at specific scheduled times.

Figure 4. A block diagram of the transmission between a Class A node and the gateway in low-power mode.

The Class A node communication protocol is based on the “listen-before-talk” principle, which ensures transmission does not interfere with any other ongoing network transmission. Once a Class A node transmits data, it enters a low-power sleep mode until the next uplink slot.

Additionally, Class A nodes:

  • Are the most power-efficient and simplest type of LoRaWAN node.
  • Help conserve battery life, allowing the node to operate for long periods without requiring frequent maintenance or replacement.
  • Have limited downlink capabilities and can only receive data in response to their uplink transmissions.
  • Can only receive a limited amount of downlink data of a single packet of data — transmitted by the gateway immediately after the uplink transmission.
  • Are designed for applications that require infrequent uplink communication and have limited downlink capabilities.
  • Are suitable for applications where battery life is critical and data transmissions are infrequent — making them ideal for use in environments where frequent maintenance or replacement is not feasible.

Class A examples
Class A nodes are ideal for applications where battery life is critical, and data transmissions are infrequent. In smart agriculture, Class A nodes can be used to monitor soil moisture levels and send data to a central server periodically. In asset tracking applications, Class A nodes can be attached to high-value assets and transmit location data periodically, allowing an asset’s location to be monitored over time.

Class B nodes
Class Bs are another type of LoRaWAN node that offers more capabilities than Class A nodes. Class Bs are designed for applications that require two-way communication with guaranteed latency. These nodes have periodic receive windows synchronized with a network’s beacon, allowing for scheduled downlink transmissions from the gateway to the node. This means that Class B nodes can receive data from the network even when they’re not actively transmitting.

Class B nodes have additional receive windows that allow downlink communication with guaranteed latency, making them ideal for applications requiring two-way communication.

Figure 5. A block diagram of the transmission between a Class B node in LoRa and the gateway.

For example, in smart home applications, Class B nodes can control home appliances remotely, where a user sends a command to the IoT device through the network, and the device responds in acknowledgment. These nodes can also be used in building automation systems to control and monitor HVAC systems, lighting, and security systems.

Additionally, Class B nodes:

  • Have higher power consumption than Class A nodes, requiring more frequent radio communication to maintain their synchronized receive windows.
  • Have lower power consumption than Class C nodes.
  • Have periodic receive windows synchronized with the network’s beacon, allowing for guaranteed latency in downlink communication.

Figure 6. A LoRa wireless AMR water meter.

Examples
Class B nodes are ideal for applications requiring two-way communication, such as smart homes and building automation systems. Examples include:

  • Smart metering: Remote reading of utility meters, such as for electricity, gas, and water.
  • Industrial monitoring: Monitoring equipment and machinery in industrial settings for preventive maintenance.
  • Building automation: Controlling and monitoring lighting, HVAC, and building security systems.

Class C nodes
Class Cs are the most advanced type of LoRaWAN node, designed for applications requiring real-time, continuous communication. They have the highest power consumption of all LoRaWAN nodes and provide the highest level of functionality. Class C nodes are characterized by their continuous receive window, so they’re always “listening” for incoming data from the network. As a result, they have the lowest latency compared to Class A and Class B nodes.

Figure 7. A block diagram of the transmission between a Class C node in LoRa and the gateway.

Class C nodes are ideal for real-time monitoring and control applications, such as security systems, traffic management, and industrial automation. Class Cs provide real-time status updates in these applications, allowing for quick decision-making and response to changing conditions.

For example, in traffic management systems, Class C nodes can monitor traffic flow and signal control devices for real-time adjustments based on the data received from the nodes.

Additionally, Class C nodes:

  • Have a higher power consumption than Class A and Class B nodes, as they’re always listening for incoming data from the network.
  • Can be powered using a mains power supply, making them suitable for applications where battery life is not critical.
  • Are designed for applications that require real-time, continuous communication.
  • Have the lowest latency of all LoRaWAN nodes and are ideal for security systems, traffic management, and industrial automation applications.

Figure 8. A LoRa-based Monskart panic button.

Examples
Class C nodes have a higher power consumption, making them reliable and always “on.” This means they can be used for critical services, such as:

  • Emergency services: Real-time tracking and communication systems for emergency responders and personnel.
  • Security systems: Intrusion detection and surveillance systems for homes, offices, and public areas.
    Wildlife tracking: Monitoring the behavior and movements of wildlife in conservation efforts.
    Flood monitoring: Early detection and monitoring of water levels in rivers, lakes, and flood-prone areas.

Figure 9. A SEMTECH security system with LoRa.

The custom node
Although the classes are defined within LoRa, this doesn’t mean you’re restricted to using only one class at a time — with the right hardware. It’s possible to write code so that a node works in C mode for some time, then shifts to Class A or B at another point, depending on the application.

Example: Pet tracking
Imagine developing a pet tracker for your beloved companion. Typically, you walk your pet between 4 to 5 p.m. To optimize the device’s functionality, you can program it with the following characteristics:

Figure 10. A custom node pet-tracking device.

During non-walking periods (outside of 4-5 p.m.):

    1. Configure the tracker to operate in LoRa Class A.
    2. Data transmission occurs every 10 minutes without requiring confirmation ACK.

This approach conserves power during regular intervals.

During the walking time:

    1. Switch the tracker to LoRa Class C.
    2. Since time is critical and your pet could run away, real-time tracking is essential.
    3. Stream data at a rapid rate of 500 milliseconds to ensure accurate and immediate tracking.

By adopting this approach, the pet tracker’s power efficiency is optimized during non-walking hours but responsive between 4-5 p.m. when walking with your pet. Essentially, the device operates in a power-saving mode most of the time but transitions to a high-frequency tracking mode during the critical walking period.

Programming for low-power
Programming in low-power mode means optimizing the use of peripherals and minimizing unnecessary processing. For example, the use of interrupts instead of continuous polling can reduce power consumption. However, it’s important to consider the power supply and ensure it’s fully optimized for the specific low-power mode being used. This may involve selecting a power supply with a low quiescent current or using a voltage regulator with a low dropout voltage.

Data serialization is another essential consideration. LoRaWAN uses a specific format for data transmission, so it’s important to understand how to serialize data into this format for transmission.

In future articles, we’ll learn how to code LoRa nodes and make a working application.

 

You may also like:


  • How LoRa can impact smart cities with parking sensors

  • Understanding LoRa architecture: nodes, gateways, and servers

  • How communication works between two LoRa end-node devices

  • How LoRa enables long-range communication

  • What is LoRa and LoRaWAN?

  • What are LoRa gateways and what types are available?

  • What is the LoRaWAN network and how does it work?

Filed Under: IoT tutorials, Tutorials
Tagged With: battery, internetofthings, IoT, longrange, lora, network, node
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Input impedance matching network
  • Solder Thermal Interface Material
  • Is it possible to improve accuarcy of ad633
  • Unity Gain Buffer with 0 to 0.5V Range
  • Battery sensing circuitry for coin cell application

RSS Electro-Tech-Online.com Discussions

  • Trail camera
  • how to work on pcbs that are thick
  • can a AT89C51 be used as a rom?
  • Telegram Based Alarm - Sensor cable protection
  • using a RTC in SF basic

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • ITG Electronics releases gate drive transformers with 200 – 450 V DC capability
  • Stackpole introduces HCJ jumpers with 70.7 amp continuous current capability
  • Infineon releases MCU with 128K flash and multi-sense capabilities
  • ST introduces 600V GaN gate drivers with 300 ns start-up time
  • ABLIC releases S-19116 automotive voltage detector with 6.8μs response time

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe