A programming language for knitters — at the industrial scale

Imagine a shirt that can monitor your heart rate. When it’s dirty, you throw it in the laundry.

Imagine that this shirt can also tell a pair of compression socks exactly when to compress, and only when the sensor says that the wearer’s blood pressure has dropped.

For that matter, imagine socks that compress on demand.

These are the kinds of things Megan Hofmann, assistant professor of computer science at Northeastern University, imagines while conducting research on industrial machine knitting. 

Professor Megan Hofmann sits in front of a large machine in a white room. Differently colored spools of yarn sit along the right side, attached to the machine.
Megan Hofmann, assistant professor of computer science, with an industrial knitting machine behind her. Photo by Ian MacLellan/Khoury College of Computer Sciences.

In one of her latest papers, Hofmann and her co-authors present KnitScript, a programming language based on the popular Python language, which “is the lowest level and fundamental infrastructure needed to get us towards [these] more advanced techniques.”

In short, an industrial knitting machine is a textile fabricator: it takes yarn and automatically knits garments out of them, following a program’s specifications.

These machines have “a footprint of about 6 feet by 6 feet,” Hofmann says. “They are widely distributed across factories. Probably more is made on these machines than on 3D printers worldwide on any given day.”

Unfortunately, Hofmann says, “They kind of just make socks [and] sweaters,” despite being “quite capable of doing really complicated designs. The machines are very reliable.”

The problem arises out of how the machines are programmed. 

Because the machine’s instructions “correspond to physical locations in space,” she says, changing the instructions of even the simplest patterns quickly becomes time-consuming and complex. 

For a textile with 10 stitches, “I want to knit on stitch zero, and stitch one, and two and all the way up to 10. And then I keep knitting on those over and over again until I get my piece of fabric. But then someone comes along and [says], ‘Actually, I want my design to be 11 stitches.’”

This seemingly simple change requires the programmer to manually adjust each line of the pattern, one at a time.

“For a normal garment,” Hofmann points out, “you’re knitting thousands of courses and thousands of instructions,” making the process of adjusting these patterns herculean.

“Industrial knitters know how to do this. They understand that programming language, but it’s extremely limited, it’s really unintuitive.”

This is the same reason consumers are restricted in their sizing choices, she says. Designers program one size of a garment into the machine and then have to hand build the other sizes.

“There’s just no real way, with the current frameworks, to resize things.”

KnitScript is intended to help researchers “think about designing knitted structures,” she continues, “more like 3D printing, where we have tools that are really helping us as people design a representation, like a 3D model, of something that we want to build.”

A compiler — basically a kind of translation software — then “takes that 3D model and turns it into instructions” for the machine, she says.

KnitScript will provide a functional platform for innovative research into machine knitting, already underway in Hofmann’s Accessible Creative Technologies Lab (ACT)

Hofmann manipulates the industrial knitting machine in her lab. Photo by Ian MacLellan/Khoury College of Computer Sciences.

One of Hofmann’s Ph.D. students — John Hester — is focusing his research “on creating textile sensors that can be used in prosthetics, like a liner or a sock in your prosthetic device,” Hofmann says.

“In order to build those kinds of sensors, we need better access to these tools” — tools like KnitScript.

Another long-term goal that Hofmann highlights is “customized garments we would manufacture to a particular person’s desire” and to their particular needs. “Instead of manufacturing two sizes that [only] kind of, roughly, correlate to people’s bodies, mass producing them and then throwing away all the surplus,” these garments could be created “on demand,” she says.

This makes clothing options both more sustainable and more accessible. “When I think about working with people with disabilities,” she says, “they tend to fall outside the norms of different body types.”

Fully customizable garments would mean clothing that could fit everyone, to their idiosyncratic preferences and truly individual body types.

But what KnitScript also suggests is a kind of smart clothing, “fabric that changes shape and can do all sorts of interesting things to support our bodies” — like the smart compression socks mentioned above. 

“It really just changes how we interact with our clothing,” Hofmann says.

When it comes to these more revolutionary kinds of textile objects, “you wouldn’t be able to plot out how to place those structures” — like conductive yarn or heat-reactive fibers — “in any meaningful way” using current industrial knitting methods.

KnitScript is the first step in solving that problem.

Noah Lloyd is a Senior Writer for NGN Research. Email him at n.lloyd@northeastern.edu. Follow him on X/Twitter at @noahghola.

View on Site: A programming language for knitters — at the industrial scale
,