Skip to content

datascale-ai/inksight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

English | δΈ­ζ–‡

InkSight | inco (ε’¨ι±Ό)

An LLM-powered smart e-ink desktop companion that delivers calm, meaningful "slow information" β€” your personal ink-on-paper intelligence.

Version License Platform Python

inco


Overview

inco (ε’¨ι±Ό) is a smart e-ink desktop companion built around InkSight. It uses a backend LLM to generate personalized content based on real-time context β€” weather, time of day, date, and solar terms β€” and renders it on a 4.2-inch e-ink screen. With 10 content modes ranging from Stoic philosophy to fitness plans, from tech briefings to daily recipes, inco brings a thoughtful, intelligent companion to your desk.

The backend is built on the OpenAI-compatible SDK, so it works out of the box with DeepSeek, Alibaba Bailian (Qwen), and Moonshot (Kimi). Any OpenAI-compatible API provider (OpenAI, Groq, Together AI, etc.) can be used with minimal configuration. Modes are extensible via a JSON config-driven system β€” create your own content modes without writing Python.

Key Features:

  • 10+ Content Modes β€” Stoic, Roast, Zen, Daily, Briefing, ArtWall, Recipe, Fitness, Poetry, Countdown + custom JSON modes
  • Extensible Mode System β€” Define new modes via JSON config (prompt, layout, style) without writing code
  • 4 Refresh Strategies β€” Random, Sequential, Time-Bound, Smart
  • On-Demand Refresh β€” Single press for instant refresh, double press to switch mode, or trigger remotely via web
  • Statistics Dashboard β€” Device status monitoring, battery voltage trends, mode usage stats, cache hit rate
  • WiFi Provisioning β€” Captive Portal auto-popup for zero-friction setup
  • Web Configuration β€” Full settings management with import/export, live preview, and config history
  • Smart Caching β€” Batch pre-generated content with sub-second response times
  • Multi-LLM Support β€” DeepSeek, Alibaba Bailian, Moonshot, and any OpenAI-compatible API
  • Ultra-Low Power β€” Deep Sleep mode, 3-6 months battery life on a single charge

Content Modes

Content Modes

Mode Description
STOIC β€” Stoic Philosophy Solemn, introspective philosophical quotes, perfect for weekday mornings
ROAST β€” Witty Roast Sharp, humorous roasts that use dark humor to relieve stress
ZEN β€” Zen Minimalist characters (e.g. "静" / stillness, "η©Ί" / emptiness), creating a tranquil atmosphere
DAILY β€” Daily Picks Rich layout with quotes, book recommendations, fun facts, and seasonal info
BRIEFING β€” AI Briefing Hacker News Top 3 + Product Hunt #1, with AI industry insights
ARTWALL β€” AI Gallery Black-and-white woodcut-style artwork generated from weather and seasonal context
RECIPE β€” Daily Recipe Seasonal ingredient-based meal plans for breakfast, lunch, and dinner
FITNESS β€” Fitness Plan Simple home workout routines with exercise lists and health tips
POETRY β€” Daily Poetry Curated classical Chinese poetry, celebrating the beauty of language
COUNTDOWN β€” Countdown Countdown / count-up timers for important dates and anniversaries

Refresh Strategies

Strategy Description
Random Randomly pick from enabled modes
Sequential Cycle through enabled modes in order (progress persists across reboots)
Time-Bound Display different modes based on time of day (e.g. Recipe in the morning, Briefing mid-day, Zen at night)
Smart Automatically match the best mode to the current time slot

Smart Mode Default Schedule

Time Slot Recommended Modes
06:00 - 09:00 Recipe, Daily
09:00 - 12:00 Briefing, Stoic
12:00 - 14:00 Zen, Poetry
14:00 - 18:00 Stoic, Roast
18:00 - 21:00 Fitness, Recipe
21:00 - 06:00 Zen, Poetry

Architecture

Architecture Diagram

Layer Tech Stack
Hardware ESP32-C3 + 4.2" E-Paper (400x300, 1-bit) + LiFePO4 battery
Firmware PlatformIO / Arduino, GxEPD2, WiFiManager
Backend Python FastAPI, Pillow, OpenAI SDK, httpx, SQLite
Frontend HTML / CSS / JavaScript (Config page, Preview console, Stats dashboard)

