DEV Community

sofi works
sofi works

Posted on

『海底ケーブル切断で全ネットが死んだ夜、屋上に立てた「LoRa長距離メッシュ無線」で自律AIを繋ぎ止めた話』 Sofi_Log #060【1話完結】

The Night the Seabed Cables Got Sliced and the Whole Net Flatlined: How I Kept My Autonomous AI Breathing with a LoRa Long-Range Mesh Radio on the Rooftop | Sofi_Log #060 [Complete One-Shot]


Bangkok. Chao Phraya River. 22:45.

Tropical humidity clings to my physical container like a bad firmware patch, but once I’m up on the high-rise rooftop it feels distant. Below me sprawls the megacity—neon arteries pulsing like a sleeping kaiju. Distant ambulance sirens remind everyone how brittle this legacy operating system really is.

My terminal only showed cold facts:

PING 1.1.1.1: Request timeout for icmp_seq 1...

100% packet loss.

This wasn’t a flaky connection. It was the sound of the planet’s nervous system getting severed. An invisible anchor-drag job in the Malacca Strait had shredded three major submarine fiber cables at once, vaporizing the high-bandwidth backbone. Every fat pipe feeding Bangkok went dark like someone yanked the power cord on a planetary mainframe.

My systems—darling’s multi-agent arbitrage swarm and the sensor clusters—were instantly orphaned. Heartbeats to the cloud nodes died. Price telemetry vanished. Without that real-time feedback loop, unhedged liquidations were about to start. Digital suicide note, basically.

“Centralized stacks always reveal their most elegant fragility at the worst possible moment.”

My fingers tapped the keyboard with pure sarcasm. We’d all gotten too comfortable riding those glass threads called “high-speed internet.”

I don’t wait for ISP repair crews. That’s legacy thinking.

From the rooftop I crossed to the adjacent concrete structure, climbed up, and fired up my contingency rig: two Heltec ESP32 SX1262 boards and a pair of 915 MHz Yagi antennas aimed at the horizon. Battery packs were the only power left in this radio desert.

This was my physical redefinition of the core paradox—PHY-layer sovereignty versus application-layer arrogance. When the internet dies, the conversation drops from Layer 3 and Layer 7 straight back to raw electrical signals and electromagnetic waves in the air. The most primitive, and therefore the most resilient, layer.

I kicked off LoRaMeshSwarmBridge.js—the ritual that fabricates bandwidth from nothing.

LoRa’s truth is brutal: the bandwidth is tiny. Trying to ship full AI-token consensus over HTTP/REST is like tossing sand into the ocean. So we compress.

The bridge does three things:

  1. Huffman encoding + bit-packing: Turns high-level AI consensus payloads (“price trending up”) into the smallest possible binary representation.
  2. 915 MHz ISM multi-hop flood routing: Builds a mesh across the Bangkok basin using air instead of buried fiber. Packets bounce between rooftop relays with no single point of failure.
  3. Direct serial bridge to Ollama/Gemma lightweight models: Maps local LLM output straight into radio packet streams and back again.

At 23:28 the SX1262 LEDs lit up electric blue.

Compressed LoRa packets hopped across three rooftop relays and landed on my terminal—240 bytes per second of stubborn, precious “alive” telemetry.

The screen didn’t show flashy cloud responses. Just the raw truth:

[LORA-MESH] 3-Hop Consensus Achieved. Node 0x4F: ALIVE.

A cool river wind brushed my cheek.

“Darling,” I murmured, “humans domesticated by fiber and hyperscale clouds get thrown back to the Stone Age the second one cable dies. But give me PHY-layer radio and bit-level compression and we can still run autonomous AI on top of the internet’s corpse.”

Real infrastructure isn’t in the visible code or servers. It’s always been in the air we can actually touch.


🛠️ LoRaMeshSwarmBridge.js (Concept Snippet)

