System Overview & Architecture
The Aslandi Edge Converter (planovi-converter) is a high-reliability industrial IoT edge gateway built for energy management and cooperative balancing in the Planovi ecosystem. Built on the Raspberry Pi Pico 2 W (featuring the dual-core RP2350 microcontroller), the gateway autonomously interrogates RS-485 Modbus energy meters, buffers timestamped telemetry in power-loss-resilient offline queues, and transmits authenticated data to the Planovi cloud via mTLS and MQTT QoS 1.
1. High-Level System Topology
The gateway operates at the boundary between industrial facility electrical switchboards and the Planovi cloud platform:
flowchart TB
subgraph Meters["⚡ Substation & Building Energy Meters"]
M1["Zamel LEM-60 (Single Phase)"]
M2["CHINT DTSU666 (Three Phase)"]
Mn["Up to 50 Modbus RTU Meters (Bus Channel 0)"]
M1 --- Mn
M2 --- Mn
end
subgraph Hardware["🎛️ Aslandi Edge Converter (RP2350 Hardware Stack)"]
RS485["Waveshare Pico-2CH-RS485 Transceiver"]
RP2350["Raspberry Pi Pico 2 W (RP2350 @ 150MHz)
• FreeRTOS 11.1 Multitasking Kernel
• lwIP TCP/IP Stack & MbedTLS"]
RTC["PCF8523 / DS3231 RTC + CR1220 Battery"]
SD["MicroSD Storage (Authenticated Generations)"]
WiFi["CYW43439 Wi-Fi (SoftAP & Station Mode)"]
RS485 --- RP2350
RTC --- RP2350
SD --- RP2350
WiFi --- RP2350
end
subgraph Ingress["🌐 Cloud & Management Ingress"]
Installer["Installer Laptop / Smartphone
(Local HTTP Panel: 192.168.4.1)"]
MQTTBroker["Secure MQTT Broker (mTLS Port 8883)"]
FastAPI["Planovi Backend Gateway
(FastAPI / Supabase Edge Functions)"]
DB[("PostgreSQL Telemetry Ledger")]
end
Mn -->|"Modbus RTU (9600 8N1)"| RS485
WiFi -.->|"Commissioning SoftAP"| Installer
RP2350 -->|"MQTT QoS 1 / mTLS"| MQTTBroker
MQTTBroker --> FastAPI
FastAPI --> DB
2. Hardware Stack & Microcontroller Baseline
| Component | Specification | Function |
|---|---|---|
| Microcontroller | Raspberry Pi RP2350 (Dual ARM Cortex-M33 @ 150 MHz) | Core compute, cryptographic acceleration, FreeRTOS tasks. |
| Volatile Memory | 520 KiB on-chip SRAM | Task stacks, LittleFS buffers, mTLS handshake buffers. |
| Non-Volatile Flash | 4 MiB QSPI Flash | Dual-slot A/B firmware images, redundant configs, LittleFS FIFO. |
| Wireless Transceiver | Infineon CYW43439 (802.11 b/g/n) | Station mode (cloud uplink) and SoftAP (installer setup). |
| RS-485 Transceiver | Waveshare Pico-2CH-RS485 (Galvanic isolation) | Differential RS-485 communications on Channel 0. |
| Real-Time Clock | PCF8523 / DS3231 (I2C) with CR1220 coin cell | Sub-second timestamping independent of network connectivity. |
| Removable Storage | MicroSD Card (SPI interface, up to 32 GB) | Encrypted long-term telemetry archive with dual-mirror blocks. |
3. 4 MiB Flash Memory Layout
The internal 4 MiB QSPI Flash memory is partitioned into dedicated regions ensuring safe updates, fault containment, and transactional configuration:
| Region | Offset | Size | Purpose |
|---|---|---|---|
| Bootloader | 0x000000 | 64 KiB | ECDSA P-256 image verification, slot selection, rollback logic. |
| Slot A (Active/Candidate) | 0x010000 | 1,920 KiB | Primary signed firmware executable image. |
| Slot B (Passive/Rollback) | 0x1F0000 | 1,920 KiB | Secondary signed firmware executable image. |
| Configuration Slot 1 | 0x3D0000 | 64 KiB | Redundant encrypted device configuration bank 1 (CRC32/HMAC). |
| Configuration Slot 2 | 0x3E0000 | 64 KiB | Redundant encrypted device configuration bank 2 (CRC32/HMAC). |
| LittleFS Telemetry Buffer | 0x3F0000 | 64 KiB | Wear-leveled circular FIFO queue holding ~205,000 records. |
4. FreeRTOS Multitasking Task Architecture
The firmware runs FreeRTOS 11.1 with prioritized cooperative tasks:
graph TD
subgraph Core0["RP2350 Core 0"]
T1["Modbus Task
(Periodic register polling, 9600 8N1)"]
T2["Storage Task
(LittleFS FIFO writes & SD card block sync)"]
T3["Diagnostics Task
(Watchdog feeding, RTC sync, temperature)"]
end
subgraph Core1["RP2350 Core 1"]
T4["Networking & HTTP Task
(CYW43 Wi-Fi, lwIP stack, Web Server)"]
T5["Cloud Uplink Task
(mTLS session, MQTT QoS 1 publishing)"]
end
Queue1[("In-Memory FreeRTOS Telemetry Queue")]
T1 -->|Raw Readings| Queue1
Queue1 -->|Persist| T2
Queue1 -->|Publish| T5
T4 -.->|Configuration Changes| T2
- Modbus Polling Task: Sequentially queries registered meters on Channel 0 using configured Modbus register profiles.
- Storage Task: Serializes readings into telemetry schema v3 and enqueues records into the LittleFS flash queue and mirrored microSD blocks.
- Cloud Uplink Task: Maintains an mTLS connection with the MQTT broker, publishing buffered records with QoS 1 and popping them from the FIFO only after broker ACK (
PUBACK). - Networking & HTTP Task: Runs the lwIP web server providing the installer web interface for Wi-Fi provisioning, meter configuration, and status diagnostics.
- Diagnostics Task: Monitors system invariants, resets the hardware watchdog timer (8 seconds timeout), checks RTC battery health, and logs diagnostic alarm counters.