For detailed architecture design, see the Architecture Documentation (Chinese).


Getting Started

1. Hardware

  • ESP32-C3 dev board (SuperMini recommended)
  • 4.2" e-ink display (SPI, 400x300)
  • LiFePO4 battery + TP5000 charge module (optional)

See the Hardware Guide (Chinese) for wiring details.

2. Backend Deployment

# Clone the repository
git clone https://github.com/datascale-ai/inksight.git
cd inksight/backend

# Install dependencies
pip install -r requirements.txt

# Download font files (Noto Serif SC, Lora, Inter β€” ~70MB)
python scripts/setup_fonts.py

# Configure environment variables
cp .env.example .env
# Edit .env and fill in your API key

# Start the server
python -m uvicorn api.index:app --host 0.0.0.0 --port 8080

Once running, visit:

Page URL Description
Preview Console http://localhost:8080 Test rendering for each mode
Config Manager http://localhost:8080/config Manage device configuration
Stats Dashboard http://localhost:8080/dashboard Device status and usage statistics

3. Firmware Flashing

cd firmware

# Build and upload with PlatformIO
pio run --target upload

# Monitor serial output
pio device monitor

Alternatively, open firmware/src/main.cpp in Arduino IDE to compile and upload.

4. WiFi Provisioning

  1. On first boot (or hold BOOT button for 2 seconds) to enter provisioning mode
  2. Connect your phone to the InkSight-XXXXXX hotspot
  3. A configuration page will pop up automatically β€” select your WiFi and enter the password
  4. The device will connect and start working once configuration is complete

5. Button Controls

Action Effect
Short press BOOT (< 2s) Refresh current content immediately
Double press BOOT (< 500ms interval) Switch to next mode and refresh
Long press BOOT (>= 2s) Reboot and enter provisioning mode

Configuration

Configuration

Visit http://your-server:8080/config?mac=XX:XX:XX:XX:XX:XX to configure your device:

Setting Description
Nickname Device display name
Content Modes Select which modes to display (multi-select)
Refresh Strategy Random / Sequential / Time-Bound / Smart
Time-Bound Rules Map time slots to specific modes (up to 12 rules)
Refresh Interval 10 minutes to 24 hours
Language Chinese / English / Bilingual
Content Tone Positive / Neutral / Profound / Humorous
Character Voice Presets (Lu Xun, Wang Xiaobo, Stephen Chow, etc.) + custom (hover to preview style)
Location Used for weather data
LLM Provider DeepSeek / Alibaba Bailian / Moonshot
LLM Model Select a specific model based on provider
Countdown Events Date events for COUNTDOWN mode (up to 10)

Config Management

  • Import / Export β€” Backup and migrate device config in JSON format
  • Live Preview β€” Preview rendering for each mode before saving
  • Remote Refresh β€” Trigger the device to refresh content on next wake-up
  • Config History β€” View and rollback to previous config versions

See the API Documentation (Chinese) for full endpoint details.


Statistics Dashboard

Statistics Dashboard

Visit http://your-server:8080/dashboard?mac=XX:XX:XX:XX:XX:XX to view device statistics:

  • Device Status β€” Last refresh time, battery voltage, WiFi signal strength (RSSI)
  • Voltage Trend β€” Battery voltage history chart (last 30 records)
  • Mode Stats β€” Usage frequency distribution per mode
  • Daily Renders β€” Daily render count bar chart
  • Cache Hit Rate β€” Cache usage efficiency
  • Render Log β€” Recent render details (mode, duration, status)

API Endpoints

Method Path Description
GET /api/health Health check
GET /api/render Generate BMP image (called by device)
GET /api/preview Generate PNG preview
POST /api/config Save device configuration
GET /api/config/{mac} Get current configuration
GET /api/config/{mac}/history Get configuration history
PUT /api/config/{mac}/activate/{id} Activate a specific configuration
POST /api/device/{mac}/refresh Trigger immediate device refresh
GET /api/device/{mac}/state Get device runtime state
GET /api/stats/overview Global statistics overview
GET /api/stats/{mac} Device statistics detail
GET /api/stats/{mac}/renders Render history (paginated)

Project Structure