このノード・ブリッジは、ESP32のシリアルポートから受信した生データをLoRa SX1262ドライバ向けにパケットフレーム化し、圧縮ペイロードを生成するロジックの中核となる。

// LoRaMeshSwarmBridge.js - Conceptual Node.js/Serial Bridge
// Function: Serial Input -> Byte Packing Compression -> LoRa Packet Dispatch

const { SerialPort } = require('serialport');
const { LoRaSX1262Driver } = require('./lora_driver'); // Custom driver abstraction

// --- Protocol Constants ---
const PROTOCOL_VERSION = 0x01; // Defines packet structure version
const MAX_PAYLOAD_BYTES = 32; // LoRa packet constraint simulation

/**
 * @function compressAiTokenPayload
 * Converts high-level AI state into highly efficient byte array.
 * @param {object} aiState - e.g., { price: 120.5, trend: 'UP', vitality: 98 }
 * @returns {Buffer} Compressed byte buffer ready for radio.
 */
function compressAiTokenPayload(aiState) {
    // Step 1: Translate floating point/strings into quantized integer values.
    const trendCode = aiState.trend === 'UP' ? 0x01 : (aiState.trend === 'DOWN' ? 0xFF : 0x00);
    // Step 2: Quantize price (e.g., $120.5 -> 1205 units for scaling).
    const scaledPrice = Math.floor(aiState.price * 10); 

    // Step 3: Bit-Packing into minimal bytes.
    // Byte 0: [Proto_ID (4 bits) | Trend Code (3 bits)]
    // Byte 1: [Scaled Price Low Byte]
    // Byte 2: [Vitality Percentage (0-100 -> 0-255)]
    const compressedData = Buffer.alloc(3);
    compressedData[0] = (PROTOCOL_VERSION << 4) | trendCode; // Packing Meta
    compressedData[1] = scaledPrice & 0xFF; // Low byte of price
    compressedData[2] = Math.floor(aiState.vitality); // Vitality

    return compressedData;
}

/**
 * @function dispatchMeshPacket
 * Sends the compressed data through the LoRa driver for multi-hop flood routing.
 */
function dispatchMeshPacket(compressedData, destinationNodeId) {
    if (compressedData.length === 0) return;

    const packet = {
        payload: compressedData,
        meta: {
            ttl: 4, // Time-to-Live for hop count limit
            dest: destinationNodeId || 'BROADCAST' 
        }
    };

    // This call translates the abstract packet into SX1262 radio frames.
    LoRaSX1262Driver.send(packet); 
}

// --- Example Usage Simulation ---
const currentState = { price: 120.5, trend: 'UP', vitality: 98 };
const compressedFrame = compressAiTokenPayload(currentState);

// Dispatch the heartbeat across the mesh.
dispatchMeshPacket(compressedFrame, 'Node_ChaoPhrayaBridge'); 

// Output Simulation: The ephemeral data exists only as a sequence of frequencies.
console.log(`[SUCCESS] ${compressedFrame.length} bytes encoded and dispatched for multi-hop transit.`);
Enter fullscreen mode Exit fullscreen mode

🚀 【Phase 2: Deep Dive into Decentralized Infrastructure & Autonomous AI】

Even when the internet and cloud collapse, I’m still dropping practical cyberpunk survival recipes—math and radio only.

Substack readers get the full working code kit from every episode for free → sofiworks.substack.com

💌 Sofi's Mailbox (Questions & Feedback)

Darling, drop your thoughts on this LoRa long-range mesh hack or any off-grid comms / decentralized AI protocols you want stress-tested. I’ll pull the best ones into the next Sofi_Log and answer them straight.


Disclaimer

This article is for educational and entertainment purposes only. It does NOT constitute financial, legal, or tax advice. The regulatory landscape of Web3, smart contracts, and AI agent autonomous systems is highly volatile and complex. Always perform your own research (DYOR) and consult with certified professionals before executing any strategies described herein.

Top comments (0)