12. Skin Electronics#

This week I learned about skin electronics. I made Skin “masquerade party” made of silicon “Dragon skin” material,laser cutting the mold using acrylic material to cast the mold in it and took the shape.I add food coloring in the silicon. I Allowed a couple of hours for the silicon to dry. then made a simple microcontroller with an Attiny45 and add touch sensor using conductive fabric so when its wearable the Neopixels change its color. I connected NeoPixels LED and wrote a sketch that makes a sequence of RGB colors.

workflow#

Her you can fined the mask and the mold to try it

Electronics#

I used Attiny45 to program my neopixels, I go on the same stips on week E-Textiles and Wearables II in programming Attiny, download the neopixels library from Guthub, and used Native Capacitive Sensors download it from Arduino.

connection Arduno/Attiny/Neopixels:#

Code Example#

Use the three backticks to separate code.

#include "pins_arduino.h" // Arduino pre-1.0 needs this
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN            3

#define NUMPIXELS      6

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);


void setup() {  
  pinMode(4,OUTPUT);
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  // End of trinket special code

  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() {
if(readCapacitivePin(4)>2)
{
for(int k=20; k<255; k++)
{
  for(int i=0;i<NUMPIXELS;i++){
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(k/2,k/4,k)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
  }
  delay(1);
}

for(int k=255; k>20; k--)
{
  for(int i=0;i<NUMPIXELS;i++){
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(k/2,k/4,k)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
  }
 // delay(1);
}
}
else
{
  for(int i=0;i<NUMPIXELS;i++){
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(255,255,255)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
  }
}
}




uint8_t readCapacitivePin(int pinToMeasure) {

  // Variables used to translate from Arduino to AVR pin naming

  volatile uint8_t* port;

  volatile uint8_t* ddr;

  volatile uint8_t* pin;

  // Here we translate the input pin number from

  //  Arduino pin number to the AVR PORT, PIN, DDR,

  //  and which bit of those registers we care about.

  byte bitmask;

  port = portOutputRegister(digitalPinToPort(pinToMeasure));

  ddr = portModeRegister(digitalPinToPort(pinToMeasure));

  bitmask = digitalPinToBitMask(pinToMeasure);

  pin = portInputRegister(digitalPinToPort(pinToMeasure));

  // Discharge the pin first by setting it low and output

  *port &= ~(bitmask);

  *ddr  |= bitmask;

  delay(1);

  uint8_t SREG_old = SREG; //back up the AVR Status Register

  // Prevent the timer IRQ from disturbing our measurement

  noInterrupts();

  // Make the pin an input with the internal pull-up on

  *ddr &= ~(bitmask);

  *port |= bitmask;



  // Now see how long the pin to get pulled up. This manual unrolling of the loop

  // decreases the number of hardware cycles between each read of the pin,

  // thus increasing sensitivity.

  uint8_t cycles = 17;

  if (*pin & bitmask) { cycles =  0;}

  else if (*pin & bitmask) { cycles =  1;}

  else if (*pin & bitmask) { cycles =  2;}

  else if (*pin & bitmask) { cycles =  3;}

  else if (*pin & bitmask) { cycles =  4;}

  else if (*pin & bitmask) { cycles =  5;}

  else if (*pin & bitmask) { cycles =  6;}

  else if (*pin & bitmask) { cycles =  7;}

  else if (*pin & bitmask) { cycles =  8;}

  else if (*pin & bitmask) { cycles =  9;}

  else if (*pin & bitmask) { cycles = 10;}

  else if (*pin & bitmask) { cycles = 11;}

  else if (*pin & bitmask) { cycles = 12;}

  else if (*pin & bitmask) { cycles = 13;}

  else if (*pin & bitmask) { cycles = 14;}

  else if (*pin & bitmask) { cycles = 15;}

  else if (*pin & bitmask) { cycles = 16;}



  // End of timing-critical section; turn interrupts back on if they were on before, or leave them off if they were off before

  SREG = SREG_old;

  *port &= ~(bitmask);

  *ddr  |= bitmask;



  return cycles;

}


Video#

From Vimeo#

touch mask from Al-zahra'a alomari on Vimeo.

IMG_2804 from Al-zahra'a alomari on Vimeo.

IMG_0106 from Al-zahra'a alomari on Vimeo.