Textiles Area

About the Textiles Area

The Textiles Area is located inside the Physical Computing Lab on the 5th floor of Peckham Road, in PR_B502.

Opening Hours

Open Staffed
Weekdays 08:00–21:00 10:00–18:00
Saturday 10:00–18:00 Unstaffed
Sunday Closed Closed

Staff

Photo of Agnes Cameron
Agnes Cameron
she/her
Slack Agnes
Email Agnes

Sewing Machine

We have a Brother Innov-is A150 sewing machine.

Digital Embroidery

We have a Brother Innov-is V3 Embroidery Machine which can be programmed to create custom embroidered pieces using your own Processing sketch or using the Brother software.

Digital Embroidery

Using the Brother Innov-is V3 Embroidery Machine

To use this machine, you must have had an induction from one of the technical staff. This guide is to serve as a resource for students who have already had this induction, as a reminder of setup steps and as a troubleshooting guide.

Overview

The Brother Innovis V3 is a top-end domestic embroidery machine that can be used to produce high-quality digital embroidery on a range of fabrics.

A photograph of the Brother Innovis V3 machine, showing the mounted embroidery hoop.

Embroidery machines work by moving a piece of fabric (fixed within a hoop) in the x-y direction, beneath a needle that stitches by moving up and down. In this sense, they have a lot in common with many other 2-axis CAD machines (like laser cutters, routers, plotters), though because of the paticular qualities of working with stitches as opposed to straight toolpaths, embroidery software weirdness, and working with different fabrics, there's some practice involved in getting consistent results.

This guide is a condensed overview of the machine operation -- if you'd like a more detailed reference, see the Brother Innovis V3 User Manual.

Producing embroidery files

In order to embroider your design, you must first create a file in the .PES format (there are other embroidery file formats, but they are not typically compatible with Brother machines). These are then loaded onto the machine via memory stick. At CCI, there are 2 main ways that this can be done:

Both approaches have their advantages and disadvantages depending on the kind of design you want to make. In general, PEmbroider gives you a huge amount of control over how the design is stitched, whereas PE Design auto-generates stitches for you, allowing you to choose from a few different presets, and has a lot of features. As such, the learning curve with PEmbroider is a bit steeper, and generally requires a bit more tinkering to achieve a result, but is programmable, so can make generative designs, and can produce things that can't be made using PE Design.

As PEMBroider is just an extension of Processing, it can be run on your computer. PE Design is a piece of proprietary Windows software, for which we have one license, so it must be used on the dedicated Windows machine next to the embroidery machine. There is a Windows-only trial version available here.

Machine Setup

Changing the top thread

While this machine is threaded using a similar approach to most domestic sewing machines, it has some specific features that are a little less common. This is the thread that will be on the top side of your fabric, and must be machine embroidery thread (for how to tell, see 'my top thread keeps breaking' in troubleshooting).

The diagram below shows how the top thread should look when properly threaded through the machine. For a full step-by-step instruction, the guide in the manual is very thorough (page 38), though if you are unsure then please ask for a refresher.

A diagram showing the correct position of the top thread in the machine, going from right to left

The final step of threading the top thread is shown below -- pull the thread through the thread cutter, and then press the 'auto thread' button for the machine to automatically thread the needle. (it's also possible to do this by hand but much less efficient).

A diagram showing someone pulling the thread into the thread cutter on the right of the machine A diagram showing someone pressing the 'needle threading' button, which is located a couple of inches to the right of the 3 middle buttons at the top of the machine

Changing the bobbin thread

The bobbin thread is what binds the top thread to the fabric, and sits on what's know as the 'wrong side'. Typically, this thread is either black or white -- if you are sewing with dark-coloured thread, you might want to consider using black bobbin thread, but otherwise white thread is fine for most purposes.

This part can be slow the first time you do it, but precision is important -- if your bobbin is not set up properly you will spend a lot longer trying to figure out why your design hasn't come out right!

For a full step-by-step instruction, the guide in the manual is very thorough (page 36, or 31 if you want to wind the bobbin on the machine), though if you are unsure then please ask for a refresher.

Before you start:

  1. check you have the correct kind of bobbin (it's approx 11.5mm high, and should have part code SA156 somewhere)
  2. check that the bobbin thread is tightly wound. loose thread will ruin your tension later on
  3. check that the bobbin thread is actually bobbin thread (compare to the spools of bobbin thread on the desk)

Start by sliding the bobbin cover latch to the right, then gently lifting the bobbin from the machine.

a diagram showing a finger sliding the latch next to the bobbin cover to the right

Replace the bobbin, making sure that the direction the thread unwinds in the correct direction (clockwise!). As shown in the diagram below, pull out and around the thread cutter.

a diagram showing someone loading the bobbin in so that the thread unwinds in a clockwise direction, then pulling the thread around the thread cutter.

Be sure to replace the bobbin cover -- it should click when pressed in.

Tip: When about to embroider a large design, it's worth checking that there's a fair amount of thread left on the bobbin, to avoid having to change it midway (it's not an issue, just annoying).

IMPORTANT: make sure the bobbin thread is the correct way round (it will be the source of endless mystery issues if not). It has a little picture of the correct thread direction on the bobbin case,

Hoop Setup

In order to embroider fabric, it must be stretched taut in an embroidery hoop, which is tightened using one or two adjustable screws, then mounted on the arm of the machine. It is this arm that moves the fabric relative to the needle. This is low-key one of the most crucial bits of getting a design to work, and if you're having issues with distortion it's probably going to be here.

There are currently 3 hoop sizes available to use at CCI. In general, try and use the smallest possible hoop that will fit your design -- the larger the hoop, the less supported the fabric is, and the more likely you are to encounter distortion. This is particularly relevant if you are using a thin or stretchy fabric. The largest hoop is not a challenge!!

a comparison chart of hoops. The largest is 30cmx18cm, the middle is 18cmx13cm, the smallest is 10cmx10cm

If you don't know what hoops you can use, the machine will tell you -- just look for the hoop icon in the top while browsing designs. Designs too big for the hoop will be greyed out and you will not be able to stitch with them. The machine knows what hoop you have mounted and will adjust this accordingly.

It is strongly recommended that you use iron-on fabric stabiliser when embroidering -- it will keep the fabric stiffly fixed in one place, and is especially important when working with delicate fabrics. Iron this onto the fabric before putting it into the machine.

a diagram showing 2 hands pulling fabric taut at the sides of a tightened embroidery hoop

Tip: If you are using a stretchy or delicate fabric, take care not to over-stretch when putting the fabric into the hoop (or the design will pucker when you come to remove the fabric from the hoop). I would strongly suggest using the stock canvas we have at the CCI to test designs, especially when you are learning to use the machine.

You can also use the iron on stabiliser to 'float' very small pieces of fabric, ribbons or corners.

a diagram showing a small square of fabric that has been affixed to a larger piece of stabiliser, with the stabiliser fixed tight within a large hoop

Alignment

Aligning your fabric properly is really important, and the hoops all come with special alignment sheets that can help you line things up. This is by far the most annoying part of the whole process, but it's worth getting right.

IMPORTANT: be gentle when loading the hoop in and out of the machine. This is the part of the machine that is easiest to break through careless handling. Always make sure the hoop lock is off when pulling it out, and pull straight, not diagonally. Also make sure you put the bobbin in first.

Embroidering designs

Before you start:

a diagram showing the needle positioning menu

While embroidering:

If the top thread breaks during embroidery

This is not uncommon, and can cause some stitches to be skipped. Luckily, it's also easy to resolve. If this happens multiple times in the same design, however, there might be something wrong (see 'my top thread keeps breaking' in the troubleshooting section).

Enter the stitch counting menu (indicated below), then modify the stitch number using the needle icons. The machine's needle will move as you adjust, allowing you to see what's going on.

a picture of the machine interface, showing the location of the stitch counter menu in the middle row, second from bottom a photo of the open stitch counter menu, showing the selected options that will reduce the number stitch that the machine is currently on

For most cases (unless a lot of stitches were skipped), I'd recommend going back 10 at a time, then using +-1 stitch to line up the needle with the last proper stitches (go a couple in to ensure they can't come loose). The handwheel can be used to lower the needle toward the fabric and check alignment.

Skipping colours

To skip out (or, converesely, to redo) an entire coloured section, you can use the same menu used above to recover stitches, but press the button with the spool icon instead of the needle icon. This means 'go on to the next thread colour'. This can be a really quick way of experimenting with multiple versions of a design, with optional parts coded by colour, without needing to produce multiple separate files.

coming soon: using conductive thread

This part is yet to come as we need to do some tests! To do this, we will get hold of some conductive embroidery thread to do this -- the generic conductive thread is too thick to use on the machine.

Troubleshooting

My design is distorted/puckered

This issue is almost certainly to do with hooping. If you're trying larger and more complex designs, I would recommend watching this hooping tutorial which gives a lot of detail on proper technique.

Before you change anything in your design, check:

  1. is the fabric properly stretched on the hoop
  2. have you ironed on stabiliser to the back of the fabric (and is it properly bonded).

If the answer to both these questions is yes, this is likely not down to a single issue, and instead part of a set of different trade-offs:

Tip: Before you tear up your design, try ironing it: sometimes even pretty bumpy designs look a lot better after a bit of ironing.

a triangle with 3 corners. The top corner is labelled 'large design' the right is labelled 'thin fabric' and the left is labelled 'dense fill'. In the center it reads 'choose 2'

The bobbin thread is coming through the top of the fabric

This is a really common and very annoying issue, and may have a few root causes. A very common mistake when starting to use the machine is putting in the bobbin thread the wrong way round: if you have anything more than 1mm thread showing on top I would suggest addressing that first.

The machine says my design will take over an hour to stitch

In my experience, the machine is rarely lying here, and what you probably have is a large, complex design with a lot of filled areas, that will genuinely take that long. This kind of design will also use a lot of thread. If this is your first or second time using the machine, or you don't have 2 hours, I'd advise trying out a different design for now.

The design is blank in the machine's selection menu

This is a bug with patterns made using PEmbroider, and only applies to the first menu -> if you click into it, the design should show up. You can use the machine to save a copy of the file, which will be recognisable: I would recommend either doing this or giving your files distinctive names to prevent confusion.

The top thread keeps breaking

Firstly, check that you are using the correct thread (you cannot use this machine with regular sewing thread). All of the CCI embroidery threads are Brother brand, which will appear on the top of the spool.

If you have brought your own embroidery thread, that does not necessarily mean that it will work well on this machine. Check first that the thread is suitable for machine embroidery. Cheap embroidery threads (even if they are the correct type) can sometimes be poor quality and break easily on the machine. To test this, if you can fairly easily break the thread with your hands, it's probably too weak to avoid this issue. If you do want to buy your own thread, I would personally recommend Madeira thread (it's a bit more economical than Brother, and they have a great range).

If you are using the CCI Brother thread, then check that the top thread is threaded correctly, either by referring to the manual, or asking one of the technical staff. Check in particular that thread is unwinding in the correct direction, and that the 'notch' on the spool points away from the unwinding direction (or it can get caught).

I broke a needle

Alas. First of all, make sure you remove all the loose bits of needle and put them in the sharps bin. It's also worth checking at this point that the top thread isn't caught on anything, and that the bobbin thread isn't caught/bunched. If you're unsure about this, try to gently remove the hoop and loosen any caught threads.

To replace the needle, you will need a new embroidery needle, and the small, stubby screwdriver, both of which should be in the parts bin near the machine. Press the needle button to move the needle stump all the way up. Using the screwdriver, gently loosen the old needle stump, put it in the sharps bin, then put in a new needle. Make sure:

  1. It is a machine embroidery needle (if you're not sure then ask). For almost all purposes we use 75/11 needles.
  2. You push the needle all the way up
  3. The flat side faces away from you and the screw is properly tightened using the screwdriver

a diagram showing a hand pushing a needle firmly into the socket, while a screwdriver tightens the screw by rotating to the right

The User Manual has more diagrams of this process on page 45.

Once the needle is replaced, re-thread the top thread and bobbin thread before starting again. If you break a needle more than once in quick succession, there is probably an issue with your design.

If you don't feel confident replacing a needle, grab one of us (or if out of hours, leave the hoop in the machine, put a note on it, send us an email and turn the machine off).

Digital Embroidery

Creating Digital Embroidery Designs with PEmbroider

PEmbroider is an open-source library for embroidery design, maintained by CMU's Studio for Creative Enquiry. Designs are created using Processing code, particularly the Processing Drawing API which can be used to generate embroidery designs computationally. PEmbroider is well-documented online -- this tutorial page is here to point you to existing resources, and explain a couple of foibles with the software.

A piece of embroidered textile, decorated with the pembroider logo and small smiling creatures.

Setup

Setup instructions are here. When running an example sketch, if you would like to use the design, make sure that it exports in the .PES file format, as this is the form used by the machine.

In the PEmbroider example files, the file format is always declared in the variable outputFilePath, normally in the setup() section of the code. So, to change this (e.g. in the example file PEmbroider_shape_hatching_experimental), from:

    ...
    E = new PEmbroiderGraphics(this, width, height);
    String outputFilePath = sketchPath("PEmbroider_shapes_hatching_experimental.vp3");
    ...

to:

    ...
    E = new PEmbroiderGraphics(this, width, height);
    String outputFilePath = sketchPath("PEmbroider_shapes_hatching_experimental.pes");
    ...

If you create a file in the wrong format, you can always re-run the code, but it is also possible to convert between different embroidery file formats online here.

Using PEmbroider

The full API for PEmbroider is documented here.

Stitch size and spacing

Because of how Processing generates images, measurements are in pixels, not in mm -- this can make it a bit trickier to compare with other pieces of software.

In my experience, the default stitches used in PEmbroider are very small and very dense, much moreso than the defaults used by Brother software. Partly, this is a matter of taste, however, when using finer or stretchier fabrics, such tight and dense stitches can cause puckering (and these designs also take a lot longer).

This is something that's best to test out yourself and adjust, but I have included the presets I use below as a guide:

PEmbroiderGraphics E;
...

void setup() {
    ...
    E.strokeSpacing(2.0)    // this spaces the stroke (outline) stitches by 2 pixels
    E.hatchSpacing(3.0);    // this spaces hatch (fill) stitches by 3 pixels
    E.setStitch(5, 15, 0.0) // this sets minimum stitch to be 5px
                            // desirable stitch length to be 15px
                            // resample noise to be 0.0
    ...
}

(note: you set both the minimum and desired stitch length, as when embroidering curved shapes not all stitches will be the same length).

Examples

PEmbroider comes with a wide range of examples, that give a good idea of a number of different features of the machine. These are also good things to modify if you want to test out different stitch lengths and densities. Once you have installed PEmbroider, these may be accessed through the Processing examples menu. Many of these have already been stitched on the Brother machine as demos, and can be found behind the machine.

A screenshot that shows how to navigate to the examples folder -> first select examples in the 'file' menu of processing, then navigate to the 'contributed libraries/PEmbroider' subfolder

I've included some additional examples below that make use of some of the affordances of programmatic stitch generation.

Creating pixellated designs

One thing that programs like PEmbroider are particularly well adapted for is designs where the stitches need to be very precisely laid-out. It's much harder to get stitches to do what you want in software like PE Design, where you can control the parameters but not the actual stitch placement.

One such use-case is creating pixellated designs -- below is an example image and code that I have used in the past, that demonstrates how to manipulate stitches on a grid basis.

// PEmbroider script to stitch pixellated images
// author: Agnes Cameron

import processing.embroider.*;
PEmbroiderGraphics E;

void setup() {
  size(1000, 1000); 
  noLoop(); 

  // Load the bitmap image to embroider. 
  // Should consist of white shapes on a black background. 
  PImage myImage = loadImage("ken.gif");

  // Create and configure the PEmbroider object, E
  E = new PEmbroiderGraphics(this, 1000, 1000);
  String outputFilePath = sketchPath("ken.pes");
  E.setPath(outputFilePath); 

  // Initial setup of PEmbroider object.
  E.beginDraw(); 
  E.clear();
  E.fill(0, 0, 0); // start the design at 0
  E.noStroke();

  // Parallel hatch 
  E.setStitch(5, 30, 0); //set the stitch to be the same size as the 'pixels'
  E.hatchMode(PEmbroiderGraphics.PARALLEL); 
  E.hatchAngleDeg(0);   // you want to set this to 0 for a 'pixel' effect -- default is angled
  E.hatchSpacing(3.0);  // this is nice and not overly dense
  E.image(myImage, 0, 0);
  
  // finishes the file and shows
  E.optimize();    
  E.visualize();  // show the file
  E.endDraw();    // write out the embroidery file
}

This code is created to run with a 1000x1000 .gif image, with a 'pixel' size (e.g. white squares) of

To run this code, create a folder called 'data' in the same folder as the processing file, and then save this image as 'ken.gif'. You can test this out with your own images, too.

A black and white pixellated image of the computer engineer Ken Thompson, to be downloaded for use with the script

The output should look something like this:

A screenshot of the embroidery pattern produced from the imahe of ken thompson

Warnings and errors

Stitches are out of bounds

A common warning is this one: it occurs when you have a design that goes right to the edge of the canvas. In my experience, so long as the design looks OK to you, this is normally fine to ignore, but it's worth making sure that the the design looks right before embroidering.

A screenshot of a dialog box that starts with the line "Some stitches are out of bounds!", with an option to 'ignore', as well as options to 'crop' or 'abort'

Designs don't display on the Brother embroidery machine selection menu

This only applies to the selection menu: if you click into the file, the design should show up, and the information the machine gives you about the design's size (and corresponding hoops) should be correct. If this is an issue, you can use the machine to save a copy of the file, which will be recognisable: if you are embroidering multiple designs in one session, I would recommend either doing this or giving your files distinctive names to prevent confusion.

Digital Embroidery

Creating Digital Embroidery Designs with PE Design 11

coming soon :)

Digital Embroidery

Workshop: Generative Embroidery with PEmbroider

This is the written version of an embroidery workshop in the CCI, and can either accompany the live workshop or be worked through by itself. As we go through the exercises, it's a good idea to have the PEmbroider Cheat Sheet open in a tab for reference. These notes are also heavily adapted from the cheat sheet. This workshop is based on Carpentries format, which means that participants should code alongside whoever is running it.

Copies of the files used for each of the exercises that can be downloaded here, but I'd recommend trying to generate the files yourself where possible.

1. Hello World: Drawing a Line

Follow the instructions here to set up PEmbroider on your computer. You will need Processing 4. The first thing we will do in PEMbroider is draw a single line, which we can also use to test everything is working correctly.

Template File

All files in PEmbroider have a similar structure, and the cheat sheet helpfully provides a template, which I've adapted slightly to match the file format we use in the CCI. We'll be using this as the basis for all the files in the workshop. This file draws a single line, but we can change that to anything we like.

// Example PEmbroider program
import processing.embroider.*;
PEmbroiderGraphics E;

void setup() {

  // Starting up:
  noLoop();
  size(600, 600);
  E = new PEmbroiderGraphics(this, width, height);
  
  // change this line you want a different file type
  String outputFilePath = sketchPath("filename.pes"); 
  E.setPath(outputFilePath); 
  E.beginDraw();
  E.clear();

  //-------
  // Content goes here:
  E.line(0, 0, 600, 600); 

  //----------  
  // Visualization and export:
  // NOTE: Leave optimize() and endDraw() commented out,
  // until you are ready to export the embroidery file! 
  // Don't forget to un-comment them when you want to export!
  //
  // E.optimize(); // VERY SLOW, but essential for file output! 
  E.visualize(true, true, false);   // Display the embroidery path on-screen.
  // E.endDraw();  // Actually writes out the embroidery file.
}

In order, this file:

There are some other lines that are 'commented out' (have slashes in front of them) and don't run. These we might use later but for now we don't need to use them.

When you run this file, you should see an output that looks like this (if you don't see this, you will want to check over the setup steps again):

The pink dots represent the ends of stitches, where the needle enters the fabric. Shortly we will experiment with different stitch types and lengths, but for now we are using the default settings.

The first thing we will look at is the structure of the canvas. If you like, you can also try 'commenting out' the content line, to just see a plain canvas.

Exercise 1.1

Drawing lines

The PEmbroider code for drawing a line is:

E.line(x1, y1, x2, y2);

This means that (x1, y1) is the coordinates of the point where the line starts, and (x2, y2) is the point where the line ends. The E.line() part means "use the line function that belongs to PEmbroider, which is represented in our code by the letter E". We call this a 'method' In our code, we get a diagonal line because we draw from the point (0, 0) to the point (600, 600) (the edge of the canvas).

Exercise 1.2

You might find these notes on coordinate grids in Processing helpful here!

2. Playing with shapes

From now on, unless we're changing more of the file, I'm going to list just the 'content' code that we're changing, using ... to represent the rest of the file. In our last exercise, the content was a single line -- the E.line() method -- but it can be more -- the important part is that it goes in the same place in the file each time.

Try changing out the line for a circle:

...
E.circle(200, 200, 200);
...

You should see a slightly off-center circle. In the documentation, the E.circle() method is listed as:

E.circle(x, y, r);

Exercise 2.1

Composite Shapes

PEmbroider also allows us to merge outlines to make composite shapes. This can quickly allow us to create more complex drawings. In this example, we merge together 2 circles:

...
E.beginComposite();
  E.composite.circle(320, 250, 200);
  E.composite.circle(420, 250, 200);
E.endComposite();
...

Exercise 2.2

here's one I made earlier:

3. Fills and Hatching

Up until now, all the shapes we've been drawing have been outlines. PEmbroider supports several kinds of fills, which we will experiment with now. The way settings work in PEmbroider (and in Processing!) is that you set a bunch of settings, then draw the thing you want the settings to apply to, and then if you want to draw something with different settings, you change the settings and then draw the thing. For example, the order you'd do things if you wanted to draw a red square and a blue square would be:

> set fill to red
> draw square
> set fill to blue
> draw square

In our case, what this means is that if we add some code that adjusts the fill settings, this needs to go before the part where we draw our shape. Let's try drawing a filled circle:

...
E.hatchMode(E.PARALLEL);
E.fill(0,0,0);
E.circle(300, 300, 200);
...

Fill Types

There are 6 different fill types in total in PEmbroider. These can each be set using the following lines of code:

    E.hatchMode(E.CONCENTRIC);
    E.hatchMode(E.PARALLEL);
    E.hatchMode(E.SATIN);
    E.hatchMode(E.SPIRAL); 
    E.hatchMode(E.PERLIN);
    E.hatchMode(E.CROSS);

Exercise 3.1

Fill Settings

As well as being able to change the type of fill, it's also possible to change the fill settings, namely the spacing of the fill lines, the colour of the fill, and the angle of the fill lines (for satin and parallel fills, where the lines have a prevailing angle).

We can do this using the same principles as before (e.g. putting the settings before the thing we want them to apply to). The methods to adjust the settings are listed below (note that we always need to specify a fill colour, even if it's just black):

E.hatchSpacing(spacing); // sets the density of adjacent runs (in machine units)
E.hatchAngleDeg(angle);  // sets the orientation for SATIN & PARALLEL (in degrees)
E.fill(R, G, B);         // sets your thread color (numbers between 0-255)

Exercise 3.2

Another really important line is the setStitch() property. This sets the length of the stitch. Unlike hatch spacing, setStitch takes 3 arguments:

E.setStitch(minLength, desiredLength, noise);

Exercise 3.3

4. Stroke and Stitch Settings

The final group of settings we're going to look at is modifying the stroke (line) style. Similarly to fills, you need to modify the settings before drawing your line.

There are 2 stroke types in PEmbroider; tangent is the one we've been using by default, but perpendicular can be used to get a thicker, more defined outline.

E.strokeMode(E.PERPENDICULAR);  // Stitches are perpendicular to the stroke
E.strokeMode(E.TANGENT);         // Stitches go in the same direction as stroke

As before, stroke color can be set using RGB values. The other settings are the thickness of the line (stroke weight) and the stroke spacing (e.g. for perpendicular strokes).

E.stroke(R, G, B);         // sets the stroke color, just like Processing.
E.strokeWeight(width);     // sets the thickness of the stroke (in machine units)
E.strokeSpacing(spacing);  // sets the density of the hatching within the stroke

Exercise 4.1

5. Loops and Randomness

Now we have a good idea of what you can do with PEmbroider's API, we can try out some generative code.

For loops

For loops are structures that allow the same piece of code to be repeated multiple times with different inputs. We will have a go with them here, but for a full tutorial it's worth going through this page on for loops in Processing.

We're going to try out a for loop that repeatedly draws lines on the canvas, changing the position of the line each time it draws.

...
for (int i = 1; i < 10; i++) {
	E.line(50, i*50, 550, i*50);
}
...

In this code, we create a number, i, that will go from 1 to 10, increasing every time. The first time the code runs, i is equal to 1, and so i*50=50. The next time, i=2, so i*50=100, and so on, up till i reaches 9. i cannot reach 10 (as the code will only run for i<10) and so the for loop ends.

Exercise 5.1

Random numbers

Another very useful tool for making generative patterns is randomness. Unlike the code we were using before (which used scaled variations where we could predict what the outcome would be), randomness adds an element of chance. In Processing, the function random(50) will return a random number between 0-50. This number will be a decimal (float) rather than a whole number (int), so if we want to use it like a whole number we also need to use the int() method.

...
for (int i = 1; i < 10; i++) {
	E.circle(50 + i*50, 100, int(random(50)));
}
...

Exercise 5.2

Nesting for loops

The last thing we will look at is using 2 nested for loops to create 2D designs. This isn't the only way to achieve this -- remember the grids from exercise 5.1 -- but this will help us a lot.

Before we get there, we could also look at what happens when we nest for loops inside other things, in this case, the composite shapes code from before.

...
  E.beginComposite();
  for (int i = 1; i < 10; i++) {
    E.composite.circle(50 + i*50, 100, 50 + int(random(50)));
  }
  E.endComposite(); 
...

By putting the for loop inside E.beginComposite(); and E.endComposite();, it's the same (from the point of view of the computer) as writing 10 separate composite circle lines, but for us it's a whole lot quicker.

and look! A beautiful worm:

We can use the same principle to put one for loop inside another:

  for (int i = 1; i < 10; i++) {
  	for (int j = 1; j < 10; j++) {
    E.circle(i*50, j*50, 50 + int(random(50)));
    }
  }

Now we get a whole grid of circles!

Exercise 5.3

Here's one I made earlier:

6. Polylines and curves

As well as having preset shapes, PEmbroider (like Processing) supports making custom shapes by defining a set of points along a line. To start one of these shapes, you need to bookend the line with:

E.beginShape();
	// ...points
E.endShape();

If the final co-ordinate matches the first co-ordinate, we can also fill the shape: if not, it's just a stroke. Polylines are also great as within the line the machine doesn't need to make a jump; this is helpful for avoiding too many floats later on.

Each point on the line is given by E.vertex(x, y), a single point in space. To draw a spiky shape, we can draw a bunch of points:

E.beginShape();
	E.vertex(10,10);
	E.vertex(500,50);
	E.vertex(450,250);
	E.vertex(350,140);
	E.vertex(200,300);
	E.vertex(10,10);
E.endShape();

Exercise 6.1

Curves

There are a number of different ways to render curves in Processing, which inherit from the different curve-drawing techniques in computer graphics. These are: arcs, splines and Bézier curves. The Processing curves tutorial has a good summary of this:

The tutorial gives a great overview of the different types and I'd recommend experimenting with all of them.

7. Generating embroidery from data

Processing allows data to be loaded in CSV and JSON formats. For this exercise, we're going to use NASA's Land Ocean Surface Temperature dataset, which gives the mean global temperature since 1880 till present-day. To do this task, I have created a folder called datasets within the processing sketch folder, and created a file inside that called temp.csv.

First, make an empty sketch and try to read in the data from the .csv file:

Table table;

void setup() {
  
  table = loadTable("datasets/temp.csv", "header");
  println(table.getRowCount() + " total rows in table");

  for (TableRow row : table.rows()) {
    
    int year = row.getInt("year");
    float temp = row.getFloat("unsmoothed");
    println("year " + year + " temp " + temp);
  }
}

You should see the data from the csv printed to the terminal.

The for loop that starts for (TableRow row : table.rows()) is where we're going to use our values. First, we can try a simple example of drawing circles for each entry in the table, with the radius proportional to the temperature. As some temperature values are negative, we will need to adjust these up.

We want to add the embroidery template setup before the table is created (and also E.optimize()) after! To draw our circle, we can add directly to the for loop:

...
  for (TableRow row : table.rows()) {
    
    int year = row.getInt("year");
    float temp = row.getFloat("unsmoothed");
    float radius = (temp + 1.0)*45;
    E.circle(100, 100, radius);
  }

...

This code will create all the circles drawn in the same place. Ideally we'd like to space them out! We can do this by adding a counter:

...
  int counter = 0;

  for (TableRow row : table.rows()) {
    
    int year = row.getInt("year");
    float temp = row.getFloat("unsmoothed");
    float radius = (temp + 1.0)*45;
    E.circle(100, counter*20, radius);
    counter = counter + 1;
  }

...

7.1 Creating a grid from linear data

An issue we have here is that the data comes as one long list, which makes it hard to generate a tractable embroidery file. There are a number of ways around this, one of which is to use the modulo operator. This gives you the remainder when a number is divided by another number. This means, we can define a row length and count along our dataset in rows.

  ...
  int counter=0;
  int rowLength = 13;
  int spacing = round(900/(rowLength));
  
  for (TableRow row : table.rows()) {
    int i = counter % rowLength;
    int j = floor(num/rowLength);
    
    int year = row.getInt("year");
    float temp = row.getFloat("unsmoothed");
    float radius = (temp + 1.0)*45;
    
    E.circle((i+1)*spacing, (j+1)*spacing, radius);

    counter=counter+1;
  }
  ...

8. Tips, notes, further reading and extension exercises

We've scratched the surface of PEmbroider's full capabilities, which include things like image imports, interpolation, clipping and more.

8.1 Saving files + naming

To save the file as an embroidery file, you need to

  String outputFilePath = sketchPath("triangles" + str(int(random(0, 100))) + ".pes"); 

8.2 Scale, density and stitch sizing

I personally find PEmbroider's presets a bit dense, and think they make for quite tough-feeling embroidery. My main recommendation is to make a sample sheet where you experiment with different fill densities, stitch lengths and stroke widths till you find some you like, but failing that, my defaults are:

    E.strokeSpacing(2.0)    // this spaces the stroke (outline) stitches by 2 pixels
    E.hatchSpacing(3.0);    // this spaces hatch (fill) stitches by 3 pixels
    E.setStitch(5, 30, 0.0) // this sets minimum stitch to be 5px

If you want to use these throughout, just stick this above the 'content' section of your file.

Extension exercises

Digital Knitting Machine

We have a Silver Reed SK840 Knitting Machine which can be programmed to create custom knitted pieces.

Digital Knitting Machine

Using the Silver Reed SK840 Knitting Machine

Overview

The Silver Reed SK840 knitting machine is a 4.5mm standard-gague knitting machine that is intended for use with 3- and 4-ply yarns. The Silver Reed manual is available online here, and we have a paper copy in the workshop (as the online copy is poorly digitised, we will also make a better copy soon). You must be trained by a member of staff (currently, ask Agnes) before using the machine -- this guide is here for reference and troubleshooting.

A picture of the silver reed knitting machine, showing different accessories laid out beside the needle bed.

The SK840 is a domestic knitting machine, and requires some manual input to operate. Fully-automated machines are normally referred to as 'industrial' knitting machines, to differentiate them from their domestic equivalents. Despite the lack of full automation, domestic knitting machines are often used in fashion for prototyping and designing new textiles. To learn more about industrial machines, this video gives an overview of common types, and this video is a good intro guide to knitting in general. If you want to look deeper into industrial knitting principles, the Indian Institute of Technology's textile technology department has a whole lecture series online that's very clear and gives a great amount of detail.

Learning Machine Knitting

This post is not a detailed tutorial, but instead should serve as an introduction to the capabilities of our machine, an idea of different avenues to explore, and an overview of the steps involved in creating knitted textiles in the CCI. Machine knitting is detailed and complex, and requires time to learn and develop technique.

How to search for knitting tutorials

When looking for guides online, you will notice many variations in machine make and type, including machines with plastic beds, doubled beds, different needle gagues and tools, and a variety of carriages. While there are details particular to the Silver Reed, a lot of technique can also be learned from general 'knitting machine' tutorials on any machine as the core operation of the needles and carriage is very similar. The caveats to this are when someone is using a carriage we don't have (e.g. a lace carriage), or using both beds of a double-bed machine (if they're using one bed, it's totally fine). If you're unsure, just ask (more likely than not, we can do it on our machine).

Steps to Create Knitted Textile

A diagram that points out the different parts of the Silver Reed machine. Parts include the rail, the carriage (slides along the rail, and contains russel levers, a stitch dial, cam and release leavers), the arm (attached to the carriage, contains a yarn feeder, weaving knobs and weaving yarn holders, and a yarn cutter), and a diagram of a latch needle

In machine knitting, knitted fabric is created by manually sliding the carriage back and forth over the needle bed, which loops a single strand of yarn a row at a time. Knitting is distinct from weaving: in weaving, fabric is created by interlacing 2 sets of threads at right angles to one another, while knitting involves taking a single thread and looping it around itself, one row at a time. (we currently don't have any weaving capabilities in the CCI).

A diagram showing the structure of knitted fabric

Casting on and off

Because of the structure of knitted fabric, the top and bottom edges of the textile need to be made using a special stitch, to prevent the fabric from unravelling. At the start of the piece this is called 'casting on'; at the end it's called 'casting off'. Depending on the yarn, if you are just experimenting with samples then you can get away without casting off (the fabric will still be vulnerable to unravelling), though there is no way to knit without casting on.

Casting on

There are a few different cast-on techniques that can be used on the Silver Reed, 2 of which are enumerated in the manual:

Casting/binding off

Casting off is an important technique to learn, and while slow at first will get much faster over time. The general idea is to bind off one stitch at a time by looping it into the next stitch along, working your way across the fabric until there is a single stitch left to tie off.

There are 2 main techniques: latch tool cast-off and transfer tool cast-off. Transfer tool is a little slower, but considerably easier to learn (and the one I'd recommend starting with). This video does a good job of demonstrating both techniques.

Photo of the edge of knitted fabric, showing the casting off

Different Types of Stitch

The SK840 supports a range of options for different kinds of stitch, which can be selected by changing the dial on the top of the carriage. Many of these stitches may also be used alongside the

The SK840 may be computer-controlled using the DesignaKnit software and SilverLink module, that connects to the knitting carriage. Currently at CCI we do not have either a lace carriage or a ribber. A key to the core machine parts is pictured below:

The simplest knitting style on the machine is called 'Stockinet' -- this is a style of knitting that will result in a smooth 'knit' side on one side of the fabric, and a rougher 'purl' side on the other.

Stockinet

This is the simplest form of knitting, and equivalent to a 'knit-purl' alternating stitch in hand knitting. It produces a flat, smooth side (the 'right side') and a rougher side ('wrong side'). To knit stockinet, select the 'O' stitch setting on the carriage.

All stitch varieties listed here still require a stockinet cast-on.

Fair Isle and Patterning

Fair Isle knitting is a common way of creating patterns in knitted textiles, by alternating between 2 colours within each row. On the SK840, this is also one of the three stitches (the others being slip and tuck stitches) that may be automatically controlled using the SilverLink controller; it's quite low-effort to produce some really beautiful, impressive things that it would be very hard to knit by hand.

To knit Fair Isle, the machine should be connected to the computer via the SilverLink, and DesignaKnit should be in interactive knitting mode. The carriage should be turned to 'F' for Fair Isle, and the arm should be threaded with 2 yarns (the first in position 1, the second in position 2).

This video shows the technique using punch-cards rather than the computer, but the core ideas are the same. For more guidance on creating patterns using DesignaKnit, see the wiki page on Creating Digital Knitting Patterns with DesignaKnit.

orbs.jpeg

Slip Stitch

Slip stitch is a knitting technique where a stitch is skipped (or 'slipped'), that can be used to add texture to knitted fabrics either manually or automatically (using the SilverLink). Skipping stitches creates patterns in the strands of un-knitted yarn, and is often used alongside other texturing techniques.

Tuck Stitch

Tuck stitch is a knitting technique that involves tucking a stitch from one row into a row above. Like slip stitch, tuck stitch can manipulate the texture of the knitted fabric, though somewhat more dramatically, as depending on the depth of the tuck the fabric can be structured in all sorts of interesting ways. Stitches may be tucked automatically using the SilverLink.

Tuck Mosaic

The 2 colours here are knitted in horizontal stripes, but with a regular pattern of stitches 'tucked' into the stitch above, manipulating the structure to resemble vertical lines. The result looks very beautiful, but it's time-consuming to change the colour every 2 rows.

What's interesting about tuck patterns is that they look nothing like the patterns that produce them. There's a great and incredibly detailed blog post on Alessandrina (very helpful knitting blog) which explains in great detail.

Mock Rib

Many knitted garments are hemmed with a stretchier 'rib' edge (think cuffs, collar and bottom of a sweater, for example). This adds structural stability to the fabric and also looks great. Typically this is done using a 'ribber', or a double bed machine, which we don't have in the CCI. However, it's perfectly possible to make a mock rib using a single bed machine that's functionally very similar.

I watched this video for guidance, which was pretty good (it's in Norwegian, but English subtitles), which gives a good guide to creating a 'mock' rib on a single bed machine.

Knitting with every other needle

This is used to knit yarns like mohair, or chunkier yarns. This video (it's in Norwegian, but has English subtitles) gives a good demonstration of the cast-on technique required: after casting on, knit as normal, but with only half the needles engaged.

Special tools and carriages

Intarsia

The Intarsia Carriage is an alternate carriage for the machine that allows multiple colours to be used in a single row, without having runners along the back like in Fair Isle. It produces large blocks of colour (if you want to use fine detail, Fair Isle is normally a better bet), though requires considerably more manual effort than

Automatic Colour Changer

We have an automatic colour changer in the CCI, that makes changing colour between rows considerably faster, and also allows selection between 4 yarns, rather than 2. It cannot change colours within a row (for that, you want either fair isle or intarisa) -- instead think of it as a way of making stripes a lot more efficient. It's particularly useful when knitting tuck mosaic patterns that require regular colour change. The automatic colour changer may also be used with fair-isle or other patterning techniques (see example below), though when using 2 yarns (as in Fair Isle) only one may be changed automatically.

Please talk to Agnes before using the automatic colour changer for the first time.

photo of an automatic colour changer attached to the end of a knitting machine

fair isle sample made using the automatic colour changer

E-textiles and technical knits

The knitting machine can also be used to create textiles with electronic properties, including conductive and stretch sensors, and even radio components. Please see this guide to knitting with conductive yarn for more information.

Resources

Choosing Yarns

We provide a range of yarns at the CCI that are compatible for use with the machine. It is strongly suggested that when starting to use the machine, you make use of the 2-ply lambswool we provide (and that will be used during tutorials). 2 strands of the lambswool are threaded through the tensioner together to create a 4-ply yarn.

If you are planning to create larger projects (e.g. bigger than a standard sample swatch), we ask that you source your own yarns. Finding yarns suitable for machine knitting is a different task than for hand knit: this guide offers a good overview of considerations. In general, you will have more luck with yarns intended for machine knitting -- talk to Agnes if you would like more advice.

At the CCI, our main yarn supplier is Uppingham Yarns, who have a wide range and high quality. Other recommended suppliers include:

Machine Knit Inspiration

electronic textiles

machine knitting for actuation/active textiles

textbooks

Digital Knitting Machine

Creating Digital Knitting Patterns with DesignaKnit

DesignaKnit is a pattern drafting, garment design and interactive machine control software. It is compatible with multiple different kinds of knitting machines, including the Silver Reed SK840, which is the machine we use at the CCI.

A screenshot of the DesignaKnit software's stitch designer window

DesignaKnit includes multiple different features, which may be used separately or together. The main ones to know about are:

Video tutorials from Prism's Creations are a great resource. They go through different features of the software one-at-a-time, eventually creating an asymmetric patterned jumper. To get into patterns, I would start with the second video: Stitch Designer Basics.

Digital Knitting Machine

Knitting With Conductive Yarn

Knitting is a really versatile and flexible way to integrate sensors and other conductive material directly into fabric. Depending on the kind of pattern, and the type of yarn that you use, knitted textiles can be used to integrate directly into stretchable, conformable fabric:

At the CCI we have a range of conductive yarns and threads that can be used that have variable conductive and textural properties. We have a Silver Reed knitting machine that is suitable for knitting 2-3ply yarn, and can be used programatically with the DesignaKnit software.

Typically, the conductive yarn is used along with a carrier yarn, that adds structural stability, colour, and texture to the knit.

In general, knitted textiles should not be used to conduct any currrent greater than 100mA or so, as they can risk getting hot, and because of their form (and the potential for shorts) in general my advice would be to consider them primarily as sensing rather than conductive material.

This page isn't a tutorial on the Silver Reed (please email Agnes if you would like one), but an overview of options for making conductive knitted textiles at the CCI.

Knitted Stretch Sensor

Knitted fabrics that integrate conductive yarn typically have some in-built resistance, which will change depending on

Digital and e-textile design at the CCI

This page is a guide to different techniques that can be used in digital and e-textile design, resources we have at the CCI, places to source materials, and possible sources of inspiration/research references.

Here, 'digital design' refers to textile equipment that works with CAD, and e-textiles specifically to the integration of electronic components within textiles. Both of these things are well-supported at the CCI and can also be done in combination.

Equipment

At the CCI we have two main pieces of digital textiles equipment:

Both of these machines require training to use. Please check Orb for upcoming tutorials, or contact Agnes for more information. Additionally, we have a Brother sewing machine that can also be used for student projects. If you have used a sewing machine before you may use this without training, otherwise ask the technicians.

Programmable knit sample:

Digital embroidery sample:

Online Resources

e-textiles

A fantastic resource for most e-textile related ideas and tutorials is How To Get What You Want, aka the KOBAKANT art collective DIY wearable technology documentation site. I'd strongly recommend just browsing around the site -- they have some great detailed guides, including knitted sensors, robust hard/soft connections, textile speakers, and using conductive velcro as a switch.

Materials

Non-electronic materials

At the CCI we have embroidery thread, sewing thread, lambswool and cotton yarn, and limited amounts of calico, cotton drill and backing fabric to experiment with on the machines. If you are planning a larger project, we ask that you purchase your own materials, and can give you advice on doing so.

Conductive Thread

It's better to think of conductive thread as a long resistor than a traditional cable. All conductive threads come with an associated resistance per unit length, and this can vary a lot between different brands and thicknesses. For a ballpark figure, Adafruit's 2 ply conductive thread is made of stainless steel, and has a resistance of 16 ohms/foot. If you're unsure of which brand you're using, you can always use a multimeter to measure it.

Image showing a pair of hands holding probes touching a length of conductive thread. The probes are attached to a multimeter, which reads the resistance of the thread.

Adafruit have a short conductive thread tutorial that covers basics like hand- and machine-stitching, and steps to prevent short circuits.

Conductive Yarn

Conductive yarn is different to conductive thread: it has much higher resistance, which makes it inadequate to directly connect components unless they are very close together or the knitted yarn is stretched, but it is well-suited to pressure sensing.

When a knitted sample is held loosely, it has a high resistance as the steel fibres in the yarn do not make contact with one another, but when the sample is stretched, the steel fibres are pulled into closer contact, reducing the resistance and allowing the flow of an electric current.

Conformable Connections

Conformability (using soft and flexible components) is key to making robust e-textile projects, and is particularly relevant to projects using conductive thread. We have a stock of conductive velcro and poppers that can be used to integrate wires into projects, as well as super-flexible silicone wire.

Sourcing Materials