Skip to content

Purujith-Kadekar/pi-knowledge-hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pi Knowledge Hub - Offline Library

Overview

This repository contains the source code and configuration for the Local Knowledge Hub, a Raspberry Pi-based offline server designed to deliver educational content (Wikipedia, Khan Academy) to classrooms without internet access.

It tracks the evolution of the project from a simple static HTML page to a complex, hardware-aware dashboard with real-time telemetry.

📂 Repository Structure

  • versions/: Contains the HTML/CSS/JS for every iteration of the landing page.
    • v0.x: Basic static links.
    • v1.x: Interactive UI with sticky headers and flip cards.
    • v2.x: Live hardware monitoring (CPU, RAM, Solar Power Flow).
  • services/: Python backend scripts (metrics_server.py, power_server.py) that provide JSON APIs for the dashboard.
  • systemd/: Service files to auto-start the web servers and APIs on boot.

🚀 Phase 1: Infrastructure Setup (v0.x)

Basic setup of the Hotspot and Kiwix server.

1. Install Kiwix

  • Download kiwix-tools for ARM64/ARMv7 (depending on your Pi).
  • Download ZIM files (e.g., wikipedia_en_simple.zim).

2. Configure Service

Copy systemd/kiwix-serve.service to /etc/systemd/system/.

  • Note: Edit the ExecStart line to point to your specific .zim files.

🎨 Phase 2: Interactive UI (v1.0 - v1.1)

Introduces a modern, responsive design using CSS Grid and Flexbox.

  • v1.0: Implemented the "Sticky Header" design for better navigation.
  • v1.1: Added "Flip Cards" to showcase hardware specs (Pi Zero 2W, 18650 Battery, etc.).
  • Credits: Updated project team section to feature lead developer Purujith Kadekar.

📊 Phase 3: Live System Performance (v1.2 - v1.3)

This phase introduces real-time monitoring of the Raspberry Pi's health (CPU, RAM, Uptime).

1. Setup Backend Service

  1. Copy the metrics server:
    mkdir -p /home/pi/landing
    sudo cp services/metrics_server.py /home/pi/landing/
  2. Enable the service:
    sudo cp systemd/metrics.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable metrics
    sudo systemctl start metrics
  3. Verify: Open http://10.42.0.1:9000/metrics in your browser. You should see JSON data.

2. Update Landing Page

  1. Choose v1.2 (Text Metrics) or v1.3 (Visual Gauges) from the versions/ folder.
  2. Copy the contents to /home/pi/landing/.

⚡ Phase 4: Power Flow & Advanced Telemetry (v2.x)

This phase transitions the project from a simple dashboard to a hardware-aware monitoring system, visualizing the solar power flow and tracking connected client proximity.

1. Setup Power & Radar Services

  1. Copy the additional Python scripts:
    sudo cp services/power_server.py /home/pi/landing/
    sudo cp services/stats_updater.py /home/pi/landing/
  2. Enable the services:
    sudo cp systemd/power.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable power
    sudo systemctl start power

2. Version Guide

  • v2.0 (Static Flow): Introduces the SVG diagram showing Solar -> Battery -> Pi flow.
  • v2.1 (Animated Flow): Adds staggered animations to the power lines for a "live" current effect.
  • v2.2 (Production - Safe): The stable deployment version. Includes full telemetry and flow charts but hides the "Connected Clients" radar to protect user privacy in public demos.
  • v2.3 (Production - Full): The internal admin version. Features the "Client Radar" which estimates physical distance of connected devices based on WiFi signal strength (RSSI).

Commit Info for this Phase

  • Repository Name: pi-knowledge-hub
  • Commit Name/Summary: feat: power flow visualization and client radar (v2.0 - v2.3)
  • Commit Description:

    Complete hardware integration and production hardening:

    • v2.0: Added power_server.py and SVG hardware topology map.
    • v2.1: Implemented CSS/JS staggered animations for realistic power flow visualization.
    • v2.2: Privacy-hardened UI for public exhibition (removed client MAC/IP list).
    • v2.3: Added "Client Radar" using Log-Distance Path Loss model to estimate device distance from the Pi Zero 2W.

🏗️ Deployment Checklist

  1. Dependencies: Ensure python3 is installed.
  2. Permissions: The metrics_server.py requires access to iw and vcgencmd. Ensure the pi user is in the video and netdev groups.
  3. Hardware: The Power Flow (v2.x) assumes a TP4056 + 18650 Battery + Solar Panel setup. Without sensors, power_server.py returns dummy data for demonstration.

About

An offline educational server running on Raspberry Pi Zero 2 W. Features a responsive dashboard with real-time solar power flow visualization (SVG), battery telemetry, and a WiFi client distance radar. Powered by Kiwix for offline content delivery.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors