Make a crocheted stretch sensor

DSC05918

 

We are aiming to make a bag with a handle that senses when you have over-filled it.

 

The steps in this project are:

  1. crochet the sensor
  2. felt the sensor
  3. prototype the circuit and coding
  4. design the physical circuit with the bag

Tools and materials needed are listed under each step – it is worth reading ahead so you have what you need in advance.

 

Approximate timings for a beginner:

crochet (including learning through mistakes) – 4 hours over two days

felting – 1 hour plus 24 hours drying

electronics – input pin out and code 1 hr

electronics – output pin out and code 1 hr

translate into physical circuit – 4 hrs

 

STEP ONE: Crochet the sensor

The first step is to make the stretch sensor handle. This image shows a crocheted tube with wool, elastic and conductive yarn. Its resistance is measuring 66.3 Ohms at rest. When stretched, the resistance will drop and we can use this to trigger an output meaning the bag is too heavy. You can choose to make the outputs a pattern of lights or a warning sound.

DSC05817

The image shows the crocheted but not yet felted sensor attached to the multimeter: it is reading a resistance of 66.3 Ohms.

 

I have taken inspiration from other Instructables and blogs to help me with this project, namely Lara Grant’s crochet work, and Crochet Guru’s post on YouTube, Crochet in the Round. Crochet Guru was very helpful as I had not crocheted before – if you are the same, be prepared to make a few mistakes and to do the work over a few times.

 

  • You will need:
  • crochet hook – 5mm
  • merino wool yarn – the more Merino the better (you’ll see I tried more than one)
  • conductive thread – I used a 4-ply steel thread
  • elastic thread – shirring or knicker elastic
  • embroidery scissors
  • multimeter
  • crocodile clips
  • sushi mat
  • towel
  • a sink and basin of cold water
  • a cup of warm water
  • liquid soap

Combine the three yarns: wool yarn, conductive thread and elastic thread. Make a slip knot and slide it onto the crochet hook.

 

DSC05802 DSC05803 DSC05804

 

Make 4 chain stitches.

 

DSC05805 DSC05808 DSC05811

Push the hook through the last stitch you made, just above the very bottom strand of yarn. Letting the hook do the work for you, pull the yarn through so that two loops are on your hook. Now pull the yarn through both this new loop, and the one already on the hook, leaving a single crochet on your hook. This is a single crochet (sc).

Now we need to increase the number of stitches – this is one way of increasing, and is useful here because it doesn’t leave a hole at the centre of the work.

Push the hook through the same stitch as before. Single crochet again. This means you have made two single crochets from one stitch. Do the same for the remaining three stitches (holes), that is, single crochet twice in each.

At the end, make a slip stitch through the opposite end of the work, bringing the two ends together. To make a slip stitch, simply pull the yarn through both existing loops.

 

If you are new to crochet, it is worth practicing first with a single strand of yarn; the label on the ball will tell you which hook size will work best. This will help you get a feel for the rhythm and logic of the crochet structure.  

‘single crochet’ (sc) =  yarn over (yo); pull through to create two loops on the hook; yo and pull through both loops to leave just one on the hook

If you find increasing difficult to follow, try doing Crochet Guru’s tutorial first. She teaches a different way of doing it, but it helped me to understand what was happening before I went on with push_reset’s Instructable.

 

Count the stitches that make up the round and look for the V forms that are linking together around the edge. When you push your needle into a stitch, you are going to push it through under this horizontal V. Working into each of the stitches in turn will start to build the length of the tube.

To make sure you keep working the same six stitches, count the Vs every so often. Your hook is inserted below the horizontal V. If you work the same stitch twice, or skip a stitch, the shape of the wall will alter. To open the wall up (flatten the shape) you would work more single crochets into the same stitch. To narrow the wall, you would decrease the number of stitches by single crocheting through three at a time (we’ll do this to finish off). My first attempt was blue, very long, and not very uniform in shape! That’s why some of the images show a yellow tube too.

Continue until the tube is about 18cm (7 inches) long – bearing in mind you will be felting the sensor using a sushi mat, don’t make the tube too long – keep it shorter than the width of the mat.

DSC05812

To finish off by decreasing, sc but leave the new loop on the hook. sc the next stitch too, and then yo and pull through to leave one loop. Repeat this twice more to close the tube. Finish off by cutting and pulling the yarn through completely.

DSC05813  DSC05814

 

Before you felt the work, measure the resistance of your sensor with a multimeter:

Using the crocodile clips, attach the positive and negative electrodes to the two ends of the crocheted piece, making sure they are in contact with the conductive yarn. Switch the multimeter on and to the lowest resistance band (on this one, below 200 Ohms) (you can also refer to our tutorial on using a multimeter here – link to follow).

DSC05817 DSC05819

 

The resistance will decrease when the work is stretched, and return slowly to more or less its original reading when it relaxes. This piece settled at about 66 Ohms when at rest, and dropped to just over 27 Ohms when stretched to 30cm.

Note that you should avoid touching the textile with your hands when stretching it as your body acts as a large capacitor and significantly affect the resistance. Instead, stretch it carefully while holding the insulated crocodile clips.

After a few minutes, the resistance of this piece returned to about 50 Ohms, lower than it’s starting point. It continues to rise slowly if left at rest, but stops at under 60 Ohms, because the form has not fully returned to the same physical resting position.

This return is not complete or reliable though, because of the number of stitches and connections involved (the same is even more true of knitted stretch sensors – see Glazzard et al 2010). A short narrow sensor is more reliable than a long or broad one. Some of this behaviour can be dealt with in the programming by setting values as output triggers (or by building in self-learning algorithms). The physical return, and therefore the reliability of the values you are getting, can also be helped by the felting process, and that’s what we’re going to do now.

 

STEP TWO: Felt the sensor

You will need:

  • male and female D-sub connectors
  • a sharp needle with a large eye, and needle threader
  • flat-nosed jewellery pliers
  • heat shrink tubing
  • heat gun

DSC05822 DSC05824 DSC05826

 

Place the towel on a table or bench with the sushi mat on top of it. Prepare a small bowl of hot water with a few drops of soap liquid in it, plus a larger bowl of cold water.

Be prepared for a work-out – this process takes just under an hour.

Dunk the crocheted work into the hot soapy water. Squeeze the excess water out and place it on the mat. Now roll it, pressing down, about 200 times. Then dunk the work into the cold water to shock the fibres and help them shrink faster. Again squeezing out the excess water, scrunch the work in your hands about 75 times.

This process should be repeated at least 7 times according to Lara Grant (whose practice is all about electronic felted interfaces). Her work shrank by 0.75 inches – my work, using the yellow merino ‘Woolly’ yarn, didn’t shrink so much, if at all, but the wool did felt and the form tightened up.

Leave the work to air dry (at least 24 hours).

My tips for this stage would include: get some clips to hold the towel to the table top; listen to music; get someone to help you; and devise a machine to automate some of the rolling (a quick online search shows needle felting and sheet roller machines, but nothing for making tubes like this)

DSC05841

Once dry, my felted sensor gave a reading of about 25 Ohms at rest and 15 Ohms when stretched.

I also added header wires to the ends of the textile work, as Lara Grant suggests. You can now find Radio Shack components in the UK through re-seller sites such as eBay, and these male and female D-sub connectors are very useful for finishing off textile components. The wire ends will fit into a breadboard so you can design your circuits and prototype with Arduino.

 

DSC05830 DSC05831 DSC05836

To finish the work with male header pins, untangle the wool from the elastic and conductive yarns. Trim the wool, leaving the other two loose ends. If the loose ends are coming out of the side rather than the tip of the work, simply draw them through to the end by threading them through a sharp, large eye needle. Tie a small knot close to the felted work and lay the two yarns into the open crimp of the male header pin. This is fiddly, but the knot will help the yarns from slipping back through.

