Case Study / Embedded Systems

Engineering Work

CNC Embroidery Machine Retrofit

Transforming an industrial JUKI sewing machine into a WiFi-enabled, G-code-driven CNC embroidery system — from blank hardware to sub-millimetre production accuracy.

Sub-mm Positioning accuracy achieved
3 Axes Stepper motor motion control
WiFi Wireless pattern upload

Problem

Industrial sewing machines have no computer interface by design. The challenge was to retrofit a JUKI industrial unit with full 3-axis CNC motion control — including G-code interpretation, WiFi pattern upload, and production-grade fault handling — without modifying the core sewing mechanism or introducing vibration that would affect stitch quality.

The machine had to read standard embroidery file formats, convert them to motor coordinates, and execute patterns with sub-millimetre accuracy while managing thread tension, detecting thread breaks, and surviving power interruptions.

Approach

  • Chose the ESP32 for its dual-core architecture — one core handles motion execution without interruption; the other manages WiFi, file parsing, and the web interface; RTOS task priorities ensure the motion core is never preempted mid-stroke.
  • Wrote a Python converter translating industry-standard .pes and .dst embroidery formats into G-code sequences the ESP32 firmware can execute; this was necessary because no open converter correctly handled the coordinate system and stitch density of the target machine.
  • Designed EEPROM state persistence for the current pattern position — if power is lost mid-pattern, the machine resumes from the last completed stitch block rather than restarting the design.
  • Added a thread-tension sensor on the needle thread path; when tension drops below threshold (thread break), the firmware halts motion immediately and raises a status flag — preventing the machine from running metres of blank fabric.
  • Used a web-based upload interface served directly from the ESP32, so operators upload .pes files via WiFi from any device on the local network.

Outcome

The retrofitted machine achieved sub-millimetre positioning accuracy across all three axes and passed production validation with commercially acceptable stitch quality. WiFi pattern upload, power-loss resume, and automatic thread-break detection all operated correctly in continuous use.

The project demonstrated that industrial electromechanical systems can be made programmable with embedded hardware design — without replacing core mechanisms or purchasing proprietary CNC controllers.

Architecture

System design shown as an operational topology, not a decorative diagram.

The architecture visual is intended to show how edge capture, buffering, transport, event processing, and operator-facing systems fit together under real deployment constraints.

Systems Map

CNC Embroidery Machine Retrofit

A concise overview of edge capture, reliable transport, event handling, and operator visibility.

Architecture diagram showing ESP32 dual-core task layout with motion control, WiFi pattern upload, and thread sensor interrupt handling.
CNC Embroidery Machine Retrofit

What to look for

  • Offline resilience and deterministic recovery are treated as first-class design concerns.
  • Operational visibility is separated from ingestion reliability so reporting never destabilizes capture.
  • Protocol choices reflect topology and failure modes, not just team familiarity.
Sub-mm Positioning accuracy achieved
3 Axes Stepper motor motion control
WiFi Wireless pattern upload

What I Would Do Differently

Implement proper trapezoidal motion profile interpolation from day one. The initial linear stepping approach causes micro-vibration artefacts on diagonal strokes at speed — something only visible during production that required a firmware rewrite to resolve.

Stack

The implementation choices below reflect the boundary between field reliability, event architecture, and operator-facing systems.

ESP32 C++ FreeRTOS G-code Python Arduino