Skip to main content

A Python MeshCore library with SPI LoRa radio support

Project description

openHop Core

Documentation PyPI License

openHop Core is a Python reimplementation of MeshCore — a lightweight, portable C++ library for multi-hop packet routing using LoRa radios. Designed for Raspberry Pi and similar hardware, openHop Core communicates with LoRa modules over SPI.

openHop Core is under active development. It's compatible with the original MeshCore protocol, but not yet as optimized or elegant as its C++ counterpart.

Documentation

**Complete documentation is available at https://rightup.github.io/openhop-core/

Quick Links

Quick Start

Installation

Important: On modern Python installations (Ubuntu 22.04+, Debian 12+), you may encounter externally-managed-environment errors when installing packages system-wide. Create a virtual environment first:

# Create virtual environment
python3 -m venv openhop_env

# Activate virtual environment
# On Linux/Mac:
source openhop_env/bin/activate
# On Windows:
openhop_env\Scripts\activate
# Install from PyPI
pip install openhop-core

# For hardware support (SX1262 radios)
pip install openhop-core[hardware]

# Install all dependencies
pip install openhop-core[all]

Basic Usage

import asyncio
from openhop_core import MeshNode, LocalIdentity
from openhop_core.hardware.sx1262_wrapper import SX1262Radio

async def main():
    # Create radio (Waveshare HAT example)
    radio = SX1262Radio(
        bus_id=0, cs_pin=21, reset_pin=18,
        busy_pin=20, irq_pin=16, txen_pin=6,
        frequency=869525000, tx_power=22
    )
    radio.begin()

    # Create mesh node
    identity = LocalIdentity()
    node = MeshNode(radio=radio, local_identity=identity)
    await node.start()

    print("Mesh node started!")

asyncio.run(main())

For examples, see the documentation.

Hardware Support

Supported Radios

  • Waveshare SX1262 LoRaWAN/GNSS HAT - Popular Raspberry Pi LoRa module
  • HackerGadgets uConsole - All-in-one extension board with LoRa support
  • FrequencyLabs meshadv-mini - Raspberry Pi hat with E22-900M22S LoRa module

Requirements

  • Raspberry Pi (or compatible SBC)
  • SX1262 LoRa module
  • SPI interface enabled
  • Python 3.8+

What is MeshCore?

MeshCore enables long-range, decentralized communication using multi-hop packet routing. Devices (nodes) forward packets through neighboring nodes to reach distant ones — no central infrastructure required.

It occupies a middle ground between:

Project Focus
Meshtastic Casual LoRa messaging
Reticulum Full encrypted networking stack

Use Cases

  • Off-grid and emergency communication
  • Tactical or field mesh deployments
  • IoT mesh networks
  • Remote monitoring systems

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Application   │    │   MeshNode      │    │   Hardware      │
│                 │    │                 │    │                 │
│ • Text Messages │◄──►│ • Packet Routing│◄──►│ • SX1262 Radio  │
│ • Advertisements│    │ • Identity Mgmt │    │ • SPI Interface │
│ • Telemetry     │    │ • Event Service │    │ • GPIO Control  │
│ • Group Channels│    │ • Repeater Mgmt │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Security

  • Ed25519/X25519 cryptographic identities
  • End-to-end encryption for messages
  • CRC validation for data integrity
  • Secure key exchange protocols

Project Structure

openHop Core/
├── src/openhop_core/          # Main package
│   ├── hardware/           # Radio hardware interfaces
│   ├── node/               # MeshNode implementation
│   ├── protocol/           # Packet protocols
│   └── events/             # Event handling
├── examples/               # Working examples
│   ├── common.py           # Shared utilities
│   ├── send_flood_advert.py
│   ├── send_direct_advert.py
│   └── ...
├── docs/                   # MkDocs documentation
│   ├── docs/               # Documentation source files
│   ├── mkdocs.yml          # MkDocs configuration
│   ├── requirements.txt    # Documentation dependencies
│   └── serve-docs.sh       # Local development script
├── .github/workflows/      # GitHub Actions
│   └── deploy-docs.yml     # Documentation deployment pipeline
└── tests/                  # Unit tests

Contributing

Contributions are welcome! Please see our contributing guide for details.

Development Setup

# Clone the repository
git clone https://github.com/rightup/openHop Core.git
cd openHop Core

# Install development dependencies
pip install -e .[dev]

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Original MeshCore C++ implementation
  • Waveshare and HackerGadgets for hardware support

Support


Built with ❤️ for mesh networking enthusiasts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openhop_core-1.1.1.tar.gz (356.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openhop_core-1.1.1-py3-none-any.whl (287.4 kB view details)

Uploaded Python 3

File details

Details for the file openhop_core-1.1.1.tar.gz.

File metadata

  • Download URL: openhop_core-1.1.1.tar.gz
  • Upload date:
  • Size: 356.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openhop_core-1.1.1.tar.gz
Algorithm Hash digest
SHA256 bcf363248d116d590e62dbe88e8aafccf38d1271e7d44adfca1be8c40f43b46c
MD5 85d5d1794853c57882f416ecf0130037
BLAKE2b-256 ce604a81a09a69fe374f85e45f00443c8ef2798ab5d502fdb1af3e0aacc0c815

See more details on using hashes here.

Provenance

The following attestation bundles were made for openhop_core-1.1.1.tar.gz:

Publisher: publish-pypi.yml on pyMC-dev/pyMC_core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openhop_core-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: openhop_core-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 287.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openhop_core-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dec24bdd39c2134e0ba721c77fb6c05996c5aa1c0357c687b5a9574c6728a5da
MD5 d6f3b47752e695e91bd95797908b5315
BLAKE2b-256 7479085fc9ac0dea9db646b3b1eda47b05394eb6d2d948dd7d5a0da54fa6185d

See more details on using hashes here.

Provenance

The following attestation bundles were made for openhop_core-1.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on pyMC-dev/pyMC_core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page