Skip to content

Open Source Hardware - From Fibers to Fabric

research and inspiration

We based our machine upon the research done by another Fabricademy group in 2024. Their aim was to create a yarn printer to make patterns by printing yarn. They had a very interesting process, but the results were a bit dissapointing. We wanted to see if we could improve the process.

Here is an embedded version of their documentation page:

Here are several of our own inspirations:

Image 1

tests by hand

Before starting to build the machine, we wanted to experiment what kinds of patterns we could make using different techniques. It was interesting to see how different patterns would show very different results.

Image 1 Image 2 Image 3

By hand, we dyed about 10 meters of yarn using the chosen marker. We tried different types of yarn and different pattern repeats.

describe what you see in this image

Dye thread manually

describe what you see in this image

results with 2/2cm and 6/6cm patterns

We used the yarn to experiment with weaving, crocheting, and machine knitting.

results with machine knitting technic

results with crochet technic

describe what you see in this image

results with weaving technic

The technique chosen is machine knitting because it is easy and fast. The yarn chosen is white cotton yarn, which is easy to machine knit and does not break when the carriage passes over it.

software and g-code

learn g-code & first tests

The next step was translating this onta a machine. We used a marker attached to a 3D printer to create the movement. To program the 3D printer we had to learn how to write g-code.

Important functions in g-code:

    G0 = initialize position  
    G1 = movement  
    G2, G3 = arc movements  
    G4 = Pause the machine for a period of time.  
        G4 [ P | S ]  
        Parameters  
        P:Time to wait, in milliseconds  
        S: Time to wait, in seconds  
    G10 - Retract G10: Retract  
    G20 / G21 = unit selection (21 = mm, 20 = inches)  
    G91 - Switch on relative mode i.e., Relative Positioning
        All coordinates from now on are relative to the last position. E axis is left intact. -e.g., Z10 means move up 10 not move to coordinate Z10  
    G90 - Switch off relative mode G90: Set to Absolute Positioning  
        e.g., Z10 means move to coordinate Z10, this could be move 0 if already at 10  
    Parameter F (for G code) = The feedrate per minute of the move between the starting point and ending point (if supplied)

We started with this code to test:

G21 F100 ; This says set units to mm  and sets the speed/feedrate to 100 mm/minute

G91 ; relative mode.
G1 X0 Y0 Z+10 ; move up 10mm (in the air)
G4 S2 ; wait 5 seconds 
G1 X0 Y0 Z-10 ; move back up 10mm (on the tray)
G4 S2 ; wait 5 seconds

G1 X20 Y0 Z0 ; make a square part1
G1 X0 Y20 Z0 ; make a square part2
G1 X-20 Y0 Z0 ; make a square part3
G1 X0 Y-20 Z0 ; make a square part4
G4 S5 ; wait 5 seconds

G91 ; Mode relatif
G2 X20 Y0 I10 J0 F1500 ; Premier demi-cercle (va 20 mm à droite)
G2 X-20 Y0 I-10 J0 ; Deuxième demi-cercle (revient 20 mm à gauche au départ)
G4 S5 ; Pause de 5 secondes // wait for a second
}
Here is a video showing the result on the 3D printer:

dye

Just like in 2024, we'll use a black marker to color the white thread. The marker used to dye the thread must be chosen carefully. Ideally, we need to find a marker that:

  • dyes the thread a vibrant color that contrasts sharply with white
  • dyes evenly
  • dries quickly
  • dyes the entire surface of the marker (not just the top)

describe what you see in this image

Ink test using different markers

g-code to dye yarn

Now that we understand how to write G-code and how it’s used to control the 3D printer, we’re going to write a G-code to color a white filament so that, in the end, we have a filament with equal parts white and black.

Here is the G-code:

G0
G91
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z5 ; up 5mm
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z5 ; up 5mm
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z5 ; up 5mm
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z5 ; up 5mm
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z5 ; up 5mm

improve the black-to-white ratio based on the printer's speed

measuring the speed of our printer

In order to create precise timings for our G-code, we needed to know the duration of the printer’s movements (both the upward and downward movement). We filmed a sequence of the machine moving up and down, imported it into a video editing tool and split the footage into the different sections. This allowed us to read the exact duration of each step.

This timing was an important reference when planning our G-code, as those movements needed to be included in the total timing of the ‘up’ sequence, during which the marker is lifted away from the yarn, leaving it uncoloured.

Based on our G-code primer, we can see that the resulting filament is much whiter than black (twice as white). We noticed that the printer moves very slowly from the lower position to the upper position. This may explain why our filament is much whiter.

We’ll change the code so that the printer moves up faster:

G0
G91
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 1 seconds
G1 X0 Y0 Z5 ; up 5mm
G4 S4 ; stop 2 seconds
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 3 seconds
G1 X0 Y0 Z5 ; up 5mm
G4 S4 ; stop 4 seconds
G1 X0 Y0 Z-5 ; down 5mm
G4 S4 ; stop 5 seconds
G1 X0 Y0 Z5 ; up 5mm

improve the black-to-white ratio based on high/low ratio

The printer's movement speed has helped improve the ratio, but we still haven't achieved parity. So we're going to change the ratio of time in the up position to time in the down position.

We reduce the time in the up position and increase the time in the down position. Here is the code that creates a 50/50 colored thread:

G21 F100 ; This says set units to mm  and sets the speed/feedrate to 1000 mm/minute
G90 ; absolute mode in case we want to test


G91 ; relative mode.
G1 X0 Y0 Z5 ; move up 5mm
G4 P400 ; wait 0.4 seconds
G1 X0 Y0 Z-5 ; move down 5mm (towards plate)
G4 S1 ; wait 1 second
G1 X0 Y0 Z5 ; move up 5mm
G4 P400 ; wait 0.4 seconds
G1 X0 Y0 Z-5 ; move down 5mm (towards plate)
G4 S1 ; wait 1 second
G1 X0 Y0 Z5 ; move up 5mm
G4 P400 ; wait 0.4 seconds
G1 X0 Y0 Z-5 ; move down 5mm (towards plate)
G4 S1 ; wait 1 second

absolute positioning

Because we had some problems calibrating the machine, we decided to use absolute positioning, based on the new pen holder. Stéphanie wrote the g-code for this. While testing we encountered some issues.

Problem: the printer was moving from where it stopped before Solution: add G28 to the code, making sure the printer goes to home position first Problem: the marker cannot get into ‘home’ position with the marker still on Solution: adding a small pause to attach the marker and start the yarn feeder. Problem: the marker was still to high Solution: change the z position slightly

This is the final code:

G21 ;
F100 ; This says set units to mm  and sets the speed/feedrate to 1000 mm/minute
G90 ; absolute coordinates


G28; Go to home position

G1 X200 Y150 Z40 ; Go to sponge position

G4 S3 ; wait 3 second

G1 X200 Y150 Z30 ; goes to Z30
G4 P200 ; wait 0.4 seconds
G1 X200 Y150 Z20 ; goes to Z20 (10mm towards plate)
G4 S1 ; wait 1 second

This is how it worked:

loop

We tried to see if we could find a way to loop the process se we don't always have to copy and paste the code a number of times. First we tried to use CNC cookbook. It did not work because not every hardware has the same g-code reader. Our 3D printer was not able to process it.

Then Stéphanie used python to write a code which allows us to define how many times we want the code to loop. First we have save this file in a relevant folder:

It contains this code:

#! /usr/bin/python

# Importing necessary external libraries
import sys

# Gcode commands at the beginning
header = """
G21 ;
F100 ; This says set units to mm  and sets the speed/feedrate to 1000 mm/minute
G90 ; absolute coordinates

G28; Go to home position

G1 X200 Y150 Z40 ; Go to sponge position

G4 S3 ; wait 3 second
"""

# Gcode commands to be repeated
repeat = """
G1 X200 Y150 Z30 ; goes to Z30
G4 P200 ; wait 0.4 seconds
G1 X200 Y150 Z20 ; goes to Z20 (10mm towards plate)
G4 S1 ; wait 1 second
"""

# How many times we want the repeat
# It uses the parameter we write when we execute the code in the terminal
nb = int(sys.argv[1])

# Creating a text/gcode file
# The file will be called `pattern-10x.gcode`, `pattern-36x.gcode`
# according to the number of repeats
f = open("pattern-%dx.gcode" % nb, "w")

# Writing the init Gcode commands in the text file
f.write(header)

# Writing the repeated Gcode commands in the text file
f.write(nb * repeat)

# Closing the text file
f.close()

Then insert this command to your terminal:

python repeat-gcode-pattern.py 10
and change the 10 to whichever number of repeats you want. Then press enter to validate code.

Here is a video of how it works on the machine:

hardware

machine setup

Here is a 'map' of our machine setup drawn by Melanie.

Image 1

Here is a summary of how we organized our work during these different days:

Day # Objectives Description
1 Objectives / Means / Manual test Read documentation, choose your tools, do some tests by hand, try out different techniques
2 First machine test Write G-code, perform an initial machine test, learn knitting machine
3 Improvements Create a holder for the marker , code a loop
4 Improvements Improve yarn feeding (create yarn guiding elements, improve Hilo spinner, knitting test)

attach hilo spinner

We decided to use the Hilo spinner as opposed to the yarn winder used by the group before us. This is because we were hoping to achieve a more constant speed and we also wanted to have control over the speed, as this would influence the pattern.

The Hilo spinner had some calibration issues. It was not always turning in its own axis. We built a lot of structures around it to make it more stable, but in the end Stephanie had the idea of connecting an external stepper motor to the Hilo, just by unplugging the cable and putting it into another one. It was not turning well, but then we realised we needed to add some friction so we added a rubber band. This made everything run much smoother.

yarn feeder

We had some problems with the yarn we wanted to use. It was not wound on a cone, so it was giving too much resistance for the machine to move freely. We decided to make a lazy kate with a box and a knitting needle, but this also didn't work. In the end we had to use other yarn which was wound on a cone. This was a shame because the colour was less bright white, which means there was less contrast.

Image 1 Image 2

pen holder

creating new accessories

We quickly understood that in order to make the workflow more efficient, we needed to create a few additional accessories:

  • A magnetic pen holder with variable sizing
  • Clamps to guide the yarn
  • Standing yarn guides for additional support

After a little visit on thingyverse and Printables looking for suitable designs, we eventually decided to create our own. As time was limited and there were so many things to explore, I decided to use the most accessible tool available for the design process, keeping in mind that I would like to learn to design them in Blender and keep evolving with it. For this iteration however, I decided to use Tinkercad.

It never ceases to amaze me, when extremely complex subjects or processes are proposed in a super simple way. Tinkercad is a perfect example - a brilliant 3D modelling programme that makes learning and understanding the basic principles of 3d modelling accessible to almost anyone.

magnetic Pen Holder

Image 1

Iterations of the pen holder

First off, I measured the printer head’s housing and went on to create a box with the same dimensions. Then, I modelled a hole inside the box as the opening for the pen, making sure that it was large enough to accommodate our thickest marker pen.

The biggest challenge was to create a screw and its thread. Luckily, Tinkercad includes a ready-to-use ISO metric thread in its Shape Library. When creating a screw with a matching thread, it’s crucial to make sure that the thread is slightly larger than the screw, so that the printed parts can actually screw together. The short making-of video below shows the measurements I used.

yarn guiding clips

The second accessory I designed was a pair of clips that can attach to the printer’s bed - each with a small ring on the top to feed the yarn through. This was necessary to ensure that the yarn passes right underneath the marker pen. For the desing, I found a Clip shape in Tinkercad’s Shape Library, and adapted it to fit our needs.

Short video of the creation in Tinkercad

yarn guider

Stéphanie also kindly printed us a yarn guider to replace the improvised one. :)

Image 1 Image 2

iterations

As with any design process, we experienced several rounds of trial and error, before arriving at our final version. These are the improvements we made:

• Increased the size of the screw and thread to provide better grip
• Added a bottom flap to prevent the holder from moving
• Added an internal ring that fits our marker exactly. This allowed us to use precise measurements in our G-code rather than having to use relative positioning
• Adjusted the size and position of the slit in the clamp's ring secure the yarn better

knitting machine

We decided to test all the patterns with the knitting machine. In the beginning we fixed the number of needles to 20. For the last test, we increased the number of needles to see how it would influence the pattern.

Our initial idea was to see if we could create a shape onto the knitted yarn which we coded beforehand. Sophia, a fabricademy student from a few years ago made a program to translate images into g-code. However, they struggled a lot with recreating their image and this is probably due to the use of the knitting machine.

There is software to predict patterns based on your yarn. Colour pooling simulator is an example, and pool my yarn The problem with the knitting machine is that the tension is very variable. Unlike hand knitting, machine knitting is much more difficult to control where you start a row, end one, and keep this constant. With this in mind, we decided to focus on creating patterns rather than very fixed geometrical drawings. Because weaving or hand knitting would take too much time, we decided to stick with the machine.

Image 1 Image 2 Image 3

Image 3

printing process

This was the setup of the yarn printing machine at the end of the wee:

A final better video will be uploaded later.

thoughts and reflections

It was a really cool experience to be able to create a machine together. We got some nice results with a lot of patience and teamwork.

It was nice to work togeher with a joint objective, building on top of each other's work. It felt satisfying to improbe something that had already been started before us.