Skip to content

Latest commit

 

History

History
419 lines (324 loc) · 17.1 KB

File metadata and controls

419 lines (324 loc) · 17.1 KB

Communication Bridge for MeshCore

Free and Open Source Software (FOSS) — An Android app that bridges your MeshCore mesh radio to internet services, enabling off-grid access to messaging and data.


🛒 Purchase Pre-built APK ($15)

👉 Purchase the pre-built APK ($15) — Get it now!

  • One-time payment — Lifetime access
  • Signed APK — Ready to install
  • Supports development — Help keep this project alive
  • All features included — Same as building from source

Or build from source for free — both options include all features!


⚠️ Important Disclaimer

SMS Bridging at Your Own Risk

This app bridges SMS messages between your MeshCore device and your phone or SMS API services. By using this app:

  • ⚠️ You are responsible for all SMS charges — Standard SMS rates apply to your carrier plan
  • ⚠️ Premium SMS charges — Be cautious when messaging premium-rate numbers (e.g., short codes, subscription services). These can incur significant charges ($1-$10+ per message)
  • ⚠️ International SMS — International messaging may incur additional charges
  • ⚠️ API costs — If using SMS API providers (Twilio, Vonage, etc.), you are responsible for their pricing
  • ⚠️ Use at your own risk — The developers are not responsible for any charges incurred

Recommendation: Monitor your SMS usage and charges, especially when bridging to unknown numbers or premium services.


License: This project is licensed under the GNU General Public License v3.0 (GPL v3).

Ideal for users who want to run an independent MeshCore device (like the Lilygo T-Deck) but still need access to SMS, Telegram, and internet services—without carrying a second phone.

📖 FOSS & Pricing

This app is Free and Open Source Software. You have two options:

Option Price What You Get
Build from Source Free Clone repo, build with Android Studio
Pre-built APK $15 one-time Convenience, signed APK, supports development

Both options give you the full app with all features. Purchasing supports ongoing development and is greatly appreciated, but never required.

Use Cases

  • 📍 Remote hiking/camping — Stay in touch via mesh when no cell signal
  • 🆘 Emergency preparedness — Backup communication during outages
  • 🏔️ Off-grid living — Access internet services via mesh relay
  • 📈 Information access — Get crypto/stock prices, weather, AI chat from anywhere
  • 👨‍👩‍👧‍👦 Family coordination — Group messaging across mesh network
  • 📱 Single-device carry — Leave your phone at base camp, take only your T-Deck

What It Does

                              INTERNET SERVICES
    ┌───────────────┐  ┌───────────────┐  ┌───────────────┐
    │   Telegram    │  │  Device SMS   │  │ SMS Providers │
    │      API      │  │   (on phone)  │  │ Twilio/Vonage │
    └───────┬───────┘  └───────┬───────┘  └───────┬───────┘
            │                  │                  │
            └──────────────────┼──────────────────┘
                               │
    ┌───────────────┐  ┌───────┴───────┐  ┌───────────────┐
    │   Groq AI     │  │               │  │  Twelve Data  │
    │  (LLaMA 3)    │──│   Android     │──│  Prices API   │
    └───────────────┘  │     App       │  └───────────────┘
                       │               │
    ┌───────────────┐  │  ┌─────────┐  │
    │  Open-Meteo   │──│  │ Bridge  │  │
    │  Weather API  │  │  │ Manager │  │
    └───────────────┘  │  └─────────┘  │
                       └───────┬───────┘
                               │
                           Bluetooth LE
                               │
                       ┌───────┴───────┐
                       │   MeshCore    │
                       │    Device     │
                       └───────┬───────┘
                               │
                           LoRa Radio
                               │
                       ┌───────┴───────┐
                       │  Other Mesh   │  ← Up to 10km range
                       │    Nodes      │
                       └───────────────┘

Channel Names

The app creates these channels on your MeshCore device:

Messaging Bridges

Channel Purpose
Telegram Bridges messages to/from Telegram contacts
SMS Bridges messages to/from device SMS (uses phone's native SMS)
SMS (API) Bridges messages via SMS API providers (Twilio, Vonage, etc.)

Service Channels

Channel Purpose
Groq AI chat powered by LLaMA 3 via Groq API
Weather Weather forecasts via Open-Meteo (free, no API key)
Trading Crypto and stock prices via Twelve Data API

Available Commands

Send these commands from any mesh node:

AI Chat (Groq Channel)

Command Description Example Response
#q <query> Ask AI a question AI-generated answer
#help Show available commands List of commands

Price Lookup (Trading Channel)

Command Description Example Response
#p btc Bitcoin price "BTC: $67,432 ↑2.3%"
#p eth Ethereum price "ETH: $3,521 ↓1.2%"
#p AAPL Stock price "AAPL: $178.50 ↑0.8%"
#p gold Gold price (via PAXG) "Gold: $2,340 ↑0.5%"

Weather (Weather Channel)

Command Description Example Response
#w <city> Weather forecast "Sydney, AU: 24°C, Sunny H:28 L:18"

Message Sync (SMS/Telegram Channels)

Command Description Example
#sync Sync messages since last activity #sync
#syncn [N] Sync last N messages (max 10) #syncn 5
#synch [H] Sync last H hours (max 24) #synch 2

Message Bridging with Handles

Handles (@name) route messages to the right contact:

  MeshCore Channels        Bridge App           Internet Contacts
 ┌─────────────────┐     ┌──────────┐         ┌─────────────────┐
 │ Channel:        │     │          │         │ Telegram        │
 │ "Telegram"      │◄───►│          │◄───────►│ @johnsmith      │
 │                 │     │          │         │ @sarahjones     │
 ├─────────────────┤     │  Handle  │         └─────────────────┘
 │ Channel:        │     │  Mapping │         ┌─────────────────┐
 │ "SMS"           │◄───►│          │◄───────►│ Phone Contacts  │
 │                 │     │          │         │ @johndoe        │
 ├─────────────────┤     │          │         └─────────────────┘
 │ Channel:        │     │          │         ┌─────────────────┐
 │ "SMS (API)"     │◄───►│          │◄───────►│ API Numbers     │
 │                 │     └──────────┘         │ @customer1      │
 └─────────────────┘                          └─────────────────┘

How Handles Work

Sending to a contact:

You type on MeshCore:    @johndoe Hello there!
Bridge sends SMS to:     +1-555-123-4567 (mapped to @johndoe)

Receiving from a contact:

SMS arrives from:        +1-555-123-4567 (John Doe in contacts)
Bridge forwards to:      @johndoe Hey, got your message!
You see on MeshCore:     @johndoe Hey, got your message!

Handles are auto-generated from contact names (e.g., "John Doe" → @johndoe).

Supported Services

Messaging Bridges

Service Channel Description
Telegram Telegram Full bidirectional messaging via TDLib
Device SMS SMS Uses phone's native SMS (no API needed)
Twilio SMS (API) Cloud SMS via Twilio API
Vonage SMS (API) Cloud SMS via Vonage API
Plivo SMS (API) Cloud SMS via Plivo API
AWS SNS SMS (API) Cloud SMS via AWS SNS
MessageBird SMS (API) Cloud SMS via MessageBird API

Data Services

Service Channel API Required
AI Chat Groq Groq API key (free tier available)
Weather Weather None (uses free Open-Meteo API)
Prices Trading Twelve Data API key

Getting Started

Requirements

  • Android 12+
  • MeshCore-compatible radio
  • Bluetooth enabled

Quick Setup

  1. Install the app (build from source or purchase pre-built APK)
  2. Scan for your MeshCore device
  3. Connect via Bluetooth
  4. Configure services in Settings:
    • Telegram: API ID, API Hash, Phone Number
    • SMS API (optional): Provider API keys
    • AI Chat (optional): Groq API key
    • Prices (optional): Twelve Data API key
    • Weather: No setup needed (free API)

Installation Options

Option 1: Purchase Pre-built APK ($15)

  • Purchase here → (see top of page for details)
  • After purchase, you'll receive an activation code via email
  • Enter the code in the app to activate
  • One-time payment, lifetime access, supports development

Option 2: Build from Source (Free)

git clone https://github.com/theideasman/meshcore-bridge
cd meshcore-bridge
./gradlew assembleDebug

APK output: app/build/outputs/apk/debug/app-debug.apk

How Handles Are Created

Handles are created automatically when messages arrive:

Source Handle Generated
Telegram user "John Smith" @johnsmith
SMS from contact "Mom" @mom
SMS from unknown +15551234567 @15551234567 (full number)
Collision (two "John Smith") @johnsmith4567 (last 4 digits added)

⚠️ Important: You must receive a message from a contact first before you can use their handle. The handle is created when their first message arrives.

To send to a contact, prefix with their handle:

@johnsmith Hi there!
@mom Call me when you can
@15551234567 Message to unknown number

Example Conversation

Once a handle is used, you don't need to repeat it for follow-up messages:

← SMS from Mom: "Are you coming for dinner?"     → Bridge creates @mom
↓ You see on MeshCore: "@mom Are you coming for dinner?"

→ You type: "@mom Yes, be there at 6"            → Bridge sends SMS to Mom
← Mom replies: "Great, see you then!"
↓ You see: "@mom Great, see you then!"

→ You type: "Should I bring anything?"           → No handle needed!
                                                   Bridge remembers last contact
← Mom replies: "Just yourself 😊"
↓ You see: "@mom Just yourself 😊"

The bridge remembers the last active contact, so you only need the handle when switching to a different person.

Technical Details

Setting Value
Bluetooth Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
Connection Auto-reconnect with exponential backoff
Heartbeat Every 60 seconds
Watchdog 120 seconds timeout
Keepalive Every 30 minutes (prevents device sleep)
Message limit 133 characters per message
Range Up to 10km (LoRa)

Message Throttling and Flood Protection

The bridge implements intelligent message throttling to prevent mesh network congestion and ensure fair bandwidth sharing.

Exponential Throttling

Messages sent to MeshCore are automatically throttled with exponential backoff to respect the mesh network:

Message # Delay
1st 0ms (no delay)
2nd 100ms
3rd 200ms
4th 400ms
5th 800ms
6th 1600ms
7th+ 2000ms (capped)

Benefits:

  • Prevents mesh network congestion
  • Allows other traffic to flow between message bursts
  • Automatically resets after 30 seconds of inactivity

Flood Detection

If messages from the same bridge (SMS, Telegram, or SMS API) are sent continuously for 30 seconds, the bridge will:

  1. Stop sending messages to prevent mesh congestion
  2. Notify the user with a message like:
    ⚠️ Message flooding detected from SMS bridge. 
    Stopped sending messages to prevent mesh congestion. 
    Messages will resume after 30 seconds of inactivity.
    
  3. Automatically resume after 30 seconds of inactivity

Per-Bridge Tracking

Each bridge type tracks throttling independently:

  • SMS bridge → MeshCore: Independent throttling
  • Telegram bridge → MeshCore: Independent throttling
  • SMS API bridge → MeshCore: Independent throttling

This means if one bridge is flooding, other bridges continue to work normally.

Why This Matters

Mesh networks share limited bandwidth. Without throttling:

  • Rapid message bursts can monopolize the network
  • Other nodes may be unable to send messages
  • Network performance degrades for all users

With throttling:

  • Fair bandwidth sharing across all nodes
  • Better network stability and reliability
  • Automatic protection against accidental flooding

Building from Source

This app is Free and Open Source Software. You can build it yourself:

git clone https://github.com/theideasman/meshcore-bridge
cd meshcore-bridge
./gradlew assembleDebug

APK output: app/build/outputs/apk/debug/app-debug.apk

Requirements for Building

  • Android Studio (latest stable)
  • JDK 17+
  • Android SDK 34+

Troubleshooting

Problem Solution
Activation code not working Check code spelling, ensure internet connection, create a GitHub issue
Can't find device Power on MeshCore, ensure it's advertising, toggle Bluetooth
Connection drops Disable battery optimization for app, grant all permissions
Messages not forwarding Check that the correct channel exists (Telegram/SMS/SMS (API))
Handle not found The contact must message you first to create the mapping
#q not working Enable Groq bridge in Settings and add API key
#p not working Enable Trading bridge in Settings and add Twelve Data API key
#w not working Enable Weather bridge in Settings (no API key needed)
Channel not appearing Reconnect to device, channels are created when bridge is enabled

Permissions Required

Permission Purpose
Bluetooth, Nearby Devices Connect to MeshCore via BLE
Location Required for BLE scanning on Android 12+
SMS (Read/Send/Receive) Bridge SMS messages
Contacts Map phone numbers to contact names
Phone State Detect SMS capability
Camera Scan QR codes for channel setup
Internet API calls (Groq, Twelve Data, Open-Meteo)
Foreground Service Keep bridge running in background
Wake Lock Prevent CPU sleep during BLE operations
Battery Optimization (exempt) Keep connection alive when screen off

Support

For support, bug reports, or questions, please use GitHub Issues:

Contributing

This is an open source project! Contributions are welcome:

  • Bug fixes and improvements via Pull Requests
  • Feature suggestions via GitHub Issues
  • Documentation improvements
  • Translations

License

This project is licensed under GPL-3.0 — free to use, modify, and distribute.

If you find this app useful, consider supporting development:


Requires: MeshCore-compatible radio device
More info: MeshCore on GitHub