Files
rtu_v5/.planning/codebase/STACK.md
2026-03-12 00:56:57 +08:00

137 lines
3.5 KiB
Markdown

# Technology Stack
**Analysis Date:** 2026-03-12
## Project Status
This is a **greenfield project** - no implementation code exists yet. The repository currently contains only:
- `THE_IDEA.md` - Requirements specification document
- `.opencode/` - OpenCode/GSD framework configuration
The following stack analysis is based on the requirements defined in `THE_IDEA.md`.
---
## Languages
**Primary:**
- **HTML/CSS/JavaScript** - Web-based UI for the 7-inch touchscreen and remote full HD interface
- Expected to run in Chromium Kiosk Mode on Raspberry Pi
- Must support dual resolution: 1024x600 (touchscreen) and 1920x1080 (remote)
**Secondary:**
- **Python** (likely) - Backend for sensor data collection, CSV processing, and network operations
- Raspberry Pi standard runtime
- Used for serial communication with sensors (ADC, rainfall sensors)
- CSV file generation and management
---
## Runtime
**Environment:**
- **Raspberry Pi OS** - Primary runtime on Pi Zero 2 W and Pi 3B
- Pi Zero 2 W: ARMv8 single-core, 512MB RAM
- Pi 3B: ARMv7 quad-core, 1GB RAM
**Browser:**
- **Chromium** - Kiosk mode for touchscreen interface
- Target URL: `http://pihostname:8080` (touchscreen)
- Target URL: `http://pihostname:9090/` (remote full HD)
**Package Manager:**
- Not yet established (pending project initialization)
---
## Frameworks
**Core:**
- **Lightweight web framework** (TBD) - For serving the UI
- Options: Flask, FastAPI (Python), or simple HTTP server
- Must be performant on low-power Pi Zero 2 W
- **Frontend** - Plain HTML/CSS or lightweight framework
- Recommendation: Static HTML/CSS for main interface (performance)
- Avoid heavy SPA frameworks to minimize memory footprint
**Sensor Interfaces:**
- **Serial communication** - For ADC, rainfall sensors, GPS
- **SDI-12** - For soil moisture and evapotranspiration sensors (referenced in requirements)
**Data Handling:**
- **CSV processing** - For data logging and transfer (per flowchart in THE_IDEA.md)
**Build/Dev:**
- Not yet established (pending project initialization)
---
## Key Dependencies
**Hardware Interfaces:**
- Serial port communication (Python pyserial or similar)
- ADC reading libraries
- GPS module support (USB)
**Network:**
- FTP client (for data transfer to myvscada server)
- SCP/SFTP client
- WebDAV client
- TCP socket libraries
**Data Processing:**
- CSV generation and parsing libraries
- Data validation utilities
---
## Configuration
**Network Settings:**
- Local IP configuration (static IP)
- Subnet mask, gateway, DNS
- MAC address
- Transfer protocol selection (FTP/SCP/SFTP/WEBDAV)
**Sensor Configuration:**
- ADC channels (4-20mA, 0-10vDC types)
- Rainfall sensor settings
- Water level thresholds
- Evapotranspiration settings
**Server Settings:**
- Server IP and TCP port
- Tide data hours
- GPS coordinates (manual or USB GPS)
**Mobile Settings:**
- Phone numbers for alerts (Master, SubMaster, Engineer contacts)
---
## Platform Requirements
**Development:**
- Standard web development tools (editor, browser)
- Python development environment
- Git for version control
**Production:**
- Raspberry Pi Zero 2 W or 3B
- 7-inch capacitive touchscreen (1024x600)
- Chromium browser (Kiosk mode)
- Network connectivity (Ethernet or mobile/GPRS)
---
## Performance Constraints
| Resource | Target | Concern |
|----------|--------|---------|
| RAM | <256MB for UI | Pi Zero 2 W has only 512MB total |
| Startup time | <3 seconds | Cold start in Chromium Kiosk |
| Bundle size | Minimal | Optimize for low-power device |
---
*Stack analysis: 2026-03-12*