DSC05832 DSC05837 DSC05838  DSC05840

Squeeze the legs of the crimp tight shut over the yarns with the flat-nosed pliers.

Laying the yarns back towards the work, slide a small piece of heat-shrink tubing over the header pin so it covers the yarns and the crimp. Hold the work in front of the nozzle of the heat gun for a few seconds – the tubing will shrink to a third its original diameter, protecting the connections you just made. WARNING! The heat gun nozzle and the air from it are very hot – do not touch!

Once the tubing is cool, you can snip away the loose threads.

 

STEP THREE: Prototype the circuit

You will need:

  • Laptop or PC running Arduino programming environment
  • Your multimeter
  • Low impedence resistors, eg 15 or 20 Ohms (not included in kit below)
  • The Arduino Starter Kit or similar, including:
    • Arduino board
    • Breadboard
    • USB cable
    • Selection of resistors
    • Jumper wires
    • LEDs
    • Plenty of crocodile clips

 

First, read the changing voltage from the stretch sensor

Force sensors, bend sensors and stretch sensors are all variable resistors. To connect a variable resistor with a microcontroller (eg, an Arduino), you need a voltage divider circuit. This is not complex and will be very useful for many projects.

First, measure the resistance of your crocheted sensor: this one is measuring between 21 and 21.5 Ohms at rest. Then find a resistor close to this value: you can learn to read the colour codes on resistors, or you can cheat and use a multimeter to test them. If the value is showing as 1, switch your dial to a higher band of values: this multimeter is banded in 100s, 1000s, khms and megaOhms. If, on the 20k band, your resistor reads as 9.93, you have a 10k Ohm resistor.

DSC05842  DSC05844  DSC05845

In fact, 20 Ohms or thereabouts is very low. If you have the Arduino kit as shown, it will not have a low enough resistor included in it. You can buy large bags of mixed resistors from the likes of Maplins (in the UK) – you  might want to measure these and mark the tapes as shown for later.

voltagedivider  voltageDividerCircuit_stretchSensor_bb

 

To create the voltage divider circuit, place your custom sensor in series with the similar (standard) resistor of roughly the same resistance in Ohms, as shown in the diagram. Flex and light sensor tutorials with Arduino show the same pin-out.Follow these steps:

  1. using a crocodile clip and jumper wire connect one end of your custom sensor to ground (GND) on the analog side of the Arduino board
  2. place the standard resistor on the board so it bridges the conductive strips inside the board (in this case, vertically, as shown); this means the current must flow through it
  3. connect a jumper wire from one end of the standard resistor to Analog pin A0 on the Arduino
  4. connect another jumper wire from the 5V pin to the other end of the standard resistor
  5. connect that same end of the standard resistor to your stretch resistor

 

DSC05847 DSC05846 DSC05848

Coding:

In Arduino, open file > examples > basics > ReadAnalogVoltage.

Connect your board and upload the file.

In the tools menu, click on Serial Monitor.

Stretch and scrunch your textile sensor and watch the values changing.

analog

 

This crocheted sensor gave me around 2.46 Volts when I held it as you would a bag handle, and changed to around 2.16 Volts when I pulled on the ends to simulate weight. Voltage will always be between 0 and 5V.

The next version of the program allows you to create some meaningful output.

It reads values coming straight into pin A0, and these will be between 0 and 1023. You may want to prototype the interaction more accurately by hanging weights on the ends of the sensor, but the values within the code can always be adjusted as you work.

NB. You might find that the ends of the crocheted sensor are a weak point. If the threads pull out of the D-sub crimp, or seem likely to break, try using bead caps, bought from a jewellery supply store. More details on finishing the ends can be seen in the next step.

DSC05849

 

DSC05850

 

