10. E-TEXTILES AND WEARABLES II

Wearable Gabriela Lotaif

Wearable necklace Gabriela Lotaif

Inspiration


I was inspired by the connection of the body and it's environment through the use of wearables for this assignment and the infinite possibilities this gives humankind. For people to be able to in fact feel their surroundings, the people and the nature around them and in fact understand emotionally what this means seems to have such a huge potential of change and empathy in my mind!

Rachel Freire's Embodisuit

Embodisuit: A Wearable Platform for Embodied Knowledge from sab on Vimeo.

CyborgArt by Moon Ribas and Neil Harbisson

"The Culture" series by Afroditi Psarra and Dafni Papadopoulou

The Climate Dress, by Diffus Design

The Climate Dress by Diffus Design from Diffus Design on Vimeo.

100 Dancers in 2011, by Diffus Design

Costume Choreography II, by Diffus Design

Class


In class with Victor (#weloveVictor) at Fab Lab Barcelona we learned how to download a Library, tried out a Neopixel Strip and a Speaker using Arduino Uno.

DOWNLOADING A LIBRARY

In order to download a library in arduino you have to go to the top menu, click "sketch", click "include library", click "manage libraries". A new window will open with a search bar on the top right corner. You then type the name of the library that you want, which you discovered doing your research online of what library could help you code what input or output and click "install".

You then wait till the library is insatlled and close that window. You go back to the top menu, click "file", click "examples" and look for your library on that list. If it isn't try to close arduino and reopen it and it should be there.

via GIPHY

TRYING OUT NEOPIXEL STRIP

This is the Neopixel Überguide, it is the guide to working with Neopixel. We downloaded the "Adafruit Neopixel" library and opened the simple example available there.

We plugged in our neopixel straps onto our arduino in the manner you will see in the video bellow (V5 - red, gnd - blue, and any analogue data output - green)

Once we had uploaded the code into our arduino, indicating there in which pin the green of the strap was connected, the number of pins we wanted lit and what delay we wanted it to have between changes we had the result bellow:

Neopixel Strap Test with Arduino Uno from Gabriela Lotaif on Vimeo.

TRYING OUT SPEAKER

This is the Arduino Language Reference to using sound related objects: Tone Arduino

After understanding a bit about how a speaker works we opened the audio example from arduino and uploaded it to our Arduino Uno, having connected the speaker to it as seen in the video bellow, in which we obtained a constant beep:

You can also find many simpler versions of musics online to upload to your arduino and try them out.

Testing of Composing Elements of my Circuit


Before actually having my actuators the way I wanted them to be I tested each of the elements in my circuit: the touch sensor as an input and the two actuators I chose, the vibration motor and the RGB Single Neopixel as the two inputs I would have.

TESTING TOUCH SENSOR

The two links I used as references to using the touch sensor are:

Touch Sensor Theory Circuit

Touch Sensor Arduino Project Hub

Based on them I connected my touch sensor to my arduino and from them I copied the following code, which I used for testing it:

//Digital Capacitive Touch Sensor Arduino Interfacing

#define sensorPin 1 // capactitive touch sensor - Arduino Digital pin D1

int ledPin = 13; // Output display LED (on board LED) - Arduino Digital pin D13

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);  
  pinMode(sensorPin, INPUT);
}

void loop() {
  int senseValue = digitalRead(sensorPin);
  if (senseValue == HIGH){
    digitalWrite(ledPin, HIGH);
    Serial.println("TOUCHED");
  }
  else{
    digitalWrite(ledPin,LOW);
    Serial.println("not touched");
  } 
  delay(10);

}

TESTING VIBRATION MOTOR

I could either plug the vibration motor into my arduino using my bread board following this reference

But I decided to connect it using the Haptic Controller

Haptic Controller

I used this link for reference when plugging my vibration motor reader on the Arduino UNO.

I followed to upload the library indicated at the reference link above called "Adafruit DRV2605 Library", opened it and used its basic example code for testing:

#include <Wire.h>
#include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

void setup() {
  Serial.begin(9600);
  Serial.println("DRV test");
  drv.begin();

  drv.selectLibrary(1);

  // I2C trigger by sending 'go' command 
  // default, internal trigger when sending GO command
  drv.setMode(DRV2605_MODE_INTTRIG); 
}

