13 | Skin Electronics¶
"WHAT DOES IT MEAN TO HAVE A SKIN? COULD YOUR SKIN BECOME AN INTERFACE?"
I had many ideas for the last project, however they were complex. For that reason, I worked with Elsa. I proposed: translate the hugs. There are so many types of hugging and they can have different meanings, so I liked the idea of representing them with a specific color. Elsa loved the concept, so we started working on it.
However, this idea was a bit difficult for us to accomplish as it would be very big and the complexities of the resistances, components and connections would have increased exponentially. That’s why we decided to focus on the hands in order to make it simpler and as a sign of our friendship as we are regularly holding hands.
We thought about making an instrument with our hands. One would be the instrument and the other one, the player. To create the sound we started with a piezoelectric sensor, but as an actuator (its vibration generates sound). We programmed it with Arduino with just random noises, but the sound wasn’t very loud, so we decided to use it as a sensor.
As we were also working with the pressure exerted on the piezoelectric, the result was useful to know the range of values for programming. The updated actuator would be a neopixel: the more the pressure the more the light. We used a neopixel instead of a LED in order to improve from other weeks as we didn’t have the chance to test it yet.
Testing the electronic¶
Elsa’s illustration
Codes¶
- Read the piezoelectric sensor and map the value
int analog_sensor_pin = A0; //change the pin, where the sensor is connected?
int analog_sensor_value = 0;
void setup() {
pinMode(analog_sensor_pin, INPUT);
Serial.begin(9600);
}
void loop() {
analog_sensor_value = analogRead(analog_sensor_pin); //read the Voltage of the pin sensor
Serial.println(analog_sensor_value); // print the value on the Serial monitor
delay(100);
}
- Associate the range read to a LED
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 10; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
int newSensorValue;
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin(9600);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
//map the values to something usable
//map(value, fromLow, fromHigh, toLow, toHigh)
newSensorValue = map(sensorValue, 900, 1023, 0, 255);
//write the new value to the LED
analogWrite(ledPin, -newSensorValue);
//print the new value to the serial monitor
Serial.print("newSensorValue = ");
Serial.println(newSensorValue);
}
- Connect and program apart the neopixels
#include <Adafruit_NeoPixel.h>
#define LED_PIN 10
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 2
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
uint32_t off = strip.Color(0, 0, 0);
int num_rainbow = 15;
void setup() {
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}
void loop() {
rainbow(10); // Flowing rainbow cycle along the whole strip
//strip.fill(off, 0, 10); // turn the strip off
//strip.show(); //display the color
//delay(1000);
}
// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
for(long firstPixelHue = 0; firstPixelHue < num_rainbow*65536; firstPixelHue += 256) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
}
}
- Join analog sensor con neopixels (with Emma's code, thanks Emma for the help!)
#include <Adafruit_NeoPixel.h>
// constants won't change. They're used here to
// set pin numbers:
const int ledPin = 10; // the number of the neopixel strip
const int numLeds = 2;
//Adafruit_NeoPixel pixels = Adafruit_NeoPixel(8, ledPin);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numLeds, ledPin, NEO_GRB + NEO_KHZ800);
float brightness = 0;
uint32_t color;
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(sensorPin, INPUT);
Serial.begin(9600);
strip.begin();
//strip.setBrightness(80); // 1/3 brightness
}
void loop() {
brightness = 50;
for(uint16_t j=0; j<256; j++) {
//Serial.print(" ");
//brightness = map(sensorValue, 0, 70, 255, 0);
for(uint16_t i=0; i<strip.numPixels(); i++) {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
brightness = map(sensorValue, 0, 70, 255, 50);
brightness = constrain(brightness,0, 255);
byte WheelPos = (i*1+j) & 255;
if(WheelPos < 85){
color = strip.Color(brightness/255 * (WheelPos * 3), brightness/255 * (255 - WheelPos * 3), brightness/255 * (0));
}
else if(WheelPos < 170) {
WheelPos -= 85;
color = strip.Color(brightness/255 * (255 - WheelPos * 3), brightness/255 * 0, brightness/255 * (WheelPos * 3));
}
else {
WheelPos -= 170;
color = strip.Color(brightness/255 * 0, brightness/255 * (WheelPos * 3), brightness/255 * (255 - WheelPos * 3));
}
strip.setPixelColor(i, Wheel((i*1+j) & 255));
}
strip.show();
delay(30);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(brightness/255 * (WheelPos * 3), brightness/255 * (255 - WheelPos * 3), brightness/255 * (0));
}
else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(brightness/255 * (255 - WheelPos * 3), brightness/255 * 0, brightness/255 * (WheelPos * 3));
}
else {
WheelPos -= 170;
return strip.Color(brightness/255 * 0, brightness/255 * (WheelPos * 3), brightness/255 * (255 - WheelPos * 3));
}
}
ATtiny¶
We used an USBTinyISP to programm the microcontroller. It’s easier than doing it with Arduino: connect the ATtiny85 to the board and then the usb to the computer.
We followed this page and of course Emma's tutorial. The most important things are:
- Tools -> Board : ATtiny85
- Tools -> Programmer: UsbTinyISP
- Tools -> Burn Bootloader.
And these are the rest of the settings:
Unfortunately, this time, we had many troubles programming the code with Attiny because our USB didn't work with our computers or the Mac computers did not accept the code... so strange.
An alternative¶
As we couldn't continue with our "cyborg friendship" project going, we decided to embed Arantza's old circuit from Wearables week to a silicone layer. We had some leftover silicone discs from the jars from the soft robotics, and I took some of them and started sewing random things on.
Fortunately, I managed to program the ATtiny that week and we still had that microcontroller already programmed. That's how we came up with the idea of joining the two things together.
This is how the circuit was built in the breadboard:
Then we made a little sketch in order to clarify how the components will be placed in the hand.
Elsa’s illustration (always super cute)
Here is a little video on how Elsa sewn the layer of silicone. It was hard to embroider the components to it, as it seemed that they weren't fully attached. But after finishing and connecting it to the battery it worked!! but just until we put it on the hand where it broke jajaja.