Intro to Wearables Week 4/5

Task: Creating a garment to express a message/information/data to people around you.

I had a lot of trouble coming up with an idea of what type of message, information or data I wanted to express. I decided to go with the idea of using a ultrasonic sensor to measure how close things or people were to the wearer and then less would light up to indicate how close the things or people were. I started off by doing the sewing machine training and then thought about what to make. I thought long and hard about the piece of clothing I would make, and after seeing the steps that I would have to go through to make a human sized piece of clothing, I decided to make a mini piece of clothing. While I was making it, I wasn’t being very precise, thinking about size, or thinking about the model of the clothing; therefore, I ended up with a shirt for my hand (it is not a glove, because it lacks the finger compartments, so I am calling it a shirt for my hand). I had a lot of difficulty using the home sewing machine, which was another reason why I decided to scale down my clothing piece.

Due to the size of the garment, I decided to not use an ultrasonic range sensor. I had a fast vibration sensor switch, so I decided to use that and switch my idea a little bit. Instead of showing the proximity of people and things around the wearer, I decided to show people around the wearer whether or not the wearer should be interrupted based on the colors on the neopixels. I was able to get an analog value from the vibration switch and proceeded to use those values to indicate whether or not to interrupt the wearer. I arbitrarily chose values from the vibration switch to display green, yellow, or red. The colors were supposed to be like traffic light colors, green meaning go, yellow meaning a cautious go, red meaning don’t go.

Here are some problems or issues that I ran into during the process. First off, I don’t think that I am interpreting the readings from the vibration switch properly, because while I am moving the switch sometimes I get a reading of 0 and while I am staying still the switch reads a value of 1000. While sewing the stitch, I did not properly plan for the circuit so I arbitrarily placed objects that I had difficult with later, but nothing was short circuited so that was good. This lack of planning is a problem that I am running into quite frequently while sewing my circuits. Also after sewing on my neopixels, I had the issue where the neopixels would sometimes not work or not light but one or two would work, I think this is due to the connection. The main reason why my circuit did not work during class and on the Gemma was because I was mislabeling the input pin for the vibration switch, which I had not noticed until later. Once I switched the pin to the correct output pin in the code it worked, but I still had difficulty with the neopixels. I am also still having difficulty with the boot loader on the Gemma, Adafruit says to not push down the reset button for too long, but sometimes that enacts the boot loader but other times it does not work. I am also still bad at hand sewing but I think that will improve as time goes on.

Below are my documentation photos, final photos, a video of the circuit in action and the code for the circuit.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN 1 //if gemma
//#define PIN 6

//const int vibPin = A11;
const int vibPin = A1; //if gemma

int vibVal = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(3, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:
//  Serial.begin(9600);
  strip.begin();
  strip.setBrightness(50);
  strip.show();
  pinMode(vibPin, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  vibVal = analogRead(vibPin);
//  vibVal = map(vibVal,0,1023,1,3);
  if (vibVal < 100) {
    colorWipe(strip.Color(0, 255, 0), 50);
//  } else {
  } else if (vibVal <500 && vibVal > 100) {
    colorWipe(strip.Color(255, 255, 0), 50);
  } else if (vibVal > 500) {
    colorWipe(strip.Color(255, 0, 0), 50);
  }

//Serial.println(vibVal);
delay(100);
}

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);
  }