<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Marius Gjerd</title><link>https://mariusgjerd.github.io/</link><description>Recent content on Marius Gjerd</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 30 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://mariusgjerd.github.io/index.xml" rel="self" type="application/rss+xml"/><item><title>Can you trust your sensor data? A developer's guide to the full stack</title><link>https://mariusgjerd.github.io/posts/trust-your-sensor-data/</link><pubDate>Tue, 30 Jun 2026 00:00:00 +0000</pubDate><author>Marius Gjerd</author><guid>https://mariusgjerd.github.io/posts/trust-your-sensor-data/</guid><category>data</category><category>sensors</category><category>iot</category><category>scada</category><category>dataquality</category><category>datalifecycle</category><description>Your sensor data has been transformed, compressed, timestamped, and approximated before it reaches your application. Here&amp;rsquo;s the full journey, and where to be suspicious.</description><content:encoded><![CDATA[<p>Every data pipeline in industrial IoT starts the same way: something physical happens, a sensor detects it, and a number appears in your database.</p>
<p>The gap between &ldquo;something physical happens&rdquo; and &ldquo;a number appears in your database&rdquo; is where most data quality problems live. If you&rsquo;ve only ever worked on the database side, that gap is invisible. This post is a map of it.</p>
<p>We&rsquo;ll trace a single temperature reading from a heat exchanger through to a cloud application, step by step. At each stage I&rsquo;ll show what the data looks like, what can go wrong, and what your code should account for.</p>
<h2 id="stage-1-the-physical-measurement">Stage 1: The physical measurement</h2>
<p>A PT100 resistance temperature detector is embedded in a pipe. Its resistance changes with temperature, predictably but not perfectly. Every PT100 has a tolerance class. Class B (the cheaper option) has an accuracy of ±0.3°C at 0°C, widening to ±1.3°C at 300°C.</p>
<p>Your sensor is already an approximation.</p>
<p>There&rsquo;s also the installation to consider. Is the sensor mounted correctly in the flow? Is there air around it that might affect the reading? Has it been in service for 10 years without recalibration? Sensor drift, where a sensor&rsquo;s output gradually deviates from the true value over time, is common and often undetected.</p>
<p><strong>What to remember:</strong> The physical measurement has inherent uncertainty. Your data has error bars even before it leaves the sensor. ±1°C is normal. On an alert threshold of ±0.5°C, that matters.</p>
<h2 id="stage-2-signal-transmission-4-20ma">Stage 2: Signal transmission (4-20mA)</h2>
<p>The PT100&rsquo;s resistance is converted to a 4-20mA current signal by a transmitter. This current travels over a cable to an input card in a PLC or remote I/O.</p>
<p>4-20mA is a very old standard and deliberately hard to break: it&rsquo;s a current loop, so resistance in the cable doesn&rsquo;t affect the reading, and a broken wire is detectable (0mA means fault, not zero). But it has limitations:</p>
<ul>
<li>The 16mA range (4 to 20) maps to your full engineering range (say, 0-200°C). Your resolution is limited by how finely the analog-to-digital converter on the input card can divide that range.</li>
<li>Cable length and electromagnetic interference can introduce noise. A variable-frequency motor drive nearby can inject enough noise to make a reading jump by several counts.</li>
<li>The current-to-value conversion uses a calibrated span. If the transmitter is configured for 0-200°C but the range has changed to 0-150°C and nobody reconfigured it, every reading is scaled wrong.</li>
</ul>
<p><strong>What to remember:</strong> By the time the physical measurement has become a digital number in the PLC, it has already been scaled, quantised, and potentially affected by electrical noise.</p>
<h2 id="stage-3-the-plc-scan-cycle">Stage 3: The PLC scan cycle</h2>
<p>The PLC reads its inputs, executes its logic, and updates its outputs, in a cycle that repeats every 10-100ms. When you request a value from the PLC, you get whatever was in memory from the last scan.</p>
<p>This introduces a latency of up to one scan cycle between the physical world and the PLC&rsquo;s view of it. For slow processes (temperatures, pressures, levels) this is irrelevant. For fast events (a valve that opens for 20ms), you might miss it entirely.</p>
<p>The timestamp on a PLC value is usually the time it was read by the SCADA system, not the time the physical event occurred. These can differ by seconds depending on polling frequency.</p>
<p><strong>What to remember:</strong> PLC values are samples, not a continuous stream. Events faster than the scan cycle are invisible. The timestamp is often &ldquo;when we asked&rdquo;, not &ldquo;when it happened.&rdquo;</p>
<h2 id="stage-4-scada--historian">Stage 4: SCADA / historian</h2>
<p>The SCADA system polls the PLC and stores values in a historian, a time-series database built for industrial data. Historians use a technique called <em>exception reporting</em> or <em>deadbanding</em>: they only store a new value if the reading has changed by more than a configured threshold.</p>
<p>If your temperature is stable at 73.2°C, the historian might store that value once and then not again for an hour. This is efficient for storage, but it means:</p>
<ul>
<li>Querying the historian for &ldquo;the value at 14:32:17&rdquo; returns the last recorded value before that time, which might be from 14:00. If you&rsquo;re not aware of this, your trend looks flat because it is flat in the database, not necessarily flat in reality.</li>
<li>The threshold for &ldquo;changed enough to store&rdquo; is a configuration parameter. If someone set it to 5°C to save storage, you&rsquo;ll never see small fluctuations.</li>
</ul>
<p><strong>What to remember:</strong> Historian data is not a complete record of what happened. It&rsquo;s a compressed approximation. Flat lines in your data might mean &ldquo;nothing changed&rdquo; or &ldquo;we stopped recording small changes.&rdquo;</p>
<h2 id="stage-5-the-cloud-pipeline">Stage 5: The cloud pipeline</h2>
<p>The historian exports data to your cloud pipeline via an MQTT broker, OPC-UA server, or a bespoke API. Each of these adds its own considerations:</p>
<ul>
<li><strong>Buffering:</strong> If the connection drops, does the local system buffer unsent data? For how long? What happens at reconnect? Does it send a burst, or drop the gap?</li>
<li><strong>Resampling:</strong> If your cloud pipeline expects data at 1-minute intervals but the historian sends on-change, you&rsquo;ll need to resample. Forward-fill? Interpolate? The choice changes the data.</li>
<li><strong>Time zones:</strong> Industrial systems often use local time. Your cloud pipeline probably expects UTC. If the historian is in Norway (CET/CEST), you have a seasonal 1-hour offset to handle.</li>
</ul>
<p><strong>What to remember:</strong> The cloud pipeline introduces its own latency, buffering behaviour, and resampling decisions. Each one is a transformation that should be explicit in your schema and documented.</p>
<h2 id="stage-6-your-application">Stage 6: Your application</h2>
<p>By the time a temperature reading reaches your application, it has been:</p>
<ol>
<li>Measured with inherent uncertainty (±1°C or more)</li>
<li>Transmitted as an analog signal and converted to digital</li>
<li>Sampled at the PLC scan cycle</li>
<li>Compressed by deadbanding in the historian</li>
<li>Transmitted over a network that may buffer or drop values</li>
<li>Resampled to fit your pipeline&rsquo;s cadence</li>
</ol>
<p>The number in your database is not &ldquo;the temperature at that time.&rdquo; It&rsquo;s the best available approximation, given all of the above.</p>
<h2 id="what-to-do-about-it">What to do about it</h2>
<p><strong>Document the uncertainty.</strong> Add metadata to your schema: sensor type, accuracy class, historian deadband, poll interval. Future you, or the developer debugging an anomaly at 2am, needs this.</p>
<p><strong>Be conservative with alert thresholds.</strong> If your alert fires when temperature exceeds 95°C and your sensor accuracy is ±1.5°C at that range, your alert might be lying.</p>
<p><strong>Don&rsquo;t interpolate silently.</strong> If you resample sparse historian data, make it visible. A value filled from a reading that&rsquo;s 30 minutes old is different from a value sampled 10 seconds ago.</p>
<p><strong>Validate range and rate-of-change.</strong> A PT100 measuring a pipe temperature that jumps from 70°C to 500°C in one second is probably a sensor fault, not reality. Industrial processes have physical limits. Enforce them at ingestion.</p>
<p><strong>Ask the operators.</strong> The people who run the plant know which sensors are reliable and which &ldquo;always read a bit high.&rdquo; That knowledge is rarely in the documentation.</p>
<hr>
<p>The sensor data you&rsquo;re working with is honest about what it is, if you know how to read it. The full stack is the context. Without it, you&rsquo;re optimising code on top of uncertainty you haven&rsquo;t accounted for.</p>
<hr><p><em>Originally published at <a href="https://mariusgjerd.github.io/posts/trust-your-sensor-data/">mariusgjerd.github.io</a>, where I write about what happens when code touches the real world. New posts also go out by email: <a href="https://marius-newsletter-d94bcd.beehiiv.com/">subscribe here</a>.</em></p>]]></content:encoded></item><item><title>Your uptime SLA means nothing when the physical process can't wait for your rollback</title><link>https://mariusgjerd.github.io/posts/bridge-builder-uptime/</link><pubDate>Tue, 02 Jun 2026 00:00:00 +0000</pubDate><author>Marius Gjerd</author><guid>https://mariusgjerd.github.io/posts/bridge-builder-uptime/</guid><category>ot</category><category>it</category><category>reliability</category><category>bridgebuilder</category><description>Web developers think about uptime differently than industrial engineers. Here&amp;rsquo;s why, and what it costs when you don&amp;rsquo;t understand the difference.</description><content:encoded><![CDATA[<p>There&rsquo;s a conversation that happens when IT developers first encounter operational technology. It usually goes something like this:</p>
<p>&ldquo;What&rsquo;s your uptime requirement?&rdquo;</p>
<p>&ldquo;99.9%.&rdquo;</p>
<p>&ldquo;That&rsquo;s about 8 hours of downtime per year. We can work with that.&rdquo;</p>
<p>&ldquo;No, 99.9% <em>per shift</em>. We run 24/7. And if the system goes down mid-batch, we lose the entire batch.&rdquo;</p>
<p>The IT developer nods, makes a note, and quietly recalculates.</p>
<h2 id="what-uptime-means-in-it">What uptime means in IT</h2>
<p>In web services, uptime is a statistical measure. Your load balancer distributes traffic. A rolling deployment takes down one instance at a time. If a deploy goes wrong, you roll back. The user retries their request. Maybe they see an error page for a few seconds.</p>
<p>99.9% uptime means roughly 8.7 hours of downtime per year. For most web applications, that&rsquo;s acceptable. For the unlucky users who hit those 8.7 hours, it&rsquo;s annoying but not catastrophic.</p>
<p>The whole model assumes the system&rsquo;s state is recoverable. A failed transaction gets retried. A dropped connection reconnects. Deployments are reversible.</p>
<h2 id="what-uptime-means-in-ot">What uptime means in OT</h2>
<p>In industrial control systems, &ldquo;the system&rdquo; is not the software. It&rsquo;s the physical process the software controls.</p>
<p>A water treatment plant doesn&rsquo;t pause while you roll back a SCADA update. A cement kiln running at 1400°C doesn&rsquo;t wait for your deployment pipeline. A paper machine running at 1000 meters per minute doesn&rsquo;t retry when your historian goes offline.</p>
<p>The physical process continues whether the software is healthy or not. And if the software loses control of the process, even briefly, the consequences are measured in:</p>
<ul>
<li>Batches scrapped</li>
<li>Equipment damaged by running outside safe parameters</li>
<li>Product out of spec that must be discarded</li>
<li>In the worst cases: fires, injuries, environmental incidents</li>
</ul>
<p>Your 8.7 hours of acceptable downtime might span three production batches. That&rsquo;s not an SLA problem. That&rsquo;s a business continuity problem.</p>
<h2 id="the-rollback-problem">The rollback problem</h2>
<p>Web developers treat rollbacks as a safety net. Something went wrong in production? Roll back to the last good version. Worst case, you lose a few minutes of data.</p>
<p>In industrial systems, rollback is often not an option mid-process.</p>
<p>If a PLC program update goes wrong mid-batch, you can&rsquo;t simply restore the previous version and continue. The physical state of the process has changed. Temperatures, pressures, chemical compositions are now different from what the previous version expected. Restoring old software to a new physical state can be more dangerous than finishing the bad deploy.</p>
<p>This is why industrial systems have change management processes that look bureaucratic and slow to IT eyes: planned maintenance windows, tested rollback procedures, operator sign-offs. They&rsquo;re not bureaucracy for its own sake. They&rsquo;re built around the reality that the software controls something that doesn&rsquo;t stop.</p>
<h2 id="what-to-do-about-it">What to do about it</h2>
<p>If you&rsquo;re writing software that talks to industrial systems, a few things are worth internalising:</p>
<p><strong>Graceful degradation looks different here.</strong> In web services, graceful degradation means showing a cached page or a friendly error. In OT, it means the control system continuing to operate safely in manual mode while your software is down. Design for that hand-off explicitly.</p>
<p><strong>Test against the physical constraints, not just the software ones.</strong> What happens to your system when the network drops for 30 seconds? What does the PLC do? What does the operator see? What alarms trigger?</p>
<p><strong>Understand the process before you touch it.</strong> The operators who run the plant know things about failure modes that aren&rsquo;t in any documentation. Talk to them before you write a line of code.</p>
<p>The SLA number on the contract is the easy part. Understanding what it actually means for the thing being controlled is the hard part.</p>
<hr><p><em>Originally published at <a href="https://mariusgjerd.github.io/posts/bridge-builder-uptime/">mariusgjerd.github.io</a>, where I write about what happens when code touches the real world. New posts also go out by email: <a href="https://marius-newsletter-d94bcd.beehiiv.com/">subscribe here</a>.</em></p>]]></content:encoded></item><item><title>Why this blog exists</title><link>https://mariusgjerd.github.io/posts/welcome/</link><pubDate>Sat, 30 May 2026 00:00:00 +0000</pubDate><author>Marius Gjerd</author><guid>https://mariusgjerd.github.io/posts/welcome/</guid><category>meta</category><category>career</category><category>ot</category><category>it</category><description>An introduction to who I am, what I&amp;rsquo;m doing, and what I plan to write about.</description><content:encoded><![CDATA[<p>Hi, I&rsquo;m Marius Gjerd, a developer based in Bergen, Norway, working at the crossroads of code and physical infrastructure.</p>
<p>I started out as an electrician. Then I learned to write software, and for the past few years I&rsquo;ve been building IoT solutions in the energy sector. This autumn I&rsquo;m starting a three-year degree in Industrial Automation alongside my day job. It covers PLCs, instrumentation, industrial networks, and OT security.</p>
<p>That&rsquo;s a deliberate move. The bridge between IT and OT, between the cloud-connected world of developers and the physical world of industrial control systems, is somewhere I find genuinely interesting, and a place where very few people are comfortable on both sides.</p>
<p>This blog is where I&rsquo;ll write about what I learn along the way. Expect posts on:</p>
<ul>
<li>The strange and useful corners where IT and OT meet</li>
<li>Industrial cybersecurity from a developer&rsquo;s perspective</li>
<li>Hands-on experiments with PLCs, sensors, and home labs</li>
<li>Lessons from building IoT at scale in energy</li>
<li>Whatever else I find worth sharing as I work my way through the degree</li>
</ul>
<p>I&rsquo;ll write when I have something to say, not on a schedule. Some posts will be technical deep-dives; others will be shorter reflections. All of it will be in my own words, and the code behind the projects will be open source on my GitHub.</p>
<p>If any of this is interesting to you, stick around.</p>
<hr><p><em>Originally published at <a href="https://mariusgjerd.github.io/posts/welcome/">mariusgjerd.github.io</a>, where I write about what happens when code touches the real world. New posts also go out by email: <a href="https://marius-newsletter-d94bcd.beehiiv.com/">subscribe here</a>.</em></p>]]></content:encoded></item></channel></rss>