Adjust the pin out of your board:

  • Make the 5V and GND (ground) jump wires common to the whole board by plugging them into the top of the vertical rails marked + and – respectively.
  • Add three LEDs as shown, with a 220 Ohm resistor connecting the short (negative) leg of each LED to the ground rail of the breadboard.
  • Each LED also needs a positive lead into a digital pin on the Arduino board – in this case, pins 7, 8 and 9.
  • Add an open-ended jump wire to the bottom of the common ground rail, to attach your stretch sensor to
  • Add a jump wire between the stretch sensor resistor and the common Voltage rail

 

Now copy and paste this code into your Arduino sketch. Compile and upload it to the board. You can adjust the values to suit the sensor you have made. You should now have three LEDs lighting up as the strain on the sensor increases.

 

/*

This code has been cobbled together from the basic example ReadAnalogVoltage and a stretch sensor query on the Arduino forum at http://forum.arduino.cc/index.php?topic=53847.0

ReadAnalogVoltage reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.

The forum code takes those readings and outputs a sequence of traffic light signals as a result.

*/

int ledPinA = 7;           // LED is connected to digital pin 7

int ledPinB = 8;           // LED is connected to digital pin 8

int ledPinC = 9;           // LED is connected to digital pin 9

int sensorValue;   // variable to store the value coming from the sensor

 

// the setup routine runs once when you press reset:

