IoT Hardware Integration AWS

IoT Label Printer System

Built a cloud-to-hardware bridge that connects AWS IoT Core to a local Brother label printer via MQTT, enabling any cloud application to trigger physical label printing without VPN or port forwarding.

Context

The asset tracking mobile app needed to print physical barcode stickers for equipment tagging. The Brother label printer was connected to a Windows workstation in the office, but the printing requests needed to originate from cloud systems — the Flutter app, Airtable automations, and other internal services. Traditional approaches like VPN tunnels or port forwarding were brittle and posed security risks.

Challenge

Bridging cloud messaging to physical hardware across network boundaries without compromising security. The Brother printer SDK (BPAC) only works on Windows and requires 32-bit PowerShell due to a known SDK bug. The system needed to be self-healing (auto-restart on failure), support template-based label generation with dynamic data, and maintain persistent connectivity to AWS IoT Core.

Solution

A multi-layer system spanning cloud and local hardware:

AWS IoT Core: MQTT pub/sub messaging with mutual TLS authentication. Device-specific X.509 certificates for security. Topic hierarchy (print/jobs/{device_id}) enables multi-printer deployments.

Python MQTT Listener: Persistent connection to AWS IoT endpoint using the AWS IoT SDK. Subscribes to device-specific topic with QoS 1 (at-least-once delivery). Triggers PowerShell print handler on message receipt.

Windows Service Wrapper: Runs the listener as a system service with automatic restart on failure, 5-second backoff, and Windows Event Log integration.

PowerShell Print Handler: Interfaces with Brother BPAC SDK via COM interop (32-bit). Loads label templates (.lbx), populates dynamic fields (text + barcode), and executes print commands. Supports preview mode for testing.

┌─────────────┐     ┌──────────────┐     ┌──────────────┐
│  Flutter    │────▶│ API Gateway  │────▶│ AWS IoT Core │
│  App        │     │              │     │   (MQTT)     │
└─────────────┘     └──────────────┘     └──────┬───────┘
                                                 │ TLS/MQTT
                                         ┌───────▼───────┐
                                         │ Python MQTT   │
                                         │ Listener      │
                                         └───────┬───────┘
                                                 │ subprocess
                                         ┌───────▼───────┐
                                         │ PowerShell    │
                                         │ BPAC SDK      │
                                         └───────┬───────┘
                                                 │ USB/COM
                                         ┌───────▼───────┐
                                         │ Brother QL    │
                                         │ Printer       │
                                         └───────────────┘

Deployment

Installed as a Windows service on the workstation with the Brother printer physically connected. AWS IoT device provisioned with unique certificate. The Flutter asset scanner app publishes print jobs via AWS API Gateway, which routes to the IoT Core topic. Labels print within seconds of scanning.

Impact

Tech Stack

Python AWS IoT Core MQTT PowerShell Brother BPAC SDK Windows Services X.509 Certificates