This document describes the software system architecture for the Valisha project.
┌─────────────────────────────────────────────────────────────────────────┐
│ VALISHA SYSTEM │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Web App │ │ Printer │ │
│ │ (React/TS) │ ◄─────── WiFi/USB ─────────► │ (ESP32) │ │
│ └──────────────┘ └──────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Pattern │ │ Motion │ │
│ │ Designer │ │ Control │ │
│ └──────────────┘ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Purpose: Customer ordering interface + pattern designer
Tech Stack:
- Framework: React 18 with TypeScript
- Styling: Tailwind CSS
- Animation: Framer Motion
- Build Tool: Vite
webapp/src/
├── components/
│ ├── Hero.tsx # Landing section
│ ├── Designer.tsx # Pattern creation tool
│ ├── BeadPattern.tsx # Bead grid renderer
│ ├── Gallery.tsx # Sample designs
│ ├── FAQ.tsx # Common questions
│ ├── Navbar.tsx # Navigation
│ └── Footer.tsx # Footer
├── utils/
│ ├── flags.ts # Flag definitions (50+ countries)
│ └── pixelFont.ts # Letter rendering for names
└── App.tsx # Main app
Flags:
- Each flag defined with exact row colors
- Minimum 9 rows for proper size
- Supports emblems and symbols
Names:
- 5x7 pixel font for letters
- 11 rows total (7 letter + 4 padding)
- Customizable text and background colors
Purpose: Control the physical printer
Tech Stack:
- Framework: PlatformIO with Arduino
- Language: C++
- RTOS: FreeRTOS
firmware/src/
├── main.cpp # Entry point, state machine
├── config.h # Pin definitions, constants
├── motion/ # Motor control
├── sensors/ # Sensor reading
├── bead/ # Bead handling
├── communication/ # WiFi, Serial
├── ui/ # Display, LEDs
└── print/ # Print execution
┌─────────────┐
│ IDLE │
└──────┬──────┘
│ START
▼
┌─────────────┐
│ MEASURING │ ← Wrist size
└──────┬──────┘
│ SIZE_OK
▼
┌─────────────┐
│ PREPARING │ ← Load beads
└──────┬──────┘
│ READY
▼
┌─────────────┐
│ PRINTING │ ← Main work
└──────┬──────┘
│ COMPLETE
▼
┌─────────────┐
│ FINISHED │
└─────────────┘
{
"cmd": "PRINT",
"data": {
"wristSize": 170,
"pattern": [
["#000000", "#000000", ...],
["#FFFFFF", ...],
...
]
}
}{
"event": "PROGRESS",
"data": {
"progress": 45,
"currentBead": 54,
"totalBeads": 120
}
}interface FlagDefinition {
name: string // "Kenya"
emoji: string // Country flag emoji
rows: string[] // Array of hex colors, top to bottom
}// 2D array: grid[row][column] = color hex
type BeadGrid = string[][]interface PrintJob {
patternType: 'flag' | 'name' | 'custom'
wristSize: number // mm
beadSize: number // mm
grid: BeadGrid
}cd webapp
npm install
npm run dev
# Opens at http://localhost:5173cd firmware
# Open in PlatformIO
# Build and upload to ESP32- Order Management - Track and queue customer orders
- Pattern Marketplace - Share/download community designs
- Mobile App - Native iOS/Android apps
- Analytics - Track popular patterns, bead usage
Last Updated: December 2025