Jannaveve

Color Change p@tch

The color change patch, the first iteration of this project, utilizes an RGB color mixing LED light, a small sewable microcontroller, and a button switch. This wearable uses soft electronics for sewing the circuits directly into the fabric of the patch. When worn, it can be used as a behavior monitoring tool to grade ethical performance in the moment.

Supply List:

1k Ohm resistor

Tactile Button Switch

Adafruit NeoPixel

Adafruit Gemma

Canvass fabric

Embroidery thread

Needles

Soldering iron

Wire or conductive thread

 

Patch Instructions:

 

Download and install the open source Arduino software

Next, we need to make the Gemma compatible with Arduino.

To do this Go to the Preferences menu. You can access it from the File menu in Windows or Linux, or the Arduino menu on OS X.

In the Additional Boards URL dialog box type in:

https://adafruit.github.io/arduino-board- index/package_adafruit_index.json

 

Next, go to the Tools menu > Board > Boards Manager on the left hand side of the window and select Contributed

 

Look for Adafruit AVR Boards,

 

Close the Arduino software and start it again. Now in the Tool menu > Board > Adafruit Gemma 8MHZ

 

Connect your Gemma to your computer using the USB cable

There should be a green light to indicate the power is on.

To upload to your board you will first have to get the Gemma to bootloader mode by clicking the button twice quickly but not too quickly… it is a finicky beast.

You’ll know it worked when the red light blinks quickly.

 

/*

Blink

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.

To upload to your or Trinket:

1) Select the proper board from the Tools->Board Menu (Arduino Gemma if

     teal, Adafruit Gemma if black)

2) Select the uploader from the Tools->Programmer (“Arduino Gemma” if teal,

                  “USBtinyISP” if black Gemma)

3) Plug in the Gemma into USB, make sure you see the green LED lit

4) For windows, make sure you install the right Gemma drivers

5) Press the button on the Gemma/Trinket – verify you see

     the red LED pulse. This means it is ready to receive data

6) Click the upload button above within 10 seconds

*/

int led = 1; // blink ‘digital’ pin 1 – AKA the built-in red LED

 

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

void setup() {

// initialize the digital pin as an output.

pinMode(led, OUTPUT);

}

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

void loop() {

   digitalWrite(led, HIGH);

   delay(1000);

   digitalWrite(led, LOW);

   delay(1000);

}

Select upload while the red light is still flashing.

You only have about ten seconds to be quick.

This makes sure your board is working before we continue.

Next, hook up the LED Neopixel and button switch using a breadboard and alligator clips.

 

Make sure you pay attention to connect the pins just as they are connected in the circuit diagram or the code won’t work!

InstructionCircuitdiagram-02

Circuit Diagram

 

LED Color Change Patch

Use the code provided below and upload it to your board just like you did the blink example.

Code Example

 

#include <Adafruit_NeoPixel.h>

#define BUTTON_PIN 2 // Digital IO pin connected to the button. This will be
// driven with a pull-up resistor so the switch should
// pull the pin to ground momentarily. On a high -> low
// transition the button press logic will execute.

#define PIXEL_PIN 1 // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 1

// Parameter 1 = number of pixels in strip, neopixel stick has 8
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct for neopixel stick
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
// Get current button state.
bool newState = digitalRead(BUTTON_PIN);

// Check if state changed from high to low (button press).
if (newState == LOW && oldState == HIGH) {
// Short delay to debounce button.
delay(20);
// Check if button is still low after debounce.
newState = digitalRead(BUTTON_PIN);
if (newState == LOW) {
showType++;
if (showType > 2)
showType=0;
startShow(showType);
}
}

// Set the last button state to the old state.
oldState = newState;
}

void startShow(int i) {
switch(i){
case 0: colorWipe(strip.Color(0, 0, 0), 50); // Black/off
break;
case 1: colorWipe(strip.Color(255, 0, 0), 50); // Red
break;
case 2: colorWipe(strip.Color(0, 255, 0), 50); // Green
break;
}
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

Push the button you just wired once to start the code.

Now you should be able to toggle through Red, Green and off.

If you have trouble Adafruit has a whole, you can learn more here!

 

 

 

Sewing & Soldering

Now on to the sewing portion.

Chose a topic for your patch. What cause are you trying to get better at helping with?

It can be anything that weighs on your conscience. I chose to draw more attention to not using or buying plastic since I have become more lax about it recently.
Design yourself a patch!

If you are new to embroidery simple is better.

 

Cut your canvass or fabric to the size you want for your design.

Make sure to integrate your board into your patch whether hidden or out in the open.

 

Trace your design onto your fabric and begin embroidering.

 

Once you finish your design it is time to attach the electronics

You can use wires to solder your pieces together, or you can sew them together using conductive thread.

 

I’m going to use wire for this project to make it more durable.

If you want to hide some wires on the back of your patch you can punch holes into the cloth to feed them through. Before you solder your pieces together.

 

Solder.

 

Test out your code again.

41691716_580133485739296_7942801595949907968_n

You’re done!

 

This worked great for engagement with people in my general vicinity.

%d bloggers like this: