We chose to attach the sensor parallel to the zipper on the front of the hoodie and use the drawstring to perform the sliding action. Yes, you can install the sensor along a zipper and use the zipper pull as the slider, which would couple the temperature control action of zipping and unzipping the hoodie with the LED color change effect. For simplicity of demonstration, we've kept them separate. 

We placed GEMMA just inside the front lapel of the hoodie. This hoodie has a front facing along the inside edge, and you could easily hide GEMMA completely inside. Again for simplicity of showing you, we've left it visible on the outside of the facing.

Cut the sensor's ribbon into two pieces. We'll use one as the pull tab and one to slide along.

Use a needle and thread (knotted at the end) to gather up the stitches at one end of the slide-along piece and thread it through the small end of the charm that comes with the soft potentiometer. It's a snug fit, so you may need to try a few times.

To attach the pull tab, stitch the other piece of ribbon to the large loop on the charm. You can use regular thread for this if you wish, but conductive thread won't hurt. Cinch the ribbon to the charm tightly for a stable electrical signal.

Stitch the other end of the pull tab ribbon to the outlet of the hoodie's drawstring, then back to the pad marked A1 (also D2) on GEMMA. Refer to the circuit diagram.

Next stitch down both ends of the slide-along ribbon using conductive thread and connect them to GEMMA 3V and GND according to the circuit diagram using a running stitch.

For the far-away end, you can stitch along the inside of the facing to insulate your stitches.

When you reach GEMMA, loop around the pad many times and then use the needle to knot the thread at the back or away from the GEMMA pad. Your stitches should be nice and tight to ensure a secure connection and prevent short circuits.

Seal knots by pulling tight and dabbing on a small amount of clear nail polish. A little goes a long way! Try not to get it on the garment itself. Periodically pull the thread tight while it dries, applying more nail polish if necessary to prevent the knots from springing open. 

Do not cut your thread tails until the nail polish is dry and you've tugged them to ensure the knots are secure.

Plug GEMMA into your compute with a USB cable and load up the following code:

//very slightly modified version of Arduino's "AnalogInput" example sketch for testing the textile potentiometer with GEMMA

int sensorPin = 1;    // select the input pin for the potentiometer, analog 1 on GEMMA is digital 2
int ledPin = 1;      // select the pin for the LED, GEMMA has one attached to D1
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  // turn the ledPin off:        
  digitalWrite(ledPin, LOW);   
  // stop the program for for <sensorValue> milliseconds:

This code uses the changing value of the slide sensor to adjust the blinking speed of GEMMA's onboard LED. Slide the sensor and watch the LED blink faster or slower.

LED not changing blink speed? Unplug and try checking your circuit for shorts, using a multimeter if possible.

Is the blinking speed changing? Great! Now let's add some color changing NeoPixels.

This guide was first published on Feb 11, 2015. It was last updated on Jul 17, 2024.

This page (Prepare and Sew Sensor) was last updated on Feb 10, 2015.

Text editor powered by tinymce.