Showing posts with label heltec. Show all posts
Showing posts with label heltec. Show all posts

Friday, May 17, 2024

LoRA / Meshtastic & Unlicensed ISM

What is LoRA?

LoRA (which stands for Long Range) is a wireless communication technology designed for long-range, low-power communication in the Internet of Things (IoT) applications. It operates on unlicensed radio bands and is known for its ability to transmit data over long distances while consuming minimal power. LoRA technology is often used for connecting devices that need to communicate over long distances, such as in smart city applications, industrial automation, agricultural monitoring, and much, much more.

The official organization of LoRA is called the LoRA Alliance. The LoRA Alliance is an open, nonprofit association that has a mission to standardize Low Power Wide Area Network (LPWAN) technologies to enable Internet of Things (IoT) applications worldwide. The Alliance collaborates with various companies and organizations to promote and advance the LoRaWAN protocol.

There are also different LoRa frequencies available for use. LoRa technology operates in different frequency bands depending on the region. The most common frequency bands for LoRa are 433 MHz, 868 MHz, and 915 MHz. These frequencies are used in different parts of the world to comply with local regulations and standards for wireless communication. Europe mainly uses 433 Mhz and 868 Mhz. 433 Mhz is still used in the United States, but just not as common. One project in particular that primarily uses 433 Mhz is TinyGS.

What the heck is TinyGS?!

TinyGS is a project that aims to create a global network of ground stations to receive and decode data from small satellites, also known as CubeSats. These ground stations are designed to be low-cost and easy to set up, allowing for a decentralized network that can support communication with a wide range of CubeSats. The project focuses on enabling communication with small satellites to enhance their capabilities and increase the accessibility of space technology.

Then who/what is Meshtastic?
When I hear about LoRA, I hear a LOT about Meshtastic.

Meshtastic is an open-source project that aims to create a long-range, low-power mesh networking platform using off-the-shelf hardware and open-source software. It allows users to communicate with each other over long distances without the need for cellular networks or internet connectivity by creating a mesh network using radio frequencies. Meshtastic devices can communicate with each other directly or through other devices in the network, enabling communication in remote areas or during emergencies where traditional communication methods may not be available.
Meshtastic Wiki: https://meshtastic.org/docs/introduction/
Flash Meshtastic to a Compatible Device: https://flasher.meshtastic.org/

So how does all of this work?!

The LoRa technology typically operates in unlicensed ISM bands, such as 915 MHz in the USA. Unlicensed ISM (Industrial, Scientific, and Medical) bands are radio frequency bands designated by regulatory bodies, such as the Federal Communications Commission (FCC) in the United States, for use without the need for a specific license. These bands are intended for industrial, scientific, medical, and other applications that do not interfere with licensed services. Devices operating in unlicensed ISM bands must comply with certain technical requirements to ensure they do not cause harmful interference to other users. Common examples of devices that operate in unlicensed ISM bands include Wi-Fi routers, Bluetooth devices, and microwave ovens.

What does a typical LoRA device setup look like?

First Things First: Set your Device's Region

In order to start communicating over the mesh, you must set your region for your Meshtastic/LoRA device. This setting controls which frequency range your device uses and should be set according to your regional location.


Channels, Frequencies, and Frequency Slots:

The specific frequency settings you would use depend on your region, the LoRa module being used, and specific network configurations. For instance...

The Long_Fast LoRA "Channel" is the common/public frequency all LoRA radios can communicate on/through. However, the Frequency might be 902.875 Mhz or it could be using 914 Mhz. To determine what frequency will be used for sending and receiving data, a "Frequency Slot" is used to calculate what specific frequency data will be transmitted. Most LoRA radios will automatically set the needed frequency, based on the "slot" that has been selected. However, sometimes you will find that you will need to manually configure the frequency.

An easy way to figure out what frequency you need that is correlating to the "slot" that is needed/being used, is to use Meshtastic's Frequency/Slot calculator:

https://meshtastic.org/docs/overview/radio-settings/

You can also create your own channel, using your own slot, and even using an "overriding frequency" to help with the privacy of your communication. But that is all for another blog post :)

Radio/Device Role:

  • Router:
    A device acting as a router helps in forwarding data packets within the mesh network. It plays a crucial role in routing messages between different nodes in the network.
  • Router/Client:
    A router client device typically refers to a node in the network that is not actively involved in routing or repeating messages but rather consumes data or interacts with the network for specific purposes. But it also serves the role of a router and helps in forwarding data packets within the mesh network. It plays a crucial role in routing messages between different nodes in the network.
  • Repeater:
    A repeater device extends the range of the mesh network by receiving messages from one node and then retransmitting them to reach nodes that are out of direct communication range.  
  • Client:
    A client device typically refers to a node in the network that is not actively involved in routing or repeating messages but rather consumes data or interacts with the network for specific purposes. 
  • Gateway:
    A gateway device serves as a bridge between the mesh network and external networks or the internet. It facilitates communication between the mesh network and other networks. 
  • Tracker:
    Some Meshtastic devices can also act as trackers, providing location information that can be shared within the mesh network. Each of these roles plays a vital part in ensuring effective communication and connectivity within a Meshtastic Lora mesh network.

MQTT:

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol that is commonly used in IoT (Internet of Things) applications for efficient communication between devices. In the context of LoRa (Long Range), MQTT can be utilized to facilitate the exchange of data between LoRa devices and a central server or cloud platform. By using MQTT, LoRa devices can publish data to specific topics or subscribe to topics to receive relevant information, enabling seamless communication and data transfer in LoRa-based IoT networks. MQTT also helps with reporting device location and allowing long-distance communications over the LoRA network, even if your radios are out of RF range. Your LoRA device can also report to MQTT by proxy, through the device that the LoRA radio is connected to.


Creating a Private Primary, and Secondary "Public" Channels:

  1. If you'd like to connect with other Meshtastic users but only share your data with trusted parties, you may create a private PRIMARY channel and use the default "Long_Fast" network as a SECONDARY channel. 
  2. Ensure you have not changed the LoRa Modem Preset from the default unset / LONG_FAST.
  3. On your PRIMARY channel, set anything you'd like for the channel's name and choose a random PSK. Save this information and/or take a screenshot of the information and/or the QR Code so you can connect other devices to your private channel.
  4. Enable a SECONDARY
  5. Name the secondary channel "LongFast" with a PSK of "AQ==".
  6. If your LoRa frequency slot is set to the default (0), the radio's transmit frequency will be automatically changed based on your PRIMARY channel's name. 
  7. You may also manually configure the frequency slot for your radio as well.
  8. The most commonly used frequency slot in the US is Frequency Slot 20.
  9. After doing all of this, you may have to manually set your LoRA radio back to your region's default settings (in LoRa settings) in order to interface with users on the default slot again.

Channel Uplink & Downlink:

  • Uplink Enabled:
    • The channel can send messages from the local mesh to MQTT
  • Downlink Enabled:
    • The channel can send messages from the MQTT to the local mesh.

What kind of device do I need to get started with LoRA?

ESP32 Based Boards:

The ESP32 chip is older and consumes more power than the nRF52 chip, but is equipped with both WiFi and Bluetooth. Supported ESP32 devices include:

nRF52 Boards:

The nRF52 chip is much more power efficient than the ESP32 chip and easier to update but is only equipped with Bluetooth. Supported nRF52 devices include:

RP2040 Boards:

The RP2040 is a dual-core ARM chip developed by Raspberry Pi. Supported RP2040 devices include:

To learn more on how to get started with Meshtastic and LoRA, as well as much more in-depth setup and configuration instructions/documentation, please check out the official Meshtastic Wiki:

meshtastic.org/docs/introduction