Industrial IoT

Building Multi-Serial Automation Hubs with ESP32: An Industrial Case Study

Published on July 26, 2026 · Snow Fox Lab

In Nepal's agricultural backbone, dairy cooperatives process millions of liters of milk every month. Yet until recently, rural milk collection centers suffered from what operators described as a "cable nightmare": a desk jammed with tangled RS-232 wires, printers spitting paper jams, and operators manually keying in fat and SNF percentages from analyzers into separate ledgers.

The Problem: Peripheral Chaos and Incompatible Protocols

At any typical dairy intake station, four disparate machines must operate simultaneously:

  • Ultrasonic Milk Analyzer: Outputs fat, SNF, density, and added water data via serial.
  • Industrial Weighing Scale: Streams continuous weight telemetry in raw ASCII format.
  • Customer-Facing Remote Display: Requires real-time numeric data visible to the farmer.
  • Thermal Slip Printer: Needs immediate formatted receipt generation upon transaction completion.

Traditional PCs struggled in these dusty, high-humidity, power-unstable environments. When cables were kicked loose or COM ports reset, whole morning collection queues ground to a halt.

The Engineering Solution: The ESP32 Automation Hub

Partnering with Hexa Electronics, the hardware engineering team at Snow Fox Lab designed a single solid-state automation hub built around the dual-core ESP32 microcontroller.

1. Exploiting the ESP32 GPIO Matrix for Multi-UART

Unlike older 8-bit microcontrollers with only one hardware UART, the ESP32 features three independent hardware serial controllers (UART0, UART1, and UART2) that can be mapped to almost any arbitrary GPIO pin via the ESP32 IO MUX:

// Hardware Serial allocation on ESP32
HardwareSerial SerialAnalyzer(1); // UART1 -> Milk Analyzer
HardwareSerial SerialScale(2);    // UART2 -> Weighing Scale

void setup() {
  // Debug & PC communication
  Serial.begin(115200);

  // Dedicated Analyzer baud (typically 9600 8N1)
  SerialAnalyzer.begin(9600, SERIAL_8N1, 16, 17); // RX:16, TX:17

  // Dedicated Scale baud (typically 4800 or 9600)
  SerialScale.begin(9600, SERIAL_8N1, 25, 26);    // RX:25, TX:26
}

2. FreeRTOS Dual-Core Architecture

To ensure zero dropped bytes when high-speed weight streams collide with bursty analyzer packets, we separated tasks across ESP32's two Xtensa cores:

  • Core 0 (Telemetry Ingestion): Runs dedicated FreeRTOS tasks that listen to the scale stream, parse checksums, and detect when weight stabilizes on the platform.
  • Core 1 (Business Logic & Display): Handles operator button triggers, formats the transaction slip for the thermal printer, and broadcasts data to remote displays.

3. Wireless Serial Bridging

To eliminate the longest, most vulnerable cable—the wire running to the outdoor overhead farmer display—we engineered an encrypted ESP-NOW wireless serial bridge. The main hub transmits live weight and fat readings over 2.4GHz with sub-10ms latency directly to the wireless display, removing physical trip hazards completely.

Results in the Field

Deployed across dairy collection centers in Chitwan and Nawalparasi with Hexa Electronics, the automation hub has achieved:

  • 65% Faster Processing: Intake time per farmer dropped from 90 seconds to under 30 seconds.
  • Zero Manual Entry Errors: Eliminating keyboard transcription prevented disputes over milk quality and payments.
  • 99.9% Hardware Uptime: Fanless, dust-sealed enclosures engineered and 3D printed at Snow Fox Lab resist spills and harsh weather.

Conclusion

Industrial IoT doesn't require fragile, expensive computers on every desk. With disciplined embedded firmware, robust multi-serial multiplexing, and custom enclosures, low-cost microcontrollers can power mission-critical infrastructure in the most demanding field conditions.

Quick Chat on WhatsApp