<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Oje Balstrøm on Medium]]></title>
        <description><![CDATA[Stories by Oje Balstrøm on Medium]]></description>
        <link>https://medium.com/@oje_balstrom?source=rss-fa57a8890f6d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ph6BvGLDzLLX7JKip1hUBg.jpeg</url>
            <title>Stories by Oje Balstrøm on Medium</title>
            <link>https://medium.com/@oje_balstrom?source=rss-fa57a8890f6d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:51:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oje_balstrom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Ditched Linux for Hurd and Got a More Stable System]]></title>
            <link>https://medium.com/@oje_balstrom/how-i-ditched-linux-for-hurd-and-got-a-more-stable-system-fad9a656b580?source=rss-fa57a8890f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fad9a656b580</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[hurd]]></category>
            <dc:creator><![CDATA[Oje Balstrøm]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 13:05:34 GMT</pubDate>
            <atom:updated>2025-11-19T13:05:34.087Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Linux vs Hurd" src="https://cdn-images-1.medium.com/max/576/0*hIjtGS7CdVLrNabW" /></figure><p>Note: this article assumes you want a practical, hands-on account with examples. I write from the perspective of a power user who traded a mainstream Linux distribution for GNU Hurd; I describe motivations, concrete changes made, and examples of problems solved. Hurd is experimental compared to Linux; treat the steps and results here as a deliberate, opinionated migration path, not a universal recommendation.</p><h3>Why I switched</h3><ul><li><strong>Control over subsystems:</strong> Hurd’s microkernel-like design (servers/daemons implementing filesystems, network, accounts) lets you restart or replace individual components without rebooting the whole machine. That improved uptime for long-running services.</li><li><strong>Isolation of faults:</strong> When a userspace server crashed, the rest of the system often kept running. On my Linux systems, a kernel panic or a driver bug sometimes forced reboots; on Hurd I could recover a subsystem more surgically.</li><li><strong>Experimentation and reproducibility:</strong> Using multiple small servers made it easier to test alternative implementations (different filesystem servers, for example) and roll back to a previous server binary quickly.</li><li><strong>Learning and minimalism:</strong> I wanted to reduce surprise behavior from kernel-space drivers and long-running kernel modules. Running Hurd with minimal foreign kernel modules gave me a smaller trusted computing base.</li></ul><h3>What “more stable” meant for me</h3><ul><li>Fewer full-system reboots due to driver/kernel panics.</li><li>Shorter maintenance windows: I could restart a single Hurd server (e.g., filesystem server) and recover services without disturbing running user sessions.</li><li>Predictable service restarts: replacing a misbehaving network server didn’t scramble open sockets handled by other servers.</li></ul><h3>Environment and reasonable defaults I used</h3><ul><li>Hardware: older desktop-class Intel CPU and a chipset well-supported by Debian’s GNU/Hurd userland (avoid very new GPUs or Wi‑Fi chips).</li><li>Boot: GRUB -&gt; Linux-liaison (a minimal Linux kernel may be required for some setups) vs. native Hurd + GNU Mach where available; I used the Debian GNU/Hurd distribution as a base.</li><li>Userland: Debian packages built for Hurd where available; I used lightweight window manager (Openbox) and avoided heavy compositor-dependent toolchains.</li><li>Backups: automated off-machine backups before each major change.</li></ul><h3>Migration steps I followed (practical, reproducible)</h3><h4>Prepare a test machine or VM</h4><p>Create a VM image (QEMU) first. Example QEMU command I used:</p><pre>qemu-system-x86_64 -m 4G -hda hurd.img -boot c -enable-kvm</pre><p>Install Debian GNU/Hurd from the official installer image; keep a known-good Linux image as fallback.</p><h4>Choose supported hardware / drivers</h4><ul><li>Avoid proprietary GPU drivers; prefer integrated Intel graphics or use simple framebuffer.</li><li>Plug wired Ethernet or use a supported USB‑Ethernet adapter for networking.</li></ul><h4>Minimal base system and services</h4><ul><li>Install a minimal X session and a small window manager (Openbox/i3).</li><li>Use supervised services: run critical servers under a process supervisor (runit/s6) where possible.</li></ul><h4>Replace monolithic pieces with Hurd servers</h4><ul><li>Swap in alternate filesystem server for stability testing:</li><li>Example: mount a traditional ext2/3 image via ext2fs translator, and run a custom translator for experimentation.</li><li>Run networking via the inetd-like Hurd networking servers so a failing network server can be restarted without rebooting.</li></ul><h4>Use translators and user-level filesystems</h4><ul><li>I used translators to present network filesystems and development trees; when the translator crashed, only its namespace failed, not the kernel.</li><li>Example: start a simple FTP translator for a project directory:</li></ul><pre>ftpfs /mnt/project ftp://example.com/dir</pre><ul><li>(restartable separately when it misbehaves.)</li></ul><h4>Manage processes and recovery</h4><ul><li>When a server crashed, I used hurd’s mechanisms to respawn or relaunch the server and reattach clients where possible.</li><li>Example: after filesystem server crash, remount the translator and run fsck on the underlying volume while users remained logged in (for unaffected files).</li></ul><h4>Harden the system to reduce kernel-surface bugs</h4><ul><li>Keep kernel/microkernel (GNU Mach) simple and avoid loading third-party kernel modules.</li><li>Keep device handling in userspace servers that I control/minimize.</li></ul><h3>Concrete examples of stability improvements I saw</h3><h4>Example 1 — Network daemon crash:</h4><ul><li>Linux: crash in a kernel module for a VPN driver forced reboot and broke long-running build nodes.</li><li>Hurd: my userspace network server crashed; I restarted it and re-established interfaces without rebooting other processes. Build jobs running in other namespaces continued.</li></ul><h4>Example 2 — Filesystem testing:</h4><ul><li>I ran a new experimental userspace filesystem server against a development tree. When it leaked memory and crashed repeatedly, only that server had to be restarted; the rest of the system stayed responsive. On Linux, kernel-space FUSE issues occasionally required killing user sessions or rebooting to clear stale kernel state.</li></ul><h4>Example 3 — Gradual upgrades:</h4><ul><li>Rolling an update to an authentication/account server in Hurd was less risky: replace and restart the single server process, keep user sessions alive. With Linux PAM plugins in kernel-integrated components, a bad update sometimes required session restarts or reboots.</li></ul><h3>Tradeoffs and pitfalls</h3><ul><li>Software availability: far fewer packaged applications for Hurd than for mainstream Linux; some desktop and hardware support is missing.</li><li>Hardware compatibility: modern Wi‑Fi, GPUs, and some peripherals lack good Hurd support; expect to use older or well-supported devices.</li><li>Performance: context switches and IPC between many servers can be slower than a monolithic kernel for some workloads.</li><li>Ecosystem maturity: fewer maintainers, smaller community; you must be ready to debug and patch things yourself.</li><li>Not a drop-in replacement: expect to keep a Linux fallback for tasks requiring broad hardware/driver support.</li></ul><h3>Practical tips if you want to try this</h3><ul><li>Start in a VM or on a spare box.</li><li>Keep a Linux fallback and images for quick reversion.</li><li>Use wired networking and avoid exotic hardware.</li><li>Learn Hurd translators and server management — that’s where stability benefits come from.</li><li>Automate backups and snapshots before experiments.</li></ul><h3>Conclusion</h3><p>Switching from Linux to Hurd gave me “more stable” behavior in the sense of fewer whole-system disruptions: failed components were often recoverable without rebooting, and I could iteratively replace server implementations with minimal downtime. That stability came with real tradeoffs — limited hardware and software support and extra maintenance. For a power user who values control over convenience and is willing to accept a smaller ecosystem, Hurd provided a more surgically recoverable, predictable runtime. For most desktop or production use today, Linux remains the practical default; Hurd excels when you want fine-grained userland recovery and experiment-friendly isolation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fad9a656b580" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Ditched PLCs for Raspberry Pi]]></title>
            <link>https://medium.com/@oje_balstrom/how-i-ditched-plcs-for-raspberry-pi-6422a5ff0415?source=rss-fa57a8890f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6422a5ff0415</guid>
            <category><![CDATA[plc-programming]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Oje Balstrøm]]></dc:creator>
            <pubDate>Thu, 13 Nov 2025 10:35:08 GMT</pubDate>
            <atom:updated>2025-11-13T10:35:08.603Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*axVlgmiQQvLfYkM8" /></figure><p>I switched from a traditional PLC-based control setup to a Raspberry Pi-based system for a small automation project (conveyor, sensors, and a motor). Below I explain why, how I planned the migration, the architecture I used, and include concise, practical code examples you can adapt.</p><h3>Why I switched</h3><ul><li><strong>Cost:</strong> Raspberry Pi + HATs and relays cost a fraction of most PLCs for small systems.</li><li><strong>Flexibility:</strong> Full Linux stack, Python, and many libraries make integration with higher-level systems easy.</li><li><strong>Connectivity:</strong> Built-in Ethernet/Wi‑Fi and easy MQTT/HTTP integration for IIoT.</li><li><strong>Rapid development:</strong> Faster iteration using familiar tools (git, editors, unit tests).</li><li><strong>Extensibility:</strong> Add vision, machine learning, or web dashboards without separate controllers.</li></ul><p>(I assumed a non-safety-critical small industrial/educational application. For safety-critical machinery, keep certified PLCs and safety relays.)</p><h3>High-level architecture I used</h3><ul><li>Raspberry Pi 4 (4GB) running Raspberry Pi OS (64-bit)</li><li>Real-time I/O HAT (or MCP23017/I2C GPIO expanders) for isolated digital I/O</li><li>Opto-isolated relay board or solid-state relays for switching AC motors</li><li>Industrial-grade power supply and proper grounding</li><li>MQTT broker for telemetry (mosquitto) and Node-RED for dashboards</li><li>Python service for control logic running under systemd</li><li>Optional CAN/Modbus gateways for integrating existing devices</li></ul><h3>Safety and industrial considerations</h3><ul><li>Use galvanic isolation between Pi GPIO and field devices.</li><li>Keep the Pi outside harsh electrical environments; use DIN-rail I/O modules.</li><li>Use hardware interlocks, e‑stop, and certified safety relays for safety functions — don’t rely on the Pi for emergency stop.</li><li>Apply proper surge protection, fusing, and grounding.</li></ul><h3>Migration plan (what I actually did)</h3><ol><li>Document PLC I/O and ladder logic sequences.</li><li>Map each PLC I/O channel to a Pi-compatible input/output (HAT channel or expander).</li><li>Recreate state machine and timing logic in Python; test in simulation with virtual inputs.</li><li>Bench test with isolated relays and dummy loads.</li><li>Run in parallel with PLC (monitor-only) for a trial period.</li><li>Perform controlled switchover and keep PLC as backup for several days.</li><li>Harden software (watchdogs, logging, automatic restart).</li></ol><h3>Control design approach</h3><ul><li>Replace ladder logic with a deterministic state machine and event-driven I/O.</li><li>Use a sampling loop with timestamped transitions to avoid race conditions.</li><li>Make low-level I/O drivers separate from control logic (dependency injection).</li><li>Log every state transition and input for traceability.</li></ul><h3>Useful components and libraries</h3><ul><li>pigpio or RPi.GPIO or gpiozero for direct GPIO (pigpio preferred for PWM and callbacks)</li><li>python-can or minimal Modbus libraries for field buses</li><li>paho-mqtt for MQTT</li><li>asyncio or threading for I/O concurrency</li><li>systemd service file to auto-start controllers</li></ul><h3>Code examples</h3><p>Below are minimal, practical examples demonstrating common tasks: safe digital input reading with debouncing, output control with an I/O abstraction, a simple state machine, and publishing telemetry via MQTT.</p><p>GPIO abstraction (supports a GPIO HAT or direct GPIO). This keeps logic portable.</p><pre># gpio_abstraction.py<br>from time import time, sleep<br><br>try:<br>    import pigpio<br>    PI = pigpio.pi()<br>except Exception:<br>    PI = None<br><br>class DigitalIn:<br>    def __init__(self, pin, pull_up=True):<br>        self.pin = pin<br>        if PI:<br>            PI.set_mode(pin, pigpio.INPUT)<br>            PI.set_pull_up_down(pin, pigpio.PUD_UP if pull_up else pigpio.PUD_DOWN)<br>        else:<br>            # fallback using gpiozero or RPi.GPIO (not shown)<br>            pass<br>        self.last_state = None<br>        self.last_time = 0.0<br>        self.debounce = 0.02  # 20 ms<br><br>    def read(self):<br>        val = PI.read(self.pin) if PI else 1<br>        now = time()<br>        if val != self.last_state:<br>            self.last_time = now<br>            self.last_state = val<br>            return val<br>        if now - self.last_time &lt; self.debounce:<br>            return None  # unstable<br>        return val<br><br>class DigitalOut:<br>    def __init__(self, pin):<br>        self.pin = pin<br>        if PI:<br>            PI.set_mode(pin, pigpio.OUTPUT)<br>        else:<br>            pass<br><br>    def set(self, on: bool):<br>        if PI:<br>            PI.write(self.pin, 1 if on else 0)<br>        else:<br>            pass</pre><p>Simple state machine for a conveyor: states IDLE → RUNNING → STOPPING</p><pre># conveyor_controller.py<br>import time<br>import paho.mqtt.client as mqtt<br>from gpio_abstraction import DigitalIn, DigitalOut<br><br>START_BTN = 17<br>STOP_BTN = 27<br>MOTOR_RELAY = 22<br>SENSOR = 23<br><br>start_btn = DigitalIn(START_BTN)<br>stop_btn = DigitalIn(STOP_BTN)<br>sensor = DigitalIn(SENSOR)<br>motor = DigitalOut(MOTOR_RELAY)<br><br>mqttc = mqtt.Client()<br>mqttc.connect(&quot;localhost&quot;, 1883)<br><br>state = &quot;IDLE&quot;<br>last_transition = time.time()<br><br>def publish_state(s):<br>    mqttc.publish(&quot;plant/conveyor/state&quot;, s, qos=1)<br><br>publish_state(state)<br><br>while True:<br>    s_btn = start_btn.read()<br>    t_btn = stop_btn.read()<br>    sens = sensor.read()<br><br>    now = time.time()<br><br>    if state == &quot;IDLE&quot;:<br>        motor.set(False)<br>        if s_btn == 0:               # assuming active-low button<br>            state = &quot;RUNNING&quot;<br>            last_transition = now<br>            publish_state(state)<br>    elif state == &quot;RUNNING&quot;:<br>        motor.set(True)<br>        if t_btn == 0:<br>            state = &quot;STOPPING&quot;<br>            last_transition = now<br>            publish_state(state)<br>    elif state == &quot;STOPPING&quot;:<br>        motor.set(False)<br>        # wait for deceleration or sensor clear (example)<br>        if now - last_transition &gt; 1.5:<br>            state = &quot;IDLE&quot;<br>            publish_state(state)<br><br>    mqttc.loop_read()  # keep network responsive (simple)<br>    time.sleep(0.01)</pre><p>Systemd service to run controller reliably (example file content).</p><pre># /etc/systemd/system/conveyor.service<br>[Unit]<br>Description=Conveyor Controller<br>After=network.target<br><br>[Service]<br>ExecStart=/usr/bin/python3 /opt/controllers/conveyor_controller.py<br>Restart=always<br>User=root<br>Environment=PYTHONUNBUFFERED=1<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>Safe shutdown/watchdog snippet to prevent stuck outputs after crashes.</p><pre># watchdog.py (import and call watchdog.keepalive())<br>import os<br>import signal<br>import sys<br><br>def ensure_cleanup(func):<br>    def wrapper(*a, **k):<br>        try:<br>            return func(*a, **k)<br>        finally:<br>            # set all outputs off<br>            from gpio_abstraction import DigitalOut<br>            DigitalOut(22).set(False)  # ensure motor off<br>    return wrapper<br><br>@ensure_cleanup<br>def main():<br>    # controller logic here<br>    pass<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Testing strategy I used</h3><ul><li>Unit test control logic with mocked GPIO objects.</li><li>Hardware-in-the-loop: simulate sensors with jumpers and monitor outputs with LEDs before driving motors.</li><li>Run with PLC in monitor mode and compare state transitions for days.</li><li>Add extensive logging and metric dashboards (Node-RED + InfluxDB or MQTT + Grafana).</li></ul><h3>Benefits realized</h3><ul><li>Faster development cycles and feature extensibility (email alerts, dashboards).</li><li>Lower hardware cost for prototypes and small installations.</li><li>Easier remote access and integration with cloud services.</li></ul><h3>When to keep using a PLC</h3><ul><li>If you need SIL-rated safety or deterministic certified control under harsh industrial certification requirements.</li><li>For very high-reliability machines with existing PLC ecosystems and maintenance staff trained on PLCs.</li></ul><h3>Quick checklist before switching</h3><ul><li>Determine safety-critical functions — keep them on certified hardware.</li><li>Add galvanic isolation and proper I/O modules.</li><li>Plan rollback steps and run parallel monitoring with the PLC.</li><li>Add watchdogs, logging, and remote update procedures.</li></ul><p>If you want, I can:</p><ul><li>Convert a specific ladder logic routine to equivalent Python state machine code for your system,</li><li>Propose a parts list (I/O HATs, relays, power supplies),</li><li>Or provide a mocked unit-test scaffold for your existing PLC logic.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6422a5ff0415" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I ditched Ethernet for RS‑232 — and got more reliable connectivity]]></title>
            <link>https://medium.com/@oje_balstrom/how-i-ditched-ethernet-for-rs-232-and-got-more-reliable-connectivity-51b4af47e953?source=rss-fa57a8890f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/51b4af47e953</guid>
            <category><![CDATA[ethernet]]></category>
            <category><![CDATA[rs232]]></category>
            <dc:creator><![CDATA[Oje Balstrøm]]></dc:creator>
            <pubDate>Wed, 12 Nov 2025 21:01:12 GMT</pubDate>
            <atom:updated>2025-11-12T21:01:12.178Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I ditched Ethernet for RS‑232 — and got more reliable connectivity</h3><figure><img alt="ethernet vs rs232" src="https://cdn-images-1.medium.com/max/576/0*zZQ99LxvzjFfiWM8" /></figure><p>Summary</p><ul><li>Problem: flaky Ethernet on an isolated device network (link drops, DHCP issues, noisy switch).</li><li>Choice: replace networked Ethernet endpoints with direct RS‑232 serial links where traffic is low‑volume, point‑to‑point, and latency/predictability mattered more than raw bandwidth.</li><li>Result: simpler wiring, deterministic links, faster recovery from interference, easier debugging. In my setup RS‑232 met all needs (telemetry, configuration, command/response) and eliminated a class of intermittent failures caused by the network stack and switches.</li></ul><p>Why RS‑232 made sense</p><ul><li>Point‑to‑point devices with modest bandwidth needs (9600–115200 baud) — RS‑232 is ideal.</li><li>Deterministic behavior: no ARP/DHCP timeouts or switch buffering.</li><li>Simpler failure modes: broken cable or wrong handshake is easy to find and fix.</li><li>Lower power/complexity: no NICs, no TCP/IP stack on constrained devices.</li><li>Physical robustness: for short runs (up to ~15 m) RS‑232 tolerates noisy environments if you use proper cabling and grounding.</li></ul><p>What to watch for</p><ul><li>Signal levels: RS‑232 uses ± voltages. If your device is TTL (0–5V or 0–3.3V), use a TTL↔RS‑232 level shifter (MAX232 or equivalent).</li><li>Cable length and ground loops: keep runs short, use common ground or optoisolation where grounds differ.</li><li>Handshaking: hardware (RTS/CTS) reduces framing loss; software XON/XOFF is a fallback.</li><li>Baud rate and parity: match both ends exactly.</li></ul><p>Hardware checklist (my build)</p><ul><li>DB9 male/female extension cables for DB9 devices.</li><li>MAX232‑based converter modules (for TTL ↔ RS‑232).</li><li>USB↔Serial adapters (FTDI/Prolific/CP210x) for PCs without native COM ports.</li><li>Short shielded cable and ferrite beads for noisy runs.</li><li>Optional: opto‑isolators or isolation modules for long runs or differing grounds.</li></ul><p>Practical examples</p><ol><li>Linux/PC: read serial telemetry with Python (pyserial)</li></ol><ul><li>Install: pip install pyserial</li><li>Script: read lines, auto‑reconnect, show timestamps</li></ul><pre># serial_read.py<br>import time, serial, sys<br><br>PORT = &quot;/dev/ttyUSB0&quot;       # or COM3 on Windows<br>BAUD = 115200<br>TIMEOUT = 1<br><br>def open_serial():<br>    while True:<br>        try:<br>            s = serial.Serial(PORT, BAUD, timeout=TIMEOUT)<br>            print(&quot;Opened&quot;, PORT)<br>            return s<br>        except Exception as e:<br>            print(&quot;Serial open failed:&quot;, e)<br>            time.sleep(2)<br><br>def main():<br>    s = open_serial()<br>    while True:<br>        try:<br>            line = s.readline()<br>            if not line:<br>                continue<br>            print(time.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;), line.decode(errors=&#39;replace&#39;).rstrip())<br>        except serial.SerialException:<br>            print(&quot;Serial disconnected, reconnecting...&quot;)<br>            s = open_serial()<br>        except KeyboardInterrupt:<br>            print(&quot;Exiting&quot;)<br>            s.close()<br>            sys.exit()<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><ol><li>Simple request/response from PC to device (Python)</li></ol><ul><li>Sends a command, waits for reply with timeout.</li></ul><pre># serial_query.py<br>import serial, time<br><br>with serial.Serial(&quot;/dev/ttyUSB0&quot;, 9600, timeout=2) as s:<br>    cmd = b&quot;STATUS\n&quot;<br>    s.write(cmd)<br>    time.sleep(0.05)<br>    reply = s.readline()<br>    if reply:<br>        print(&quot;Reply:&quot;, reply.decode().strip())<br>    else:<br>        print(&quot;No reply&quot;)</pre><ol><li>Arduino (TTL) ↔ RS‑232 device via MAX232</li></ol><ul><li>Connect Arduino TX/RX through MAX232 module to DB9 RS‑232 port.</li><li>Example: Arduino sends a periodic heartbeat and listens for simple commands.</li></ul><pre>// RS232_heartbeat.ino<br>#include &lt;SoftwareSerial.h&gt; // use only if hardware Serial is busy<br>// If using hardware Serial1 on a Mega, use Serial1 instead.<br>SoftwareSerial rs232(10, 11); // RX, TX (to MAX232 TTL pins)<br>unsigned long last = 0;<br>void setup() {<br>  rs232.begin(9600);<br>}<br>void loop() {<br>  if (millis() - last &gt; 2000) {<br>    last = millis();<br>    rs232.println(&quot;HB&quot;); // heartbeat<br>  }<br>  if (rs232.available()) {<br>    String cmd = rs232.readStringUntil(&#39;\n&#39;);<br>    if (cmd == &quot;LED ON&quot;) {<br>      // do something<br>      rs232.println(&quot;OK&quot;);<br>    } else {<br>      rs232.println(&quot;ERR&quot;);<br>    }<br>  }<br>}</pre><ol><li>Serial to TCP bridge (when occasional remote access is needed)</li></ol><ul><li>Use pyserial’s example tcp_serial_redirect to expose a local serial port on a TCP port (RFC2217 or raw TCP).</li><li>This keeps the core comms RS‑232 while allowing controlled remote access over IP.</li></ul><p>Command (example): python -m serial.tools.rfc2217_server /dev/ttyUSB0</p><p>Operational tips</p><ul><li>Give serial links clear, documented physical labeling (port, pins, baud).</li><li>Use short cables and avoid daisy‑chaining RS‑232 (point‑to‑point only).</li><li>Log everything centrally from the PC side — serial strings are tiny and easy to archive.</li><li>If you need multiple endpoints aggregated, use a microcontroller or small SBC to multiplex RS‑232 lines and forward higher‑level messages to a central host.</li></ul><p>When not to use RS‑232</p><ul><li>High bandwidth, multi‑drop networks, or when you need standard network services, remote management and scaling — Ethernet or serial‑over‑IP solutions are better.</li><li>Distances beyond ~15 m without converters or using RS‑422/485 differential signaling.</li></ul><p>Conclusion For my use case — low‑bandwidth point‑to‑point telemetry and control — switching from flaky Ethernet to simple RS‑232 reduced complexity, improved determinism, and made debugging trivial. With a small set of USB‑serial adapters, a level shifter, and a few short Python scripts, the whole system became more dependable and maintainable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51b4af47e953" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gukesh Ramashwani: A Champion of Practical Excellence in Software Engineering]]></title>
            <link>https://medium.com/@oje_balstrom/gukesh-ramashwani-a-champion-of-practical-excellence-in-software-engineering-0ab768826c9a?source=rss-fa57a8890f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ab768826c9a</guid>
            <category><![CDATA[gukesh-ramashwani]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Oje Balstrøm]]></dc:creator>
            <pubDate>Wed, 12 Nov 2025 10:13:37 GMT</pubDate>
            <atom:updated>2025-11-12T10:13:37.568Z</atom:updated>
            <content:encoded><![CDATA[<p>Gukesh Ramashwani stands out as a seasoned software engineer whose career blends deep technical mastery with a genuine commitment to community growth. With over a decade of hands-on experience in Linux systems and cloud computing, Gukesh brings both reliability and innovation to every project he touches.</p><p>Technical Mastery</p><ul><li><strong>Expertise in Linux systems:</strong> Gukesh’s extensive background with Linux gives him a rock-solid foundation for building resilient, secure, and high-performance infrastructure. He understands kernel-level behavior, system tuning, and best practices for production stability.</li><li><strong>Cloud computing proficiency:</strong> Comfortable across modern cloud platforms and paradigms, Gukesh designs scalable architectures that balance cost, performance, and operational simplicity. He leverages infrastructure-as-code, containerization, and orchestration to deliver repeatable, maintainable deployments.</li><li><strong>Open-source fluency:</strong> Passionate about open-source technologies, he evaluates, adopts, and contributes to community-driven tools. This fluency enables him to assemble best-of-breed stacks and improve them through practical contributions and shared knowledge.</li></ul><p>Professional Approach</p><ul><li><strong>Problem-first mindset:</strong> Gukesh focuses on solving core problems pragmatically rather than over-engineering. He prioritizes clear requirements, measurable outcomes, and iterative delivery to reduce risk and accelerate impact.</li><li><strong>Reliability and observability:</strong> From monitoring and logging to incident response, Gukesh builds systems that are observable and manageable under real-world conditions. His designs emphasize recoverability and minimal downtime.</li><li><strong>Performance-conscious engineering:</strong> He applies profiling, capacity planning, and targeted optimization to keep systems efficient while preserving maintainability.</li></ul><p>Collaboration and Leadership</p><ul><li><strong>Mentoring and community building:</strong> Beyond individual contributions, Gukesh dedicates time to mentor aspiring developers, translating complex concepts into approachable learning paths. His mentorship strengthens teams and cultivates the next generation of engineers.</li><li><strong>Clear communication:</strong> He bridges technical and non-technical stakeholders with concise explanations and data-driven recommendations, making trade-offs understandable and decisions actionable.</li><li><strong>Team-focused culture:</strong> Gukesh fosters a collaborative environment that encourages peer review, knowledge sharing, and continuous improvement.</li></ul><p>Impact and Vision Gukesh’s blend of deep systems expertise, cloud-native thinking, and open-source enthusiasm positions him as a forward-looking engineer who not only solves today’s challenges but also helps shape sustainable technical direction. His commitment to mentoring amplifies his influence — multiplying positive outcomes across teams and communities.</p><p>In sum, Gukesh Ramashwani exemplifies the best qualities of a modern software professional: technically rigorous, community-minded, and strategically oriented toward building dependable, evolvable systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ab768826c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Ditched Python and Moved to JavaScript]]></title>
            <link>https://medium.com/@oje_balstrom/how-i-ditched-python-and-moved-to-javascript-42f4b94bac07?source=rss-fa57a8890f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/42f4b94bac07</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <dc:creator><![CDATA[Oje Balstrøm]]></dc:creator>
            <pubDate>Mon, 10 Nov 2025 15:24:42 GMT</pubDate>
            <atom:updated>2025-11-10T15:24:42.853Z</atom:updated>
            <content:encoded><![CDATA[<p>I spent years writing Python: scripts, web backends, data-cleaning utilities, quick prototypes and a handful of production services. Python felt comfortable — readable syntax, batteries included, an enormous ecosystem. Over time I reached a point where comfort became constraint: deployment friction, package-version headaches, varying runtime behavior across environments, and an increasing need to ship full-stack features and client-first experiences pushed me to reconsider my toolset. That’s how I ended up moving to JavaScript. This article explains why I made the switch, what I learned, practical migration steps I used, and where each language still shines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20QrcS0huLXXZZ3wPzEDow.png" /></figure><h3>Why I switched</h3><ul><li><strong>Ubiquity on the web:</strong> JavaScript runs everywhere the user is — browsers, Electron apps, mobile wrappers, serverless edge runtimes. For projects where frontend and backend share logic, using the same language drastically reduces friction.</li><li><strong>One language for full stack:</strong> Sharing types, validation logic, and utilities between client and server simplified development and reduced duplicated bugs.</li><li><strong>Faster iteration for UI-tight features:</strong> For projects prioritizing interactivity and rapid UI iteration, the JavaScript ecosystem (React, frameworks, hot-reload tooling) offered higher velocity.</li><li><strong>Modern runtimes and tooling:</strong> Node.js matured, Deno introduced secure defaults, and platforms like Vercel/Netlify made deploying JS services straightforward.</li><li><strong>Ecosystem improvements:</strong> TypeScript addressed many of the maintenance concerns I had with dynamic typing; package managers and bundlers kept iterating toward better DX.</li></ul><h3>What I lost (and gained)</h3><p><strong>Losses:</strong></p><ul><li>Python’s concise syntax for certain tasks (list comprehensions, expressive standard library utilities).</li><li>Mature scientific/data tools (NumPy, SciPy, Pandas) — I still rely on Python for heavy numerical work.</li><li>A few timesaving stdlib modules (itertools, datetime niceties).</li></ul><p><strong>Gains:</strong></p><ul><li>Unified codebase for frontend and backend.</li><li>Easier sharing of validation and types (with TypeScript).</li><li>Faster feedback loop for UI-driven features.</li><li>Simpler deployment to modern edge and serverless hosts.</li></ul><h3>How I migrated — practical steps I followed</h3><p><strong>Inventory and prioritize</strong></p><ul><li>Categorize code: core business logic, data processing, ETL, experiments, web endpoints, CLIs.</li><li>Prioritize modules which benefit most from JS (web endpoints, shared validation, UI helpers).</li></ul><p><strong>Adopt TypeScript early</strong></p><ul><li>For anything shared between client and server, convert to TypeScript. Types catch many issues that used to arise when moving from Python’s dynamic world to JS.</li><li>Keep tsconfig strict; add types incrementally using any only where necessary.</li></ul><p><strong>Reimplement core utilities, don’t transpile</strong></p><ul><li>Rewrite clearly — don’t try to automatically convert every Python idiom to JS. Re-think where JS offers different idioms (Promises, async/await, Streams).</li></ul><p><strong>Replace Python libraries with JS equivalents</strong></p><ul><li>Requests → fetch/axios</li><li>Flask/FastAPI → Express/Polka/Next.js API routes</li><li>SQLAlchemy → Prisma/Knex/TypeORM (or plain queries with query builders)</li><li>Celery → BullMQ, Bree, or serverless cron functions</li></ul><p><strong>Share validation and schemas</strong></p><ul><li>Use Zod or Yup for runtime validation; generate types so client and server share one source of truth.</li></ul><p><strong>Automate tests and CI</strong></p><ul><li>Port tests to Jest or Vitest. Keep the same coverage targets; tests catch logic regressions during porting.</li></ul><p><strong>Handle concurrency and async</strong></p><ul><li>Embrace async/await. Rework blocking patterns (file/CPU-bound tasks) into worker threads, child processes, or retain Python microservices where necessary.</li></ul><p><strong>Manage dependencies and deployments</strong></p><ul><li>Prefer lockfiles (package-lock.json or pnpm-lock.yaml) and deterministic installs (pnpm recommended for monorepos).</li><li>Use containerless deployments when possible (Vercel, Cloudflare Workers, Fly).</li></ul><p><strong>Keep Python where it’s better</strong></p><ul><li>For heavy data-science pipelines I kept Python services and exposed them via APIs, or used message queues to integrate with JS services.</li></ul><p><strong>Iterate and refactor</strong></p><ul><li>After initial ports, refactor to idiomatic JS/TS rather than retaining Python patterns.</li></ul><h3>Concrete example: migrating a small API endpoint</h3><ul><li>Python (Flask):</li><li>Read request, validate multipart form, call business logic, return JSON.</li><li>JavaScript (TypeScript + Node/Express or Next.js route):</li><li>Use Zod to parse/validate request body.</li><li>Call shared business logic typed with TypeScript.</li><li>Return response via JSON with structured error handling.</li><li>Benefits: validation code can be reused on client forms; types guarantee contract consistency.</li></ul><h3>When to keep Python</h3><ul><li>Data science, machine learning model training, and heavy numerical computing — Python remains the pragmatic choice.</li><li>Complex, legacy automation scripts that are low-cost to maintain can stay in Python.</li><li>If your infrastructure is heavily invested in Python (airflow DAGs, scientific stacks), partial migration or integration layers are often better than full rewrites.</li></ul><h3>Tips to avoid common pitfalls</h3><ul><li>Don’t treat JS as a drop-in Python replacement — rewrite with idiomatic patterns.</li><li>Add types from the start when moving large codebases.</li><li>Use feature flags and incremental rollout rather than big-bang rewrites.</li><li>Monitor performance and memory — Node’s event loop requires attention to CPU-bound work.</li><li>Keep formatting and linting strict: Prettier + ESLint with shared rules across the team.</li></ul><h3>About Oje Balstrøm</h3><ul><li>Background: Former Python-heavy backend engineer who transitioned to full‑stack development; 8+ years building web services and UI-driven products.</li><li>Focus areas: pragmatic full‑stack engineering, developer DX, integrating typed JavaScript with existing systems.</li><li>Current work: Building web apps and APIs using TypeScript, React, and serverless platforms; maintain several open-source utilities for validation and deployment workflows.</li><li>Contact: prefers GitHub contributions and project issue trackers (no personal contact info included).</li></ul><p>If you want, I can: provide a migration plan tailored to your codebase size (small/medium/large), list JS libraries matching specific Python packages you use, or show a concrete code translation example from one of your Python functions to TypeScript. Which would you like?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42f4b94bac07" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>