Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

CircuitPython helper to decode LoRa mesh packets.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-meshfruit

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_meshfruit

Usage Example

import adafruit_rfm9x
import board
import digitalio

import adafruit_meshfruit

FREQUENCY = 906.875
CHANNEL_HASH = 0x08
SYNC_WORD_REG = 0x39
SYNC_WORD = 0x2B

rfm9x = adafruit_rfm9x.RFM9x(
    board.SPI(),
    digitalio.DigitalInOut(board.D11),
    digitalio.DigitalInOut(board.D12),
    FREQUENCY,
)
rfm9x.signal_bandwidth = 250000
rfm9x.spreading_factor = 11
rfm9x.coding_rate = 5
rfm9x.preamble_length = 16
rfm9x.enable_crc = True
rfm9x._write_u8(SYNC_WORD_REG, SYNC_WORD)  # noqa: SLF001

mesh = adafruit_meshfruit.Meshtastic()

print("listening on", FREQUENCY, "MHz")

while True:
    raw = rfm9x.receive(with_header=True, timeout=5.0)
    if raw is None:
        continue
    if len(raw) <= adafruit_meshfruit.HEADER_LEN:
        continue

    packet = mesh.decode(raw)
    if packet.channel_hash != CHANNEL_HASH:
        continue

    if packet.portnum == adafruit_meshfruit.PORT_TEXT_MESSAGE and packet.payload:
        print(packet.sender_id, packet.text)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-meshfruit 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-meshfruit 1.0.0
File Size Uploaded
adafruit_circuitpython_meshfruit-1.0.0.tar.gz 25.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-meshfruit 1.0.0
File Interpreter ABI Platform
adafruit_circuitpython_meshfruit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.5 kB

Release files / adafruit_circuitpython_meshfruit-1.0.0.tar.gz

Download URL adafruit_circuitpython_meshfruit-1.0.0.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ca81a12a7c9765edb56b6fa71fc1c2d7516634d47e67e053deb31a0e1ab4efe6
BLAKE2b-256 checksum
How to use checksums
5d670390c9b0bf9eaf22419d26e47cac396200f66e3633e3b388c7ac284dca72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / adafruit_circuitpython_meshfruit-1.0.0-py3-none-any.whl

Download URL adafruit_circuitpython_meshfruit-1.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c149d4f3b971b867d7d07920df673c455bd5df4a3bf0c9003088f56bad9f60a1
BLAKE2b-256 checksum
How to use checksums
0611af64929756d3d49fb622b46436d39859c71bd30d1d512e403e7cf5b34486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page