
Manufacturers in Kenya and across East Africa, from food processors and beverage plants to packaging, steel and pharmaceuticals, are under pressure to reduce waste, prove quality and use energy more efficiently. The data needed to do that already exists inside PLCs, drives and sensors, but it is usually locked in isolated machines or written on clipboards. Edge computing is the layer that unlocks it safely. This guide explains the architecture, the protocols, the security model and a phased approach to deploying edge computing on a real factory floor.
Key takeaways
- Factory edge computing sits between operational technology (machines, PLCs, SCADA) and information technology (ERP, analytics, cloud), translating protocols and processing data locally.
- OPC UA is the standard for structured, secure access to machine data; MQTT is the lightweight transport for moving events to many consumers.
- The Purdue model and IEC 62443 provide the security framework: segment the network into zones and never allow direct internet access to control systems.
- Vision inspection is a strong edge use case because video is too large and latency-sensitive to send to a distant cloud.
- Store-and-forward is essential where power and WAN links are unreliable, so no production data is lost during outages.
- Start with one line and one measurable problem, such as downtime or scrap, before scaling across the plant.
Why the factory needs an edge layer
Three properties of factory data make a pure cloud approach impractical:
- Volume and frequency. A single machine can produce readings many times per second; a camera produces megabytes per second. Uploading everything over a business internet link is costly and often impossible.
- Latency and determinism. Rejecting a defective bottle on a fast conveyor requires a decision within milliseconds. A round trip to a cloud region outside Kenya cannot guarantee that.
- Availability. The line must keep running when the internet does not. Production decisions cannot depend on a WAN link or a cloud service.
The edge layer, made up of industrial PCs, gateways and on-premises servers, processes data next to the machines, acts locally, and sends curated data upwards. Our broader comparison, edge computing vs cloud computing, covers the general trade-offs.
5G and LTE coverage now make reliable backup links practical for most sites.
OT/IT convergence: two worlds, different priorities
Operational technology (OT) and information technology (IT) teams have historically worked separately, and their priorities differ:
| Aspect | Operational technology (OT) | Information technology (IT) |
|---|---|---|
| Top priority | Safety and availability | Confidentiality and integrity |
| Typical lifespan | 15-25+ years for machines and PLCs | 3-5 years for servers and laptops |
| Patching | Rare, planned during shutdowns, vendor-approved | Frequent, often automated |
| Protocols | Modbus, PROFINET, EtherNet/IP, OPC UA, vendor-specific | TCP/IP, HTTP, SQL, REST |
| Downtime tolerance | Very low; stoppages cost production | Planned maintenance windows acceptable |
| Owners | Engineering, maintenance, production | IT department |
Convergence does not mean merging the two networks. It means building a controlled bridge, with shared governance, between them. In many East African plants, the maintenance team and a small IT team are the same handful of people, which makes clear documentation and simple, standard architectures even more important.
The Purdue model as a map
The Purdue Enterprise Reference Architecture, widely used as the basis for industrial network segmentation and referenced in IEC 62443 guidance, divides the plant into levels:
Level 5 Enterprise network, internet, cloud services
Level 4 Business systems: ERP, email, planning
------- IT/OT boundary
Level 3.5 Industrial DMZ: edge servers, historian replicas, patch servers, remote access jump hosts
------- IT/OT boundary
Level 3 Site operations: SCADA servers, historian, MES, local edge analytics
Level 2 Area supervisory control: HMIs, engineering workstations
Level 1 Basic control: PLCs, drives, controllers
Level 0 Physical process: sensors, actuators, motors, valves
The key rule is that traffic should not jump levels. A cloud service should never connect directly to a PLC. Data flows upward through defined conduits, typically via an edge gateway at Level 2 or 3 and brokers or replicas in the industrial DMZ at Level 3.5. Modern architectures sometimes flatten parts of the model, but the principle of zones and conduits remains sound and is what auditors and insurers will expect.
Core protocols
OPC UA
OPC UA (IEC 62541) is a platform-independent standard for industrial communication. Its strengths:
- Information modelling: data is exposed as structured objects with types, units and metadata, not just raw register addresses.
- Built-in security: certificate-based authentication, signing and encryption.
- Wide support: many modern PLCs, drives and SCADA systems include an OPC UA server, and gateways can expose older devices through OPC UA.
- Companion specifications: industry-specific information models for particular machine types.
OPC UA is typically used for client-server access between the edge gateway and machines. A publish-subscribe mode also exists, including over MQTT.
MQTT
MQTT is a lightweight publish-subscribe protocol, standardised by OASIS, that moves messages through a broker. Producers publish to topics such as plant1/line2/filler/telemetry, and any authorised subscriber, such as a dashboard, historian or cloud connector, receives them. It suits the factory because:
- It is efficient on constrained links and devices.
- Quality-of-service levels let you choose delivery guarantees.
- Decoupling means new consumers can be added without touching the machines.
The Sparkplug specification (an Eclipse Foundation project) adds a defined topic structure, payload format and device state management on top of MQTT, which helps when many teams and vendors publish to the same broker.
Legacy protocols
Older equipment typically speaks Modbus RTU or TCP, PROFIBUS, PROFINET, EtherNet/IP or proprietary serial protocols. Edge gateways with protocol drivers read these and normalise the data. For machines with no digital interface at all, retrofit sensors (current clamps, vibration sensors, proximity counters) wired to an I/O module can provide basic signals such as running, stopped and cycle count.
Reference architecture for a plant
[Machines / PLCs] --Modbus/PROFINET/OPC UA--> [Edge gateway, Level 2/3]
- protocol translation
- local rules and alarms
- store-and-forward buffer
|
| MQTT over TLS
v
[Vision cameras] --> [GPU edge server, L3] --> [MQTT broker + historian, L3/3.5]
- inference |
- reject signal to PLC | outbound only, through firewall
v
[ERP / MES / BI / cloud analytics, L4-5]
Key design decisions:
- Outbound-only connections from the plant to the cloud. No inbound connections from the internet into OT zones.
- A single broker or historian as the integration point, so ERP and analytics teams never query PLCs directly.
- Local dashboards on the plant network so supervisors can see OEE and alarms even when the WAN is down.
Vision inspection at the edge
Machine vision is one of the most valuable edge use cases. Cameras inspect fill levels, labels, caps, print codes, surface defects or dimensions, and a model decides in real time whether to reject an item.
Why it must run at the edge:
- Latency: the decision must reach the reject mechanism before the item passes it.
- Bandwidth: continuous high-resolution video would overwhelm most plant internet links.
- Privacy and IP: images of products, processes and sometimes people stay inside the plant.
A practical approach:
- Start with a fixed, well-lit inspection station. Lighting and camera mounting matter more than model sophistication.
- Collect and label images of good and defective products from your actual line.
- Train models centrally (on a workstation or in the cloud), then deploy them to the edge server.
- Run inference at the edge and send the reject signal to the PLC through a defined, safety-reviewed interface.
- Upload only defect images, counts and model confidence scores for review and retraining.
- Monitor model accuracy over time; new packaging, lighting changes or a new supplier can degrade it.
Edge and cloud both depend on well-run infrastructure close to the business.
Store-and-forward for unreliable power and links
Power interruptions and WAN outages are a planning assumption in many East African industrial areas, not an exception. Store-and-forward ensures that data collected during an outage is buffered locally and transmitted when connectivity returns, in order and without duplicates.
The example below shows the principle in Python with the paho-mqtt client (version 2.x) and a local SQLite outbox. Each reading is written to disk first, then published with QoS 1 and only deleted after the broker acknowledges it. Each message carries a unique ID so downstream systems can discard duplicates.
import json
import os
import sqlite3
import time
import uuid
import paho.mqtt.client as mqtt
BROKER_HOST = os.environ.get("MQTT_HOST", "broker.plant.local")
TOPIC = "plant1/line2/press4/telemetry"
db = sqlite3.connect("outbox.db")
db.execute(
"CREATE TABLE IF NOT EXISTS outbox ("
" id INTEGER PRIMARY KEY AUTOINCREMENT, topic TEXT NOT NULL, payload TEXT NOT NULL)"
)
db.commit()
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="edge-gw-line2")
client.username_pw_set("edge-gw-line2", os.environ["MQTT_PASSWORD"])
client.tls_set() # verify the broker certificate using the system CA store
client.connect_async(BROKER_HOST, 8883, keepalive=30)
client.loop_start() # background thread handles reconnects
def read_sensor() -> dict:
# Replace with your OPC UA or Modbus read.
return {"pressure_bar": 6.2, "temperature_c": 41.5, "running": True}
def enqueue(reading: dict) -> None:
message = {"msg_id": str(uuid.uuid4()), "ts": time.time(), **reading}
db.execute("INSERT INTO outbox (topic, payload) VALUES (?, ?)", (TOPIC, json.dumps(message)))
db.commit()
def flush(batch_size: int = 200) -> None:
if not client.is_connected():
return
rows = db.execute(
"SELECT id, topic, payload FROM outbox ORDER BY id LIMIT ?", (batch_size,)
).fetchall()
for row_id, topic, payload in rows:
try:
info = client.publish(topic, payload, qos=1)
info.wait_for_publish(timeout=5)
except (RuntimeError, ValueError):
return # connection dropped; keep the row and retry later
if not info.is_published():
return
db.execute("DELETE FROM outbox WHERE id = ?", (row_id,))
db.commit()
while True:
enqueue(read_sensor())
flush()
time.sleep(1)
In production you would add disk-usage alerts, retention limits for very long outages, and batching for efficiency. The gateway itself also needs a UPS that gives it time to shut down cleanly, because an abrupt power loss during writes is the main cause of corrupted local buffers. Industrial-grade storage rated for power loss is worth the extra cost.
Security baseline for factory edge
- Follow IEC 62443 principles: define zones and conduits, and control every flow between them.
- Place a firewall between IT and OT, with an industrial DMZ for shared services.
- Disable direct internet access from Level 0-2 devices.
- Use authenticated, encrypted protocols (OPC UA with security enabled, MQTT over TLS with per-device credentials).
- Control remote vendor access through a jump host with multi-factor authentication, session recording and time-limited accounts, not through permanently open remote desktop tools on HMIs.
- Inventory every device, including firmware versions.
- Back up PLC programs and gateway configurations, and test restores.
- Align with guidance such as NIST SP 800-82 on operational technology security, available from nist.gov.
A phased deployment plan
- Pick one problem and one line. Unplanned downtime, scrap or energy use on a bottleneck machine is typical.
- Survey the assets. List machines, controllers, available interfaces, network cabling, power quality and existing SCADA.
- Design the network zones and install the IT/OT firewall before connecting anything new.
- Install an edge gateway to collect a small set of signals: running state, cycle counts, fault codes, key process values.
- Deliver a local dashboard for supervisors with availability, performance and quality metrics.
- Agree actions with production: who responds to which alarm, and how improvements are tracked.
- Measure for a few months, then expand to more machines, add vision or predictive maintenance where justified, and connect to ERP or MES.
Common mistakes
- Connecting PLCs straight to the office network or the internet to get data quickly.
- Starting with a platform purchase instead of a defined production problem.
- Ignoring power quality. Edge devices on the same supply as heavy motors need surge protection and a UPS.
- Polling PLCs too aggressively from multiple systems, which can affect control performance. Use one gateway as the single reader.
- No ownership. If neither maintenance nor IT owns the edge devices, they go unpatched and eventually fail unnoticed.
- Training vision models on perfect samples only, then seeing poor accuracy on real production variation.
FAQ
Do I need to replace old machines to build a smart factory?
No. Older machines can be connected through gateways that speak legacy protocols, or through retrofit sensors that capture basic states and counts. Replacement is driven by production needs, not by data collection.
Should factory data go to the cloud at all?
Summaries, KPIs and selected events usually should, for cross-site analytics, backups and management reporting. Real-time control and raw high-frequency data should stay on site.
What is the difference between OPC UA and MQTT?
OPC UA provides a rich, secure information model for accessing machine data, typically client-server. MQTT is a lightweight publish-subscribe transport for distributing messages. Many architectures use OPC UA to read from machines and MQTT to distribute data.
Can 5G replace cabling in a factory?
For mobile equipment and hard-to-cable areas, private 5G or industrial Wi-Fi can help. Fixed machines are still best on wired Ethernet. See how 5G is transforming business technology.
How do we handle remote access for equipment vendors?
Through a controlled jump host in the industrial DMZ with multi-factor authentication, approval workflows and session logging. Avoid unmanaged remote desktop tools installed directly on HMIs.
How TechBytes can help
TechBytes EA designs and deploys segmented industrial networks, edge gateways and on-premises servers for manufacturers, with UPS and power protection suited to local conditions. We help you connect machine data to dashboards and ERP without exposing control systems. Talk to our network infrastructure team about plant connectivity, or our AI and automation team about vision inspection and analytics.
