<?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 Sohini Sur on Medium]]></title>
        <description><![CDATA[Stories by Sohini Sur on Medium]]></description>
        <link>https://medium.com/@sohini.sur?source=rss-9cbc1bed1536------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Sohini Sur on Medium</title>
            <link>https://medium.com/@sohini.sur?source=rss-9cbc1bed1536------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:08:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sohini.sur/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[AWS Industrial Data Processing with AI inference at Edge(PLC+SCADA)]]></title>
            <link>https://medium.com/humaineeti-ai/aws-industrial-data-processing-with-ai-inference-at-edge-plc-scada-2322fab1217c?source=rss-9cbc1bed1536------2</link>
            <guid isPermaLink="false">https://medium.com/p/2322fab1217c</guid>
            <category><![CDATA[influxdb]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[iiot]]></category>
            <category><![CDATA[needle3]]></category>
            <category><![CDATA[aws-iot]]></category>
            <dc:creator><![CDATA[Sohini Sur]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 11:36:59 GMT</pubDate>
            <atom:updated>2026-09-28T11:36:59.245Z</atom:updated>
            <content:encoded><![CDATA[<p>Traditionally, transferring device telemetry from AWS IoT Core to a time-series database requires a Lambda function. An IoT Rule captures incoming device data and triggers the function, which processes the data and sends it to the database.</p><p>Although this approach works, it means writing, deploying, monitoring and maintaining custom code that mostly reshapes data and passes it on to the database. The pipeline would be simpler if data could go directly from one service to the other.</p><p>That has changed. Amazon Timestream for InfluxDB3 became generally available in March 2024 and added InfluxDB3 support in October 2025. In August 2026, AWS IoT Core shipped a rule action that writes a device message straight into InfluxDB3, with no Lambda function, Kinesis stream or Telegraf agent in between. I built an industrial telemetry pipeline around it, and along the way removed a second kind of middleman, which turned out to be the more interesting part of the project( Wait for a Needle prick 😉).</p><p>That second piece is an anomaly check that runs on the gateway, using Needle 3, a tool-calling model from Cactus Compute. Needle 3 is built for a much narrower job than a chat model. The package is 8 to 29 megabytes depending on quantization, built from what Cactus calls “Simple Attention Networks” with a design they call intelligence laddering: any layer depth from 2 to 20 works as an independent subnetwork, so the same base model scales from a wearable to much larger hardware without retraining. <br> It does not generate prose ( Thank God ! ! ).</p><p>It does three things: a)it picks which registered function a piece of text is asking for, b)fills in that function’s arguments with values it can trace back to the input, and c)reports a calibrated confidence in that decision. That is the output a gateway needs from a sensor reading: a structured decision that code can act on.</p><p>Needle runs entirely on-device, with no cloud dependency once loaded, and Cactus ships engines for everything from microcontrollers to phones to a Raspberry Pi, where it decodes at hundreds to low thousands of tokens per second. I used it to decide, on the gateway itself, whether a PLC or SCADA reading is worth flagging, before any of that data ever reaches the cloud.</p><p><strong>The shape of the pipeline</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61qzVSIuZf6CbZiaqhz5hA.png" /><figcaption>AWS Industrial IoT Pipeline</figcaption></figure><p>Start at the field layer, because that’s where the actual constraints come from. Four simulated PLCs each expose four OPC-UA tags:</p><pre>vibration_01, vibration_02 in millimeters per second, <br>temperature_01, temperature_02 in Celsius.</pre><p>One simulated SCADA unit exposes four Modbus TCP holding registers instead: register 100 is</p><pre>plant_temperature, 101 plant_vibration, <br>102 plant_status (an enum, 0 stopped, 1 running, 2 fault),<br> 103 production_rate. </pre><p>Both device types update once a second.</p><p>One process, the collector, holds the only OPC-UA session and the only Modbus connection in the system. Every second it reads every tag, it builds one JSON payload per device (site, plant, line and device identity fields, plus a tags object holding that device’s readings) and publishes each payload twice. The first copy goes directly to AWS IoT Core over the connection Greengrass already holds open, so there is no local broker and no TLS handshake per message. The second goes over Greengrass’s local publish/subscribe channel, which never leaves the device and exists so that a second, independent component can see the same readings without opening its own connections to the field devices.</p><p>Both publishes go through the same runtime. The gateway runs a single supervisor process, the Greengrass Nucleus, and every component on it, including the collector, is a child process that opens an authenticated connection back to that supervisor instead of managing any networking of its own.</p><p>A publish aimed at AWS IoT Core is forwarded onto the MQTT session the Nucleus opened at startup, authenticated with the gateway’s device certificate.</p><p>Every component’s cloud-bound traffic shares that session, so there is exactly one TLS connection to manage, however many components publish through it.</p><p>A publish aimed at the local channel never reaches that session: the Nucleus matches it in memory against any component subscribed to that topic, and it never becomes a network packet.</p><p>From AWS IoT Core, one rule per device topic (never a shared wildcard rule) picks up each message and writes it straight into InfluxDB through the native InfluxDB rule action. The SQL is a plain projection, something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*uuHI2OXlt5SowMfPqk7Kpw.png" /><figcaption>AWS IoT Rule for MQTT Topic Ingestion</figcaption></figure><p>Device identity</p><pre>(site_id, plant_id, plant_line, device_id, device_type, protocol)</pre><p>travels as InfluxDB tags, set directly on the rule action instead of selected in SQL. These values describe where a reading came from rather than what was measured, which is why they are tags and not fields.</p><p>The second, local-only publish feeds a separate component. It is decoupled from the collector so that a slow or misbehaving model call can never delay telemetry, and the decoupling extends to permissions.</p><p>The collector may only publish on the local channel, never subscribe to it. The consuming component may only subscribe locally; instead of a local publish grant, it gets a direct line to AWS IoT Core, restricted to its own alert topic. The Nucleus enforces both one-directional grants, so the separation holds even if a component misbehaves.</p><p>That component keeps a short rolling window of recent values per tag.</p><p>On a throttled cadence, rather than on every reading, it reduces the window to four numbers (current value, baseline, standard deviation and rate of change) and turns them into one line of text.</p><p>That text goes to Needle, which has two registered tools: <strong><em>flag_anomaly()</em></strong>, which takes a device ID, a tag name, a severity and a reason category, and <strong><em>acknowledge_normal()</em></strong>, which takes no arguments. The reason category is deliberately a small fixed set of labels.</p><p>The call goes through <strong><em>complete()</em></strong> rather than the model’s autonomous <strong><em>run()</em></strong> loop, so that the decision, its confidence, and whether the model trusted the call enough to return it directly can all be inspected in code before anything happens. Only a decision that passes that inspection is dispatched, and only then does the real <strong><em>flag_anomaly()</em></strong> function execute and produce something worth publishing.</p><p>A passing decision gets built into its own small payload and published to a topic that exists only for alerts, &lt;site&gt;/&lt;plant&gt;/&lt;device&gt;/ALERT, never mixed into the telemetry topics. A second, separate set of per-device IoT rules, same one-rule-per-device discipline as the telemetry side, picks those up with their own SQL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*yzRxbOfLVB1cira7XqTupw.png" /><figcaption>Alert Rules</figcaption></figure><p>writing into a third InfluxDB table, separate from the two telemetry tables, so a dashboard can query “what got flagged” independently of “what was measured,” and Grafana can lay both on the same timeline.</p><p><strong>What the direct-write path requires</strong></p><p>The rule action converts each JSON message into InfluxDB line protocol and writes it straight to the target database, with no application code in the loop. Three details determine how it behaves in production.</p><p>Every message needs a field named exactly timestamp, holding an integer Unix epoch value. An alias such as ts or time doesn’t work, and a float or an ISO-8601 string is rejected outright.</p><p>If your device data carries a human-readable timestamp, you end up publishing two representations: one for people reading logs, and an integer field that exists only to satisfy this contract. Design your payload around it from the start. It also mattered in a place I didn’t expect, described below.</p><p>Batching is well designed, and it is where the low-latency case becomes concrete. You can batch client-side (the device sends a JSON array, and each element becomes one point in a single write) or server-side, where the rules engine holds a batch open for up to a second (configurable down to 5 milliseconds) or until it reaches a size limit, then flushes. For a fleet publishing at sub-second intervals, the server-side window is the setting that matters: short enough that data lands in the database within roughly the second it was generated, long enough to avoid one HTTP call per point.</p><p>A field-type conflict fails the entire batch, including its valid points, because InfluxDB doesn’t partially commit a write. Keep that in mind before you ship a device that occasionally sends a string where a number used to be, or, as I found out, before you route a value through an internal hop that quietly changes its type.</p><p><strong>Edge inference</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*S4loaBQTut6VAjiEMCbFOQ.png" /><figcaption>Needle 3 Edge Intelligence</figcaption></figure><p><strong>What runs on the gateway.</strong> Every reading the Edge Intelligence component receives over its local subscription updates a rolling buffer of thirty samples for that tag. A fifteen-second throttle per device and tag decides whether that update also triggers a decision. When it does, the buffer is reduced to the four numbers described above and passed to a newly created Needle instance with its two tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*wPaaV9ET-OlNhiVNTX1loA.png" /><figcaption>Needle 3 Tools</figcaption></figure><p>severity and reason_category are both Literal types, which is the grounding fix described earlier. The call goes through complete(), and the result is inspected before anything happens: a type check, a function_calls/suppressed_calls split, and a confidence score compared against a threshold. Only a call that passes all three checks is turned into an alert and published.</p><p><strong>The model itself.</strong> The published size range is broad, so here is exactly what this pipeline runs. It never passes a weights= argument to Needle(), so it uses Cactus’s stock, non-fine-tuned generation-3 checkpoint, downloaded from Cactus-Compute/needle3 on Hugging Face:</p><ul><li>Package: cactus-needle 3.0.4, engine 3.0.1</li><li>Base weights file: needle3.cact, 35,335,380 bytes, just under 34 MB, cached locally after the first fetch</li><li>Precision: mixed rather than uniform. 456 of the archive’s 581 tensors are fp16, another 122 are quantized against a shared codebook packed into the same file, and a small confidence head sits on top, also tagged fp16</li><li>No LoRA, fine-tuning or custom calibration: this is the model exactly as published, which is part of why better prompting alone was never going to solve the calibration problem described below</li></ul><p><strong>What worked, and what didn’t, on the database side</strong></p><p>What worked: removing Lambda from the path removes a whole category of operational overhead. There are no cold starts to reason about, no function version to keep in sync with the payload shape, and no IAM role scoped to glue code whose only job was reshaping JSON.</p><p>Write latency is now bounded by the rules engine and an HTTPS call to the database, rather than by how long a function takes to cold-start under load. For a pipeline publishing every second, that makes the write path predictable.</p><p>What didn’t go smoothly: connecting the rule to the database takes more than a single click. AWS validates that you control the destination endpoint before it routes traffic to it, and depending on which generation of that validation flow you get, that can mean a manual confirmation step the first time. Don’t assume the destination is live just because the rule saved without an error. And a rule with no errorAction configured won’t tell you when its writes fail.</p><p><strong>Grafana</strong></p><p>The dashboard layer runs on Amazon Managed Grafana.</p><p>Five rows, in order:</p><ul><li><strong>Plant Overview</strong>: status stat, production-rate gauge, plant-wide vibration and temperature (gradient-colored by value).</li><li><strong>PLC Thermal Monitoring</strong>: four panels, one per PLC, temperature_01 against temperature_02.</li><li><strong>PLC Vibration Monitoring</strong>: a peak-vibration bar comparison across all four PLCs, plus four panels, vibration_01 against vibration_02.</li><li><strong>SCADA KPIs</strong>: production rate, temperature, vibration: three stacked panels, one line each.</li><li><strong>Alerts</strong>: a recent-alerts table (severity color-coded), alert volume per minute, alert count by device, alert count by severity, a reason-category breakdown, and the same feed wired in as a dashboard annotation source so flagged events mark up the telemetry panels directly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*lvymybjx5-A4m9Gl_-EPMg.png" /><figcaption>Overall Plant Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*CRI4mIArSuH_thD6jk0PsA.png" /><figcaption>Thermal Monitoring</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*MEZvAmZdnyncSfe8EE8gAA.png" /><figcaption>Plant Vibration Statistics</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*UdjGz7VzSIUk1WRnGBop9A.png" /><figcaption>SCADA KPIs</figcaption></figure><p><strong>Takeaway</strong></p><p>None of this is exotic engineering: an industrial protocol layer, an edge runtime making the minimum necessary hop to the cloud, a database write path that is now native instead of glued together with a function nobody wanted to own, and a small model making decisions on the gateway instead of shipping every reading to the cloud to find out whether it mattered.</p><p>Both halves of the project removed the same kind of thing: a component in the middle of a data path doing work that did not need a separate service. That also removes a class of support tickets, such as “who owns this Lambda function” and “why did this alert take four seconds to fire”. If you are building something similar, read the rule action’s constraints before you design your payload shape. If you are putting a model at the edge, budget time for finding out what happens the first time its output crosses a boundary you did not design with that model in mind.</p><p>Both are cheap to get right at the start and expensive to retrofit once a hundred devices are running.</p><p>Sources:</p><ul><li><a href="https://aws.amazon.com/about-aws/whats-new/2024/03/amazon-timestream-influxdb-available">Amazon Timestream for InfluxDB is now generally available</a></li><li><a href="https://aws.amazon.com/about-aws/whats-new/2025/10/amazon-timestream-influxdb-3">Amazon Timestream now supports InfluxDB 3</a></li><li><a href="https://aws.amazon.com/about-aws/whats-new/2026/08/aws-iot-core-influxdb/">AWS IoT Core now supports native InfluxDB routing for time-series data</a></li><li><a href="https://docs.aws.amazon.com/iot/latest/developerguide/influxdb-rule-action.html">InfluxDB rule action — AWS IoT Core Developer Guide</a></li><li><a href="https://aws.amazon.com/blogs/iot/influxdb-and-grafana-with-aws-iot-to-visualize-time-series-data/">InfluxDB and Grafana with AWS IoT to visualize time-series data (AWS IoT blog, Feb 2020)</a></li><li><a href="https://cactuscompute.com/needle">Needle 3–8–29 MB foundation model for tiny devices (Cactus Compute)</a></li><li><a href="https://github.com/cactus-compute/needle/issues/138">cactus-compute/needle #138 — shared instance state corruption across sequential calls</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2322fab1217c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/humaineeti-ai/aws-industrial-data-processing-with-ai-inference-at-edge-plc-scada-2322fab1217c">AWS Industrial Data Processing with AI inference at Edge(PLC+SCADA)</a> was originally published in <a href="https://medium.com/humaineeti-ai">humaineeti-ai</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>