inksight/
β”œβ”€β”€ backend/                # Python backend service
β”‚   β”œβ”€β”€ api/index.py        # FastAPI entry point + all API endpoints
β”‚   β”œβ”€β”€ core/               # Core modules
β”‚   β”‚   β”œβ”€β”€ config.py       # Configuration constants
β”‚   β”‚   β”œβ”€β”€ config_store.py # Config storage + device state (SQLite)
β”‚   β”‚   β”œβ”€β”€ stats_store.py  # Statistics collection and queries
β”‚   β”‚   β”œβ”€β”€ context.py      # Environment context (weather/date)
β”‚   β”‚   β”œβ”€β”€ content.py      # LLM content generation
β”‚   β”‚   β”œβ”€β”€ json_content.py # JSON mode content generation
β”‚   β”‚   β”œβ”€β”€ pipeline.py     # Unified generation pipeline
β”‚   β”‚   β”œβ”€β”€ renderer.py     # Builtin mode image rendering
β”‚   β”‚   β”œβ”€β”€ json_renderer.py# JSON mode image rendering
β”‚   β”‚   β”œβ”€β”€ mode_registry.py# Mode registration (builtin + JSON)
β”‚   β”‚   β”œβ”€β”€ cache.py        # Caching system
β”‚   β”‚   β”œβ”€β”€ schemas.py      # Pydantic request validation
β”‚   β”‚   β”œβ”€β”€ patterns/       # Builtin Python mode implementations
β”‚   β”‚   └── modes/          # JSON mode definitions
β”‚   β”‚       β”œβ”€β”€ schema/     # JSON Schema for mode validation
β”‚   β”‚       β”œβ”€β”€ builtin/    # Built-in JSON modes (stoic, roast, zen, fitness, poetry)
β”‚   β”‚       └── custom/     # User-defined custom JSON modes
β”‚   β”œβ”€β”€ scripts/            # Utility scripts
β”‚   β”‚   └── setup_fonts.py  # Font download script
β”‚   β”œβ”€β”€ fonts/              # Font files (downloaded via script)
β”‚   β”‚   └── icons/          # PNG icons
β”‚   β”œβ”€β”€ tests/              # Test files
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   └── vercel.json         # Vercel deployment config
β”œβ”€β”€ firmware/               # ESP32-C3 firmware
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.cpp        # Main firmware (button handling + refresh logic)
β”‚   β”‚   β”œβ”€β”€ config.h        # Pin definitions + constants
β”‚   β”‚   β”œβ”€β”€ network.cpp     # WiFi / HTTP / NTP (with RSSI reporting)
β”‚   β”‚   β”œβ”€β”€ display.cpp     # E-ink display logic
β”‚   β”‚   β”œβ”€β”€ storage.cpp     # NVS storage
β”‚   β”‚   └── portal.cpp      # Captive Portal provisioning
β”‚   β”œβ”€β”€ data/portal_html.h  # Provisioning page HTML
β”‚   └── platformio.ini      # PlatformIO configuration
β”œβ”€β”€ web/                    # Web frontend
β”‚   β”œβ”€β”€ config.html         # Configuration manager
β”‚   β”œβ”€β”€ preview.html        # Preview console
β”‚   └── dashboard.html      # Statistics dashboard
└── docs/                   # Documentation
    β”œβ”€β”€ architecture.md     # System architecture
    β”œβ”€β”€ api.md              # API reference
    └── hardware.md         # Hardware guide

Roadmap

  • WiFi provisioning (Captive Portal)
  • Online config management + config history
  • Sequential / Random refresh strategies
  • Time-Bound + Smart refresh strategies
  • Smart caching (cycle index persists across reboots)
  • 10 content modes (including Poetry and Countdown)
  • Multi-LLM provider support
  • On-demand refresh (button press / double press + web remote trigger)
  • Config import/export + live preview
  • Toast notifications replacing confirm/alert dialogs
  • Enhanced Preview console (request cancellation, history, rate limiting, resolution simulation)
  • Statistics dashboard (device monitoring + usage stats + chart visualization)
  • RSSI signal strength reporting
  • Extensible mode system (JSON config-driven custom modes)
  • Multi-resolution display support (backend rendering adaptation)
  • User-provided API keys
  • One-click Vercel deployment
  • Hardware productization (PCB design)

Contributing

Issues and Pull Requests are welcome! See the Contributing Guide (Chinese) for details.


License

MIT License


Acknowledgments