Interactive Sleeves - LED Fire Animation





Introduction: Interactive Sleeves - LED Fire Animation

A fire starts when a person or object comes near your arms. It literally creates the spark between you and another person.

Step 1: Step 1: Assemble Materials

What you'll need is:

  • Ardiuno
  • 2x HC-SR04 Ultrasonic Sensors
  • WS2812B RGB LED strip
  • Electric wire (regular electric wire or sewable conductive thread)
  • Soldering iron and solder
  • Faux fur (with a minimum polm length of 6cm)

Step 2: Step 2: Setup

The photo above shows the setup of the project.

The circuit should be setup as follows: Connect a red wire from the 5V pin on the Arduino to the positive channel of the breadboard. Connect a black wire from the GND pin on the Arduino to the negative channel of the breadboard. Now connect all the negative sides of the sensors to the negative channel of the breadboard and all the positive sides to the positive channel of the breadboard.

  • HC-SRO4 Ultrasonic Sensor No.1:

Trig = pin 7

Echo= pin 6

  • HC-SRO4 Ultrasonic Sensor No.2:

Trig = pin 5

Echo = pin 4

  • LED Strip No. 1:

DI = pin 12

  • LED Strip No. 2:

DI = pin 11

Step 3: Step 3: Measuring and Cutting the LED Strips

Measure the sleeves of the sweater and cut the LED strips to the correct length.

Step 4: Step 4: Attach the LED Strips and Ultrasonic Sensors

Attach the LED strips and ultrasonic sensors to the sleeves. You can do this by sewing it or gluing it on. Attach the ultrasonic sensor in the space between where your elbow and shoulder would go.

Step 5: Step 5: Measuring

Decide where you want to put your Arduino. You can keep it in your pocket or attach it to the inside of your sweater. A Lilypad Arduino is the most suitable if you choose to attach it to your clothes. Once you've made your decision start measuring and cutting the electric cables.

Step 6: Step 6: Soldering

Now start soldering everything together like in the circuit given in step 2.

Step 7: Step 7: Code

Last but not least we have to tell the Arduino what to do.

All you have to do, is to open the Arduino program on your computer and then copy and paste the code from below.

You can adjust the ultrasonic sensors' distance by changing the value (in cm) of the integer "distance". I personally find 60cm a nice distance.

#include "FastLED.h"
#define LED_Aantal 20 CRGB leds[LED_Aantal]; const int trigPin = 7; const int echoPin = 6; const int trigPin2 = 5; const int echoPin2 = 4;

long duration; int distance = 60; int distancefirstsensor; long durationsecondsensor; int distancesecondsensor; int heatramp;

void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(trigPin2, OUTPUT); pinMode(echoPin2, INPUT); FastLED.addLeds(leds, LED_Aantal).setCorrection( TypicalLEDStrip ); FastLED.addLeds(leds, LED_Aantal).setCorrection( TypicalLEDStrip ); }

void loop() { Fire(60,120,20); Distance(); } void Distance(){ digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH);

distancefirstsensor= duration*0.034/2; if (distancefirstsensor <= distance){ FastLED.setBrightness(255-(distancefirstsensor*4.25)); } else{ FastLED.setBrightness(0); } Serial.print("Distance first sensor: "); Serial.println(distancefirstsensor); digitalWrite(trigPin2, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin2, LOW); durationsecondsensor = pulseIn(echoPin, HIGH); distancesecondsensor= durationsecondsensor*0.034/2; if (distancesecondsensor <= distance){ FastLED.setBrightness(255-(distance*4.25)); } else{ FastLED.setBrightness(0); } Serial.print("Distance second sensor: "); Serial.println(distancesecondsensor); }

void Fire(int Cooling, int Sparking, int SpeedDelay) { static byte heat[LED_Aantal]; int cooldown; for( int i = 0; i < LED_Aantal; i++) { cooldown = random(0, ((Cooling * 10) / LED_Aantal) + 2); if(cooldown>heat[i]) { heat[i]=0; } else { heat[i]=heat[i]-cooldown; } } for( int k= LED_Aantal - 1; k >= 2; k--) { heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2]) / 3; } if( random(255) < Sparking ) { int y = random(3); heat[y] = random(160,170); }

for( int j = 0; j < LED_Aantal; j++) { setPixelHeatColor(j, heat[j] ); }

showStrip(); delay(SpeedDelay); }

void setPixelHeatColor (int Pixel, byte temperature) { byte t192 = round((temperature/255.0)*191); byte heatramp = t192 & 0x3F; heatramp <<= 2; if( t192 > 0x80) { setPixel(Pixel, 255, 255, heatramp); } else if( t192 > 0x40 ) { setPixel(Pixel, 255, heatramp, 0); } else { setPixel(Pixel, heatramp, 0, 0); } }

void showStrip() { #ifdef ADAFRUIT_NEOPIXEL_H; #endif #ifndef ADAFRUIT_NEOPIXEL_H; #endif } void setPixel(int Pixel, byte red, byte green, byte blue) { #ifdef ADAFRUIT_NEOPIXEL_H strip.setPixelColor(Pixel, strip.Color(red, green, blue), LEDbrightness); #endif #ifndef ADAFRUIT_NEOPIXEL_H leds[Pixel].r = red; leds[Pixel].g = green; leds[Pixel].b = blue; #endif }

void setAll(byte red, byte green, byte blue, byte ) { for(int i = 0; i < LED_Aantal; i++ ) { setPixel(i, red, green, blue); } showStrip(); }



  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Paper Contest 2018

    Paper Contest 2018

We have a be nice policy.
Please be positive and constructive.




Very nice! I'd love to see a video!