uint8_t effect = 1;

void loop() {
//  Serial.print("Effect #"); Serial.println(effect);

   if (effect == 1) {
    Serial.println("11.2 Waveform Library Effects List");
  }

  if (effect == 1) {
    Serial.println(F("1 − Strong Click - 100%"));
  }
  if (effect == 2) {
    Serial.println(F("2 − Strong Click - 60%"));
  }
  if (effect == 3) {
    Serial.println(F("3 − Strong Click - 30%"));
  }
  if (effect == 4) {
    Serial.println(F("4 − Sharp Click - 100%"));
  }
  if (effect == 5) {
    Serial.println(F("5 − Sharp Click - 60%"));
  }
  if (effect == 6) {
    Serial.println(F("6 − Sharp Click - 30%"));
  }
  if (effect == 7) {
    Serial.println(F("7 − Soft Bump - 100%"));
  }
  if (effect == 8) {
    Serial.println(F("8 − Soft Bump - 60%"));
  }
  if (effect == 9) {
    Serial.println(F("9 − Soft Bump - 30%"));
  }
  if (effect == 10) {
    Serial.println(F("10 − Double Click - 100%"));
  }
  if (effect == 11) {
    Serial.println(F("11 − Double Click - 60%"));
  }
  if (effect == 12) {
    Serial.println(F("12 − Triple Click - 100%"));
  }
  if (effect == 13) {
    Serial.println(F("13 − Soft Fuzz - 60%"));
  }
  if (effect == 14) {
    Serial.println(F("14 − Strong Buzz - 100%"));
  }
  if (effect == 15) {
    Serial.println(F("15 − 750 ms Alert 100%"));
  }
  if (effect == 16) {
    Serial.println(F("16 − 1000 ms Alert 100%"));
  }
  if (effect == 17) {
    Serial.println(F("17 − Strong Click 1 - 100%"));
  }
  if (effect == 18) {
    Serial.println(F("18 − Strong Click 2 - 80%"));
  }
  if (effect == 19) {
    Serial.println(F("19 − Strong Click 3 - 60%"));
  }
  if (effect == 20) {
    Serial.println(F("20 − Strong Click 4 - 30%"));
  }
  if (effect == 21) {
    Serial.println(F("21 − Medium Click 1 - 100%"));
  }
  if (effect == 22) {
    Serial.println(F("22 − Medium Click 2 - 80%"));
  }
  if (effect == 23) {
    Serial.println(F("23 − Medium Click 3 - 60%"));
  }
  if (effect == 24) {
    Serial.println(F("24 − Sharp Tick 1 - 100%"));
  }
  if (effect == 25) {
    Serial.println(F("25 − Sharp Tick 2 - 80%"));
  }
  if (effect == 26) {
    Serial.println(F("26 − Sharp Tick 3 – 60%"));
  }
  if (effect == 27) {
    Serial.println(F("27 − Short Double Click Strong 1 – 100%"));
  }
  if (effect == 28) {
    Serial.println(F("28 − Short Double Click Strong 2 – 80%"));
  }
  if (effect == 29) {
    Serial.println(F("29 − Short Double Click Strong 3 – 60%"));
  }
  if (effect == 30) {
    Serial.println(F("30 − Short Double Click Strong 4 – 30%"));
  }
  if (effect == 31) {
    Serial.println(F("31 − Short Double Click Medium 1 – 100%"));
  }
  if (effect == 32) {
    Serial.println(F("32 − Short Double Click Medium 2 – 80%"));
  }
  if (effect == 33) {
    Serial.println(F("33 − Short Double Click Medium 3 – 60%"));
  }
  if (effect == 34) {
    Serial.println(F("34 − Short Double Sharp Tick 1 – 100%"));
  }
  if (effect == 35) {
    Serial.println(F("35 − Short Double Sharp Tick 2 – 80%"));
  }
  if (effect == 36) {
    Serial.println(F("36 − Short Double Sharp Tick 3 – 60%"));
  }
  if (effect == 37) {
    Serial.println(F("37 − Long Double Sharp Click Strong 1 – 100%"));
  }
  if (effect == 38) {
    Serial.println(F("38 − Long Double Sharp Click Strong 2 – 80%"));
  }
  if (effect == 39) {
    Serial.println(F("39 − Long Double Sharp Click Strong 3 – 60%"));
  }
  if (effect == 40) {
    Serial.println(F("40 − Long Double Sharp Click Strong 4 – 30%"));
  }
  if (effect == 41) {
    Serial.println(F("41 − Long Double Sharp Click Medium 1 – 100%"));
  }
  if (effect == 42) {
    Serial.println(F("42 − Long Double Sharp Click Medium 2 – 80%"));
  }
  if (effect == 43) {
    Serial.println(F("43 − Long Double Sharp Click Medium 3 – 60%"));
  }
  if (effect == 44) {
    Serial.println(F("44 − Long Double Sharp Tick 1 – 100%"));
  }
  if (effect == 45) {
    Serial.println(F("45 − Long Double Sharp Tick 2 – 80%"));
  }
  if (effect == 46) {
    Serial.println(F("46 − Long Double Sharp Tick 3 – 60%"));
  }
  if (effect == 47) {
    Serial.println(F("47 − Buzz 1 – 100%"));
  }
  if (effect == 48) {
    Serial.println(F("48 − Buzz 2 – 80%"));
  }
  if (effect == 49) {
    Serial.println(F("49 − Buzz 3 – 60%"));
  }
  if (effect == 50) {
    Serial.println(F("50 − Buzz 4 – 40%"));
  }
  if (effect == 51) {
    Serial.println(F("51 − Buzz 5 – 20%"));
  }
  if (effect == 52) {
    Serial.println(F("52 − Pulsing Strong 1 – 100%"));
  }
  if (effect == 53) {
    Serial.println(F("53 − Pulsing Strong 2 – 60%"));
  }
  if (effect == 54) {
    Serial.println(F("54 − Pulsing Medium 1 – 100%"));
  }
  if (effect == 55) {
    Serial.println(F("55 − Pulsing Medium 2 – 60%"));
  }
  if (effect == 56) {
    Serial.println(F("56 − Pulsing Sharp 1 – 100%"));
  }
  if (effect == 57) {
    Serial.println(F("57 − Pulsing Sharp 2 – 60%"));
  }
  if (effect == 58) {
    Serial.println(F("58 − Transition Click 1 – 100%"));
  }
  if (effect == 59) {
    Serial.println(F("59 − Transition Click 2 – 80%"));
  }
  if (effect == 60) {
    Serial.println(F("60 − Transition Click 3 – 60%"));
  }
  if (effect == 61) {
    Serial.println(F("61 − Transition Click 4 – 40%"));
  }
  if (effect == 62) {
    Serial.println(F("62 − Transition Click 5 – 20%"));
  }
  if (effect == 63) {
    Serial.println(F("63 − Transition Click 6 – 10%"));
  }
  if (effect == 64) {
    Serial.println(F("64 − Transition Hum 1 – 100%"));
  }
  if (effect == 65) {
    Serial.println(F("65 − Transition Hum 2 – 80%"));
  }
  if (effect == 66) {
    Serial.println(F("66 − Transition Hum 3 – 60%"));
  }
  if (effect == 67) {
    Serial.println(F("67 − Transition Hum 4 – 40%"));
  }
  if (effect == 68) {
    Serial.println(F("68 − Transition Hum 5 – 20%"));
  }
  if (effect == 69) {
    Serial.println(F("69 − Transition Hum 6 – 10%"));
  }
  if (effect == 70) {
    Serial.println(F("70 − Transition Ramp Down Long Smooth 1 – 100 to 0%"));
  }
  if (effect == 71) {
    Serial.println(F("71 − Transition Ramp Down Long Smooth 2 – 100 to 0%"));
  }
  if (effect == 72) {
    Serial.println(F("72 − Transition Ramp Down Medium Smooth 1 – 100 to 0%"));
  }
  if (effect == 73) {
    Serial.println(F("73 − Transition Ramp Down Medium Smooth 2 – 100 to 0%"));
  }
  if (effect == 74) {
    Serial.println(F("74 − Transition Ramp Down Short Smooth 1 – 100 to 0%"));
  }
  if (effect == 75) {
    Serial.println(F("75 − Transition Ramp Down Short Smooth 2 – 100 to 0%"));
  }
  if (effect == 76) {
    Serial.println(F("76 − Transition Ramp Down Long Sharp 1 – 100 to 0%"));
  }
  if (effect == 77) {
    Serial.println(F("77 − Transition Ramp Down Long Sharp 2 – 100 to 0%"));
  }
  if (effect == 78) {
    Serial.println(F("78 − Transition Ramp Down Medium Sharp 1 – 100 to 0%"));
  }
  if (effect == 79) {
    Serial.println(F("79 − Transition Ramp Down Medium Sharp 2 – 100 to 0%"));
  }
  if (effect == 80) {
    Serial.println(F("80 − Transition Ramp Down Short Sharp 1 – 100 to 0%"));
  }
  if (effect == 81) {
    Serial.println(F("81 − Transition Ramp Down Short Sharp 2 – 100 to 0%"));
  }
  if (effect == 82) {
    Serial.println(F("82 − Transition Ramp Up Long Smooth 1 – 0 to 100%"));
  }
  if (effect == 83) {
    Serial.println(F("83 − Transition Ramp Up Long Smooth 2 – 0 to 100%"));
  }
  if (effect == 84) {
    Serial.println(F("84 − Transition Ramp Up Medium Smooth 1 – 0 to 100%"));
  }
  if (effect == 85) {
    Serial.println(F("85 − Transition Ramp Up Medium Smooth 2 – 0 to 100%"));
  }
  if (effect == 86) {
    Serial.println(F("86 − Transition Ramp Up Short Smooth 1 – 0 to 100%"));
  }
  if (effect == 87) {
    Serial.println(F("87 − Transition Ramp Up Short Smooth 2 – 0 to 100%"));
  }
  if (effect == 88) {
    Serial.println(F("88 − Transition Ramp Up Long Sharp 1 – 0 to 100%"));
  }
  if (effect == 89) {
    Serial.println(F("89 − Transition Ramp Up Long Sharp 2 – 0 to 100%"));
  }
  if (effect == 90) {
    Serial.println(F("90 − Transition Ramp Up Medium Sharp 1 – 0 to 100%"));
  }
  if (effect == 91) {
    Serial.println(F("91 − Transition Ramp Up Medium Sharp 2 – 0 to 100%"));
  }
  if (effect == 92) {
    Serial.println(F("92 − Transition Ramp Up Short Sharp 1 – 0 to 100%"));
  }
  if (effect == 93) {
    Serial.println(F("93 − Transition Ramp Up Short Sharp 2 – 0 to 100%"));
  }
  if (effect == 94) {
    Serial.println(F("94 − Transition Ramp Down Long Smooth 1 – 50 to 0%"));
  }
  if (effect == 95) {
    Serial.println(F("95 − Transition Ramp Down Long Smooth 2 – 50 to 0%"));
  }
  if (effect == 96) {
    Serial.println(F("96 − Transition Ramp Down Medium Smooth 1 – 50 to 0%"));
  }
  if (effect == 97) {
    Serial.println(F("97 − Transition Ramp Down Medium Smooth 2 – 50 to 0%"));
  }
  if (effect == 98) {
    Serial.println(F("98 − Transition Ramp Down Short Smooth 1 – 50 to 0%"));
  }
  if (effect == 99) {
    Serial.println(F("99 − Transition Ramp Down Short Smooth 2 – 50 to 0%"));
  }
  if (effect == 100) {
    Serial.println(F("100 − Transition Ramp Down Long Sharp 1 – 50 to 0%"));
  }
  if (effect == 101) {
    Serial.println(F("101 − Transition Ramp Down Long Sharp 2 – 50 to 0%"));
  }
  if (effect == 102) {
    Serial.println(F("102 − Transition Ramp Down Medium Sharp 1 – 50 to 0%"));
  }
  if (effect == 103) {
    Serial.println(F("103 − Transition Ramp Down Medium Sharp 2 – 50 to 0%"));
  }
  if (effect == 104) {
    Serial.println(F("104 − Transition Ramp Down Short Sharp 1 – 50 to 0%"));
  }
  if (effect == 105) {
    Serial.println(F("105 − Transition Ramp Down Short Sharp 2 – 50 to 0%"));
  }
  if (effect == 106) {
    Serial.println(F("106 − Transition Ramp Up Long Smooth 1 – 0 to 50%"));
  }
  if (effect == 107) {
    Serial.println(F("107 − Transition Ramp Up Long Smooth 2 – 0 to 50%"));
  }
  if (effect == 108) {
    Serial.println(F("108 − Transition Ramp Up Medium Smooth 1 – 0 to 50%"));
  }
  if (effect == 109) {
    Serial.println(F("109 − Transition Ramp Up Medium Smooth 2 – 0 to 50%"));
  }
  if (effect == 110) {
    Serial.println(F("110 − Transition Ramp Up Short Smooth 1 – 0 to 50%"));
  }
  if (effect == 111) {
    Serial.println(F("111 − Transition Ramp Up Short Smooth 2 – 0 to 50%"));
  }
  if (effect == 112) {
    Serial.println(F("112 − Transition Ramp Up Long Sharp 1 – 0 to 50%"));
  }
  if (effect == 113) {
    Serial.println(F("113 − Transition Ramp Up Long Sharp 2 – 0 to 50%"));
  }
  if (effect == 114) {
    Serial.println(F("114 − Transition Ramp Up Medium Sharp 1 – 0 to 50%"));
  }
  if (effect == 115) {
    Serial.println(F("115 − Transition Ramp Up Medium Sharp 2 – 0 to 50%"));
  }
  if (effect == 116) {
    Serial.println(F("116 − Transition Ramp Up Short Sharp 1 – 0 to 50%"));
  }
  if (effect == 117) {
    Serial.println(F("117 − Transition Ramp Up Short Sharp 2 – 0 to 50%"));
  }
  if (effect == 118) {
    Serial.println(F("118 − Long buzz for programmatic stopping – 100%"));
  }
  if (effect == 119) {
    Serial.println(F("119 − Smooth Hum 1 (No kick or brake pulse) – 50%"));
  }
  if (effect == 120) {
    Serial.println(F("120 − Smooth Hum 2 (No kick or brake pulse) – 40%"));
  }
  if (effect == 121) {
    Serial.println(F("121 − Smooth Hum 3 (No kick or brake pulse) – 30%"));
  }
  if (effect == 122) {
    Serial.println(F("122 − Smooth Hum 4 (No kick or brake pulse) – 20%"));
  }
  if (effect == 123) {
    Serial.println(F("123 − Smooth Hum 5 (No kick or brake pulse) – 10%"));
  }

  // set the effect to play
  drv.setWaveform(0, effect);  // play effect 
  drv.setWaveform(1, 0);       // end waveform

  // play the effect!
  drv.go();

  // wait a bit
  delay(500);

  effect++;
  if (effect > 117) effect = 1;
}

