Skip to content

Repository files navigation

offgrid-raspi

MIT Python systemd

Raspberry Pi edge node for the IntelShed spatial intelligence platform. Provides offline situational awareness, sensor ingest, and Meshtastic mesh integration. Designed to operate independently when the PC is unavailable.

Tested on Raspberry Pi 4 (4 GB), Raspberry Pi OS. English UI on the device.

Overview

The Pi functions as the primary always-on node (12V/UPS). The IntelShed PC stack provides fusion analytics, globe visualization, and briefing generation. The Pi survives without the PC — offline services, local display, and cached briefings remain operational.

Role Pi (12V) — Primary PC (220V) — IntelShed
LLM Inference Small models (1-2B) Large models (7B+) via Ollama
Security briefing Pull + display Generate + store
Telemetry Push sensors, mesh, GPS Ingest + fuse
RAG Local vector search (V4-33) Export condensed KB
Data Processing Live display, cache Globe layers, intel graph

Features

Layer Components
Display SPI LCD dashboard (7 pages), resistive touch
Portal Web UI :8093 — status, Pi-hole stats, LLM chat, mesh TX, world/GEOPOL
Offline RAG SQLite vector store + numpy cosine similarity :8081 (V4-33, WORLDBASE_PI_RAG=0)
Offline Kiwix :8080, MBTiles maps :8082, optional llama.cpp :8083
Network Pi-hole DNS, wg-easy, Tor, optional DNS shield
Mesh MQTT tap + TX downlink from Pi → Heltec gateway → LoRa
Sensors ESP32 UDP :5005, USB DHT22 ingest
Data world-sync timer — markets, news, space weather, geo hotspots
AI Safety HAK_GAL Edge prompt firewall :8084

Large content (ZIM files, GGUF models, map tiles) is not stored in git — see offgrid/content/.

PC ↔ Pi Sync

Direction Pi service PC endpoint
Pi → PC worldbase_push (~45 s) POST /api/node/ingest
PC → Pi worldbase_pull (~5 min) GET /api/node/pullbriefing_latest.json
PC → Pi RAG sync (on pull) GET /api/node/rag → Pi POST /sync

Scripts: scripts/worldbase_push.py, scripts/worldbase_pull.py Full guide: docs/WORLDBASE_PI_SYNC.md PC setup: IntelShed docs/SETUP.md

Architecture

+------------------+     push / pull / rag      +------------------+
|   Raspberry Pi   |  <---------------------->  |   Windows PC     |
|   offgrid-raspi  |       SSH / LAN :8002      |   IntelShed      |
|   12V / UPS      |                            |   220V / GPU     |
|   Always-On      |                            |   Ollama + feeds |
+------------------+                            +------------------+

LAN addresses (reference build)

Host IP Notes
Raspberry Pi 192.168.1.121 SSH user user0
Windows PC 192.168.1.111 IntelShed backend
Heltec mesh tracker 192.168.1.120 Meshtastic GPS (not the PC)
Heltec V3 router 192.168.1.122 MQTT gateway

Quick start

git clone https://github.com/sookoothaii/offgrid-raspi.git
cd offgrid-raspi

# Overview
./offgrid/bin/offgrid-status

# Setup (idempotent, requires sudo)
sudo bash offgrid/setup/00_base.sh

Full manual: offgrid/OFFGRID.md Architecture notes: AGENTS.md

Pi RAG Service (V4-33)

Lightweight RAG on the Pi — SQLite vector store with numpy-based cosine similarity. No external dependencies beyond numpy and FastAPI.

# Enable
export WORLDBASE_PI_RAG=1
python pi_rag.py
# → GET /search?q=... on :8081

Knowledge base syncs from IntelShed via GET /api/node/rag. The Pi serves search results from local storage when the PC is offline. Feature flag: WORLDBASE_PI_RAG=0 (default off).

Tests: python -m pytest tests/test_pi_rag.py

Windows Tools (PC side)

Script Function
setup_pc_lan.ps1 OpenSSH on Windows + Pi key for Pi→PC SSH
connect_pi.bat SSH terminal, tunnel, VS Code remote, WinSCP
pi_remote_desktop.ps1 VNC Viewer — Pi desktop in a PC window
mount_pi_sshfs.ps1 Mount Pi as Windows drive P: via SSHFS
pi_control_center.py Web dashboard — status, deploy, sync
deploy_pi.ps1 Push code to Pi (git pull + restart services)
twin_sync.ps1 Mirror Pi data to PC
pi_guardian.ps1 Background monitor — alarm if Pi goes offline

Hardware

  • Raspberry Pi 4 (4 GB), YurBot ICE Box RPi Fan X2
  • Power: 90 Ah AGM battery + APC UPS
  • 2.4″ ILI9341 SPI + XPT2046 touch → /dev/fb1
  • ESP32 sensor nodes (UDP :5005)

Contributing

Issues and PRs welcome. Prefer small, reproducible changes.

License

MIT — see LICENSE.

About

Off-grid Raspberry Pi node — offline services, local RAG, Meshtastic mesh, sensor ingest. Operates independently when the PC is unavailable.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages