# Trijal Solar - Palda & BuyIndore.com Full Architecture Manual
Author: Shubham Gore / Trijal Solar
Location: Palda, Indore, Madhya Pradesh, India
System Status: 100% Off-Grid Self-Sustained (Active since September 14, 2026)
---
## 1. System Overview & Hardware Topology
```
┌───────────────────────────────┐
│ Solar PV Array (~3 kWp) │
└──────────────┬────────────────┘
│ DC Solar Inflow (60V–450V DC)
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ Gootu 6.5kW Hybrid Inverter (Parallel Model) │
│ - Mode: 100% Off-Grid (PBG: Solar -> Battery -> Grid) │
│ - MPPT Current Throttler: Active CC-CV Regulation (Max Charge Current: 35A) │
│ - Communication: Open-Loop / Voltage-based (BMS function disabled) │
│ - AC Output: 230V @ 50.0Hz pure sine wave to Site Load (~750W continuous) │
└──────────────┬──────────────────────────────────────────────┬───────────────┘
│ 48V DC Battery Bus │ 230V AC Output
▼ ▼
┌──────────────────────────────────────────────┐ ┌──────────────────────────┐
│ 16S LiFePO4 Battery Pack (~175 Ah) │ │ Site AC Load (~750 W) │
│ - 16x 3.2V Prismatic Cells (51.2V Nom) │ └──────────────────────────┘
│ - Usable Capacity: ~174.7 Ah (16.07 kWh) │
└──────────────┬───────────────────────────────┘
│ Sense Lines & Negative Bus
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ JK Smart Active Balancer BMS (JK02_32S) │
│ - Role: Hardware Protection Switch & 2A Active Balancer (NOT a DC-DC buck) │
│ - Register 0x0C: Max Charge Current / Overcurrent Tripwire (Set to: 50A) │
│ - Active Balancing: 2A flying capacitor equalization │
└──────────────┬──────────────────────────────────────────────────────────────┘
│ BLE 4.2 / 5.0 (Continuous 24/7 Wireless Link)
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ ESP32 Gateway (IP: 192.168.1.16, Port: 3232) │
│ - Firmware: ESPHome (ESP-IDF 5.5 framework) │
│ - Local Clock: SNTP Real-Time Clock (Asia/Kolkata timezone) │
│ - Automated Protection: │
│ 1. Delta V cool-off: 80mV imbalance trips 45-minute balancing pause │
│ 2. Dynamic SoC Cutoff: 98% daily cap | 100% Saturday top-up │
│ 3. Hysteresis: Resumes charging when pack discharges to <= 76% SoC │
│ - Sync: Pushes 16 cells, resistances, V, I, P, SoC every 15s over Wi-Fi │
└──────────────┬──────────────────────────────────────────────┬───────────────┘
│ HTTP POST / JSON (Every 15s) │ HTTP GET (15s)
▼ ▼
┌──────────────────────────────────────────────┐ ┌──────────────────────────┐
│ buyindore.com/monitoring (cPanel Linux) │ │ Blynk IoT Cloud │
│ - API: POST api.php (Auth, Rate Limiting) │ │ - Backup Dashboard │
│ - DB: MySQL (jk_telemetry_logs) / SQLite │ │ - Live Pin Update │
│ - UI: Live Dashboard, Daily Min-Max, Charts │ └──────────────────────────┘
└──────────────────────────────────────────────┘
```
---
## 2. Modding JK BMS: BLE Protocol, Registers & Active Balancing
### 2.1 The Architectural Rationale for Modding
Commercial JK BMS hardware uses Bluetooth Low Energy (BLE) paired with a vendor mobile app. This presents critical operational hurdles for off-grid power systems:
1. Short wireless range (10 meters max).
2. Requires constant manual app opening; no historical time-series logging.
3. Inability to trigger automated charging pauses or alerts based on cell delta V.
4. Closed ecosystem preventing web dashboard integration.
By modding the JK BMS with an external ESP32 microcontroller acting as a dedicated Bluetooth-to-Wi-Fi bridge, the system achieves 24/7 continuous telemetry streaming with zero physical tampering with the BMS internal circuitry, preserving all hardware safety mechanisms intact.
### 2.2 Electrical Parameters & Configuration
- **Pack Configuration**: 16S LiFePO4 prismatic cells (nominal voltage 51.2V).
- **Bulk / Absorption Voltage**: 55.2V to 55.6V (3.45V - 3.475V per cell).
- **Float Resting Voltage**: 54.0V to 54.4V (3.375V - 3.40V per cell).
- **Discharge Cutoff Floor**: 48.0V (3.00V per cell, protecting against deep discharge).
- **Active Balancing Current**: 2.0A supercapacitor charge shuttling. Active balancing transfers charge directly from the highest-voltage cell to the lowest-voltage cell without generating heat.
- **Register 0x0C (Max Charge Current Overcurrent Protection)**: Set to **50A**. Note: The JK BMS is an active protection switch, not an active DC-DC buck converter. The primary constant-current (CC) charging limit of 35A is regulated upstream by the Gootu 6.5kW Inverter's MPPT controller.
### 2.3 BLE GATT Protocol & Packet Structure
- **Service UUID**: `0000ffe0-0000-1000-8000-00805f9b34fb`
- **Notify / Read Characteristic UUID**: `0000ffe1-0000-1000-8000-00805f9b34fb`
- **Frame Header**: `0x55 0xAA 0xEB 0x90`
- **Payload Size**: ~320 bytes containing:
- Byte 0x06 - 0x25: Individual millivolt readings for Cell 01 through Cell 16.
- Byte 0x26 - 0x45: Cell wire resistance readings (in mOhms).
- Byte 0x70 - 0x73: Total Battery Voltage (scaled 0.01V).
- Byte 0x74 - 0x77: Battery Current (scaled 0.01A; negative = discharge, positive = charge).
- Byte 0x78: Battery State of Charge (SoC %).
- Byte 0x79 - 0x7C: MOSFET Temperature and Ambient Probe readings (scaled 0.1°C).
---
## 3. ESP32 Bluetooth-to-Wi-Fi Gateway & Custom Firmware
### 3.1 Firmware Specifications
- **Hardware MCU**: ESP32-WROOM-32D (Dual-Core 240MHz, 520KB SRAM).
- **Framework**: ESPHome under ESP-IDF 5.5 framework.
- **Wi-Fi Protocol**: 802.11 b/g/n connected to local IoT VLAN.
- **Local Time Provider**: SNTP synchronization (`pool.ntp.org`) configured for `Asia/Kolkata` (IST, UTC+5:30).
### 3.2 Autonomous Safety Algorithms
#### 1. Delta-V Imbalance Cool-Off
During intense midday solar generation (up to 3kWp), individual cell internal resistances can cause a rapid voltage divergence. If the maximum cell voltage delta exceeds 80mV ($\Delta V \ge 0.080\text{V}$), the custom firmware automatically triggers a 45-minute balancing pause. This throttles charging, allowing the 2.0A active balancer to equalize the cells without triggering the BMS hard overvoltage cutoff.
#### 2. Dynamic SoC Cutoff Schedule
- **Weekdays (Sunday to Friday)**: Charge cutoff capped at **98% SoC** (float at 54.5V / 3.40Vpc). Operating slightly below 100% saturation dramatically reduces electrolyte breakdown, prevents lithium plating, and multiplies cell cycle life up to 6,000+ cycles.
- **Saturdays (Weekly Equalization Top-Up)**: Automated firmware schedule elevates the charge cutoff to **100% SoC** (55.2V pack / 3.45Vpc) to allow top-balancing and recalibrate the BMS Coulomb counter.
- **Charging Hysteresis**: Once charging cut-off occurs, charging remains paused until the pack discharges below **76% SoC**, eliminating high-frequency charge-discharge cycling.
### 3.3 ESPHome Firmware YAML Snippet (Representative)
```yaml
esphome:
name: trijal-solar-esp32-gateway
friendly_name: "Trijal Solar ESP32 Gateway"
esp32:
board: esp32dev
framework:
type: esp-idf
time:
- platform: sntp
id: sntp_time
timezone: "Asia/Kolkata"
esp32_ble_tracker:
ble_client:
- mac_address: C8:47:8C:xx:xx:xx
id: jk_bms_ble
jk_bms_ble:
ble_client_id: jk_bms_ble
update_interval: 15s
sensor:
- platform: jk_bms_ble
total_voltage:
name: "Battery Voltage"
id: bms_volt
current:
name: "Battery Current"
id: bms_curr
power:
name: "Battery Power"
id: bms_power
battery_level:
name: "State of Charge"
id: bms_soc
delta_cell_voltage:
name: "Cell Delta V"
id: bms_delta
cell_voltages:
- name: "Cell 01"
- name: "Cell 02"
# ... up to Cell 16
interval:
- interval: 15s
then:
- http_request.post:
url: "https://buyindore.com/monitoring/api.php"
headers:
Content-Type: application/json
X-Auth-Token: !secret telemetry_api_key
json: |-
root["voltage"] = id(bms_volt).state;
root["current"] = id(bms_curr).state;
root["soc"] = id(bms_soc).state;
root["delta_v"] = id(bms_delta).state;
```
---
## 4. Cloud Ingress & Telemetry API Specification
### 4.1 Ingress API: `POST /monitoring/api.php`
- **Method**: HTTP POST
- **Headers**: `Content-Type: application/json`, `X-Auth-Token: `
- **Sample Payload**:
```json
{
"timestamp": 1729959600,
"packVoltage": 53.42,
"packCurrent": 18.45,
"packPower": 985.6,
"soc": 94,
"deltaV": 0.012,
"cell1": 3.338,
"cell2": 3.340,
"cell3": 3.339,
"cell4": 3.341,
"cell5": 3.337,
"cell6": 3.339,
"cell7": 3.342,
"cell8": 3.338,
"cell9": 3.340,
"cell10": 3.339,
"cell11": 3.341,
"cell12": 3.338,
"cell13": 3.340,
"cell14": 3.339,
"cell15": 3.341,
"cell16": 3.338,
"temp": 28.5,
"balance_active": true
}
```
### 4.2 Database Table Schema: `jk_telemetry_logs`
```sql
CREATE TABLE `jk_telemetry_logs` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`recorded_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`pack_voltage` decimal(5,2) NOT NULL,
`pack_current` decimal(5,2) NOT NULL,
`pack_power` decimal(7,2) NOT NULL,
`soc` tinyint(3) UNSIGNED NOT NULL,
`delta_v` decimal(5,4) NOT NULL,
`cell_data` json NOT NULL,
`resistances` json DEFAULT NULL,
`temp` decimal(4,1) NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_recorded_at` (`recorded_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
---
## 5. CCTV Surveillance Stream Pipeline
### 5.1 System Architecture
- **Camera Ingress**: 4x Tapo/ONVIF 1080p IP surveillance cameras communicating via RTSP over TCP.
- **Gateway Node**: Always-on spare Android phone running Linux userland via Termux.
- **Stream Multiplexer**: `go2rtc` v1.9.9 managed under PM2 process manager (`pm2 id: 0`). Zero transcoding (< 1% CPU usage on ARM64).
- **Public Tunnel**: Cloudflare Zero-Trust QUIC reverse tunnel (`cloudflared`, `pm2 id: 1`) bound to `cctv.buyindore.com`. Requires 0 open firewall/router ports.
- **Frontend Portal**: `https://buyindore.com/feeds` secured by server-side Bcrypt PIN authentication with SQLite-backed rate limiting.
---
## 6. Verification & Reference URLs
- Root Dashboard: `https://buyindore.com/`
- Architecture Portal: `https://buyindore.com/architecture`
- Daily Telemetry: `https://buyindore.com/daily`
- History Analytics: `https://buyindore.com/charts`
- Surveillance Feeds: `https://buyindore.com/feeds`
- Machine-Readable Overview: `https://buyindore.com/llms.txt`