Vibration Motor Test with Arduino Uno from Gabriela Lotaif on Vimeo.

TESTING THE SINGLE RGB LED NEOPIXEL

Having checked the Datasheet of my neopixel I used the following references to wire my single rgb neopixel and understand its possibilities:

Getting Started

Neopixel Uberguide

Coding with Arduino

Getting Started with Arduino and Neopixels

Single Neopixel RGB

I then wired my single RBG Neopixel as indicated in these examples and tested it out.

The code I used for testing came from the "Adafruit Neopixel Library" that I had already uploaded to my arduino during the classes Victor had given us. In this case I used the strandtest example in the library.

// A basic everyday NeoPixel strip test program.

// NEOPIXEL BEST PRACTICES for most reliable operation:
// - Add 1000 uF CAPACITOR between NeoPixel strip's + and - connections.
// - MINIMIZE WIRING LENGTH between microcontroller board and first pixel.
// - NeoPixel strip's DATA-IN should pass through a 300-500 OHM RESISTOR.
// - AVOID connecting NeoPixels on a LIVE CIRCUIT. If you must, ALWAYS
//   connect GROUND (-) first, then +, then data.
// - When using a 3.3V microcontroller with a 5V-powered NeoPixel strip,
//   a LOGIC-LEVEL CONVERTER on the data line is STRONGLY RECOMMENDED.
// (Skipping these may work OK on your workbench but can fail in the field)

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN    9

// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 1

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)


void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAPs
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}


// loop() function -- runs repeatedly as long as board is on ---------------

void loop() {
  // Fill along the length of the strip in various colors...
  colorWipe(strip.Color(255,   0,   0), 50); // Red
  colorWipe(strip.Color(  0, 255,   0), 50); // Green
  colorWipe(strip.Color(  0,   0, 255), 50); // Blue

  // Do a theater marquee effect in various colors...
  theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
  theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
  theaterChase(strip.Color(  0,   0, 127), 50); // Blue, half brightness

  rainbow(10);             // Flowing rainbow cycle along the whole strip
  theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
}


// Some functions of our own for creating animated effects -----------------

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait);                           //  Pause for a moment
  }
}

// Theater-marquee-style chasing lights. Pass in a color (32-bit value,
// a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
// between frames.
void theaterChase(uint32_t color, int wait) {
  for(int a=0; a<10; a++) {  // Repeat 10 times...
    for(int b=0; b<3; b++) { //  'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in steps of 3...
      for(int c=b; c<strip.numPixels(); c += 3) {
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show(); // Update strip with new contents
      delay(wait);  // Pause for a moment
    }
  }
}

// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
  // Hue of first pixel runs 5 complete loops through the color wheel.
  // Color wheel has a range of 65536 but it's OK if we roll over, so
  // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  // means we'll make 5*65536/256 = 1280 passes through this outer loop:
  for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
    for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(wait);  // Pause for a moment
  }
}

// Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
void theaterChaseRainbow(int wait) {
  int firstPixelHue = 0;     // First pixel starts at red (hue 0)
  for(int a=0; a<30; a++) {  // Repeat 30 times...
    for(int b=0; b<3; b++) { //  'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in increments of 3...
      for(int c=b; c<strip.numPixels(); c += 3) {
        // hue of pixel 'c' is offset by an amount to make one full
        // revolution of the color wheel (range 65536) along the length
        // of the strip (strip.numPixels() steps):
        int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
        uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show();                // Update strip with new contents
      delay(wait);                 // Pause for a moment
      firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
    }
  }
}

RGB Single Neopixel Test with Arduino Uno from Gabriela Lotaif on Vimeo.

Testing to Connect Actuators to Input Individually

I followed my testing with individually programming each of the outputs to work based on the input how I wanted them to:

VIBRATION MOTOR WITH INPUT

This is the sketch of the circuit wiring through arduino Uno:

vib motor wiring

I then manipulated the codes I had on my tests to tell the vibration motor to vibrate continuosly with a 0,5 second break in between vibrations if my touch sensor was pressed, also keeping the reading of the sensor values programmed there in order to be able to check if the circuit was working in real time.

#define sensorPin  2 

int vibPin = 11; 

int val2 = 153;

int val3 = 0;

  #include <Wire.h>
  #include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

void setup() {

  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
  pinMode(vibPin, OUTPUT);  

    Serial.println("DRV test");
    drv.begin();

    drv.selectLibrary(1);


    drv.setMode(DRV2605_MODE_INTTRIG); 
}

uint8_t effect = 1;

void loop() {

  int senseValue = digitalRead(sensorPin);
  delay (10);

  if (senseValue == LOW){
   analogWrite(vibPin, val3);
   delay (500);
   Serial.println("not touched");
}
else{
   analogWrite(vibPin , val2);
   delay (500); 
   Serial.println("TOUCHED");

  drv.go();
  delay(500);
}
}

Vibration Motor Test with Arduino Uno Based on Input from Gabriela Lotaif on Vimeo.

SINGLE RGB NEOPIXEL WITH INPUT

This is the sketch of the circuit wiring through arduino Uno:

rgb wiring

Once wired I used this reference for colour combination in values for Ccding and manipulated the code I had tested with to make my Single RGB Led turn itself on in a shade of purple when I touched the sensor:

int sensorPin = 2; 

int LED_PIN = 9; 

void colorWipe();

int prp = (255,0,255);

  #define LED_COUNT 1

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

  Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {

  pinMode(sensorPin, INPUT);
  pinMode(LED_PIN, OUTPUT); 
  Serial.begin(9600);

    strip.begin();           
    strip.show();            
    strip.setBrightness(50); 
}

void loop() {

  int senseValue = digitalRead(sensorPin);
  delay (10);

  if (senseValue == HIGH){

     strip.setPixelColor(0, strip.Color(150, 0, 255));
     Serial.println("TOUCHED");
     strip.show();
  }
  else{
     strip.setPixelColor(0, strip.Color(0, 0, 0));
     Serial.println("not touched");
     strip.show();
  }
  } 

Single RGB Neopixel Test with Arduino Uno Based on Input from Gabriela Lotaif on Vimeo.

Connecting both Outputs to the same Input in the same Circuit

The next step was to make the same input be understood and read by the two outputs I had programmed individually.

In order to do this I used this code:

int sensorPin = 2; 

int LED_PIN = 9; 

void colorWipe();

int prp = (255,0,255);

  #define LED_COUNT 1

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

  Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

#define sensorPin  2 

int vibPin = 11; 

int val2 = 153;

int val3 = 0;

  #include <Wire.h>
  #include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

void setup() {

  pinMode(sensorPin, INPUT);
  pinMode(LED_PIN, OUTPUT); 
  Serial.begin(9600);

    strip.begin();           
    strip.show();            
    strip.setBrightness(50); 

  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
  pinMode(vibPin, OUTPUT);  

    Serial.println("DRV test");
    drv.begin();

    drv.selectLibrary(1);


    drv.setMode(DRV2605_MODE_INTTRIG); 
}

uint8_t effect = 1;

void loop() {

  int senseValue = digitalRead(sensorPin);
  delay (10);

  if (senseValue == HIGH){

     strip.setPixelColor(0, strip.Color(150, 0, 255));
     Serial.println("TOUCHED");
     strip.show();
     delay (500); 
  }
  else{
     strip.setPixelColor(0, strip.Color(0, 0, 0));
     Serial.println("not touched");
     strip.show();
     delay (500);
  }
  if (senseValue == LOW){
   analogWrite(vibPin, val3);
   delay (500);
   }
  else{
   analogWrite(vibPin , val2);
   delay (500); 

   drv.go();
   delay(500);
   }

}

This made the LED light up purple when I touched my sensor at the same time as my vibration motor vibrated intermitently with a delay of 0,5 seconds.

In order to make the connections I had clearer I build my circuit using paper and copper tape:

Copper Tape Circuit

The next step was to transform all this hard circuit into a soft one:

From the Hard Circuit to the Soft Circuit


CAPACITIVE SENSOR

I switched from a touch sensor to a capacitor, building mine based on the instructables example built by Rachel Freire:

Capacitive Wheel Fabric Safety Pin - Crocodile Clips Capacitive Sensor Visualisation with Processing

At a class taight by Victor (#weloveVictor) we in fact tested out a capacitive sensor as well as downloaded its library to our arduinos following these steps:

1.

This is the Sensor in function, connected to the LED in my Arduino:

CAPACITIVE TOUCH SENSOR from Gabriela Lotaif on Vimeo.

Once I have tested the sensor on its own all I had to dow was adapt it to my circuit in terms of programming, which led me to the following code:

#include <CapacitiveSensor.h>

/*
 * CapitiveSense Library Demo Sketch
 * Paul Badger 2008
 * Uses a high value resistor e.g. 10M between send pin and receive pin
 * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
 * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
 */


CapacitiveSensor   boton = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired

int sensorPin = 2; 

int LED_PIN = 9; 

void colorWipe();

int prp = (255,0,255);

  #define LED_COUNT 1

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

  Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

#define sensorPin  2 

int vibPin = 11; 

int val2 = 153;

int val3 = 0;

  #include <Wire.h>
  #include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

void setup() {

  pinMode(sensorPin, INPUT);
  pinMode(LED_PIN, OUTPUT); 
  Serial.begin(9600);

    strip.begin();           
    strip.show();            
    strip.setBrightness(50); 

  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
  pinMode(vibPin, OUTPUT);  

    Serial.println("DRV test");
    drv.begin();

    drv.selectLibrary(1);


    drv.setMode(DRV2605_MODE_INTTRIG); 
}

uint8_t effect = 1;

void loop() {

  long valor =  boton.capacitiveSensor(30);

  Serial.println(valor);                  // print sensor output 1

  if(valor>500) {
      strip.setPixelColor(0, strip.Color(150, 0, 255));
     Serial.println("TOUCHED");
     strip.show();
     delay (500); 
  } else {
     strip.setPixelColor(0, strip.Color(0, 0, 0));
     Serial.println("not touched");
     strip.show();
     delay (500);
  }

  delay(10);

  if (valor<500){
   analogWrite(vibPin, val3);
   delay (500);
   }
  else{
   analogWrite(vibPin , val2);
   delay (500); 

   drv.go();
   delay(500);
   }

}

This is the Sensor Connected to my still hard circuit:

Capacitive Touch Sensor With Hard Circuit from Gabriela Lotaif on Vimeo.

Design of Necklace

I designed my necklace making the cables that connected the capacitive touch sensor on the back and the two outputs (NEopixel LED and vibration motor) on the fron visible and part of the whole design.

sketches wearable necklace

I, then, organised how to actually position all cables thinking to connect them to a flora processor and then this processos to a battery switch.

Construction of Necklace

For making the neklace I used black fabric, white coated metal cables, a small bit of conductive farbic, a 10K resistor, an adafruit flora, a 3V battery switch, white thread, a vibration motor with its haptic driver and an RGB Neopixel.

Materials for necklace

I started cutting out two matching patterns of a neck line and sewing on one of them all my cables as I had designed them to be.

sewing the white cables

Second step was to spray paint my outputs in white to make them match the wires.

spray painting outputs

I then added the two outputs.

outputs added

Next step was sewing up the capacitive touch sensor (made of a conductive fabric). This one I first connected badly to the resistor and then I rearranged things so the resistor in fact intersected both pins the sensor was inserted in (on the flora).

capacitive touch sensor

After this I used metal poppers as my necklace's closure, so that I could maintain the current between the two side of it and thus close my circuit.

Necklace making

Before setting up the flora connections to the wires it looked like this.

Using Adafruit FLORA

In order to make the necklace I decided to used the Adafruit Flora as my processor as that is an easier and wearable-friendly one that I could sew easily on he necklace's base.

I then had to adapt my pin nunbers to the flora, which is the pin noted in black ink on the following drawing:

scan of squeme for flora

I used this flor pin scheme as a reference:

Flora pins

When I finally connected the flora the necklace looked like this:

necklace with flora

The code I used for this adapted to flora as a board is:

#include <CapacitiveSensor.h>

/*
 * CapitiveSense Library Demo Sketch
 * Paul Badger 2008
 * Uses a high value resistor e.g. 10M between send pin and receive pin
 * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
 * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
 */


CapacitiveSensor   boton = CapacitiveSensor(SDA,6);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired

int sensorPin = 6; 

int LED_PIN = 10; 

void colorWipe();

int prp = (255,0,255);

  #define LED_COUNT 1

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

  Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

#define sensorPin  6 

int vibPin = SCL; 

int val2 = 153;

int val3 = 0;

  #include <Wire.h>
  #include "Adafruit_DRV2605.h"

Adafruit_DRV2605 drv;

void setup() {

  pinMode(sensorPin, INPUT);
  pinMode(LED_PIN, OUTPUT); 
  Serial.begin(9600);

    strip.begin();           
    strip.show();            
    strip.setBrightness(50); 

  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
  pinMode(vibPin, OUTPUT);  

    Serial.println("DRV test");
    drv.begin();

    drv.selectLibrary(1);


    drv.setMode(DRV2605_MODE_INTTRIG); 
}

uint8_t effect = 1;

void loop() {

  long valor =  boton.capacitiveSensor(30);

  Serial.println(valor);                  // print sensor output 1

  if(valor>500) {
      strip.setPixelColor(0, strip.Color(150, 0, 255));
     Serial.println("TOUCHED");
     strip.show();
     delay (500); 
  } else {
     strip.setPixelColor(0, strip.Color(0, 0, 0));
     Serial.println("not touched");
     strip.show();
     delay (500);
  }

  delay(10);

  if (valor<500){
   analogWrite(vibPin, val3);
   delay (500);
   }
  else{
   analogWrite(vibPin , val2);
   delay (500); 

   drv.go();
   delay(500);
   }

}

This is how the necklace looks:

final picture back and front

I did not, however, manage to make my circuit work, first because locked away at home from the coronavirus I was unable to solder the needed connecting points, which made them weaker and second because I was not able to make my capacitive touch sensor be fully and well read on the flora, only on the Arduino Uno.

Testing wearable necklace's capacitive touch sensor with Adafruit Flora from Gabriela Lotaif on Vimeo.

Computer Programs Used for this Assignment:



Good Producers of Controller Boards