void setup() {

pinMode(ledPinA, OUTPUT);   // sets the ledPin to be an output

pinMode(ledPinB, OUTPUT);   // sets the ledPin to be an output

pinMode(ledPinC, OUTPUT);   // sets the ledPin to be an output

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

 

// the loop routine runs over and over again forever:

void loop() {

sensorValue = analogRead(A0);

if(sensorValue<330){ //You can change the value here to adjust the threshold.

digitalWrite(ledPinC, HIGH); //Turn LED 9 on

}

if(sensorValue<350){ //You can change the value here to adjust the threshold.

digitalWrite(ledPinB, HIGH); //Turn LED 8 on

}

if(sensorValue<380){ //You can change the value here to adjust the threshold.

digitalWrite(ledPinA, HIGH); //Turn LED 7 on

}

else{

digitalWrite(ledPinA, LOW); //Turn LED off

digitalWrite(ledPinB, LOW); //Turn LED off

digitalWrite(ledPinC, LOW); //Turn LED off

}

Serial.print(“Sensor Value: “);

Serial.println(sensorValue);

Serial.println(” “);

delay(100);   // delay for 1/10 of a second

}

 

STEP FOUR: design the physical circuit with the bag

You will need:

  • An existing bag
  • Lilypad Arduino and FTDI board if needed
  • USB cable
  • Lilypad components
    • LEDS
    • Battery holder
    • Slider switch if not using Lilypad battery holder
  • Battery
  • Small drill bits for metal (0.8 to 3.2mm are useful sizes)
  • Pendant or hobby drill
  • Hand held drill tools
  • Sewing needles
  • Conductive thread
  • Thimble
  • Extra flat-nosed pliers
  • Barrel-end clasp and extra trigger clasp, or alternative findings
  • Sandpaper, sandtaper stick or riffler files
  • Multimeter
  • Plenty of crocodile clips
  • Goggles

 

Find a suitable small bag for your handle – here, I have used a small hardcase clutch and removed the original strap. If you are going to use the existing strap hooks on the bag, check there is no electrical connection between them before you start – the bag may have a metal frame they are attached to, which means your circuit will not work. You can get around this problem by making your own hooks and loops using strong fabric.

DSC05852 DSC05851 DSC05853

 

Collect a few alternatives to create the join between the handle and the bag: pictured are a range of jewellery findings including pinch balls, bead caps, bar crimps, barrel cord ends and bag clasps. Check all your components for electrical continuity using the multimeter. If any are not, they may have a non-conductive finish – use sandpaper or a riffler file to expose the metal base.

 

 DSC05854 DSC05859 DSC05860

 

I used the barrel cord ends to finish off the crochet handle; you need to find a pair with holes in them to sew through, or drill your own with a high-speed hobby drill. Make sure the hole size is large enough for your sewing needle and thread to pass through a couple of times. You can open up the holes a little with a small hand drill or a round riffler file if you need to. Now you can use the holes to sew through with conductive yarn, making a mechanical and electrical connection with the textile sensor. There are two approaches to positioning the holes – either close to the edge of the metal, so you can sew over the edge, or opposite each other so you can pass the needle straight through the crocheted work and out the other side. You may need the thimble to push the needle through if the felted crochet is quite dense.

SAFETY!

When drilling, wear goggles to protect your eyes, place a wooden dowel inside the tube to support it, centre-punch where you want the holes to guide the drill bit and avoid skating, and lubricate the drill bit to minimise heat. Do not drill near your electronics or your laptop – you will be creating fine metal dust. Make sure you have a first aid kit to hand in case of injury.

 

DSC05855 DSC05862DSC05863

 

The barrel end clasp may come in a pack with one clasp because it is intended as a necklace clasp; fit a second one to the other end by opening up the jump ring. Holding a pair of flat-nosed pliers in each hand, twist the jump ring open. Attach the handle to the bag, and check for continuity between the two ends of the handle (the multimeter shown does not have a continuity setting so I am measuring the resistance in Ohms).

Now you need to transfer the circuit on the breadboard to sewable Lilypad (or other brand) hardware.

If your Lilypad needs an FTDI board, as shown, make sure you have the drivers installed for it: find them at http://www.ftdichip.com/Drivers/VCP.htm. Select the Lilypad from the Arduino Tools > Board menu, and the port from the Tools > Port menu (it should include ‘usbserial’ in the name). You should now be able to upload the sketch (code) that you used earlier.

 

DSC05865 DSC05866 DSC05868

 

The Lilypad power supply board will step-up the 1.5V of a AAA battery to the 5V needed by the circuit. Do not use a battery supplying more than 5.5V. You can also use a 3V coin cell battery here, which is less heavy and takes up less space. It will not step up to 5V however, and you will notice your LEDs are dimmer. You might also want to add a slider switch if you use a coin cell. The 220 Ohm resistors from your original circuit will be replaced by the on-board LED resistors. Make the resistor for your voltage divider sew-able by making neat loops from the legs with round nosed pliers, as shown.

HEAVY50_handDrawing HEAVY49_fritzing    HEAVY51_crocodileClips

HEAVY52_sewableResistor HEAVY53_patternCuttingLEDs

 

Sketch out the physical circuit according to the form you are working with. In this case I have made a removable insert for the bag rather than permanently attaching the electronics. The battery sits inside one end of the closed bag, with the Lilypad against one side wall. The LEDs are on a separate flap that hangs outside the bag, and snap onto the inner lining.

 

Stitch the circuit onto your chosen fabric, making sure to finish ends neatly and with the multimeter, check regularly that there is continuity where you need it and no connection where there shouldn’t be.

HEAVY54_snapOnLEDs_back HEAVY55_snapOnLEDs_front

HEAVY56_insulatingStitchedConnections HEAVY57_insulating

Use the interfacing to keep ends in place and minimise fraying, ironing it onto the reverse of the fabric where needed. Snap studs can be used to make connections between parts – I used a different fabric for the visible part of the circuit. You could also choose to make some parts interchangable in this way. Connect the handle loops to the inner lining circuit.

HEAVY58_checkFinalValues   DSC05917

Once you have a complete textile circuit, you should check the values in the program again, that is, you should calibrate it. This is because you have introduced new materials with resistance into the circuit, and you will be holding the handle – each person introduces a different capacitive drain to the circuit.

 

Further refinements you could make:

  • Do user testing to decide what ‘too heavy’ means in use for different people.
  • Re-design the connections between handle loops and inner circuit.
  • Protect the hardware inside the bag with wadding or spacer fabric.
  • Add automatic calibration to the Arduino program.
  • Explore the mechanical relationship between the bag handle and the bag.
  • Explore different bag forms and their uses.

 

 

«

  We are aiming to make a bag with a handle that senses when you have over-filled it.   The […]