Msc2G5:Final

From ip
Jump to: navigation, search

LOGO.jpg







CONCEPT TITLE.jpg

The concept is composed of the following aspects:

Acoustic properties
- Sound ceiling with acoustic properties, passes down data to the LED painting

Time layers
- Short term layer (mostly interesting for children)
- Long term layer (mostly interesting for adults)

Reflection
- Paint a picture of the sound over the long-term

Concepttrafficlight.jpg Hallway2A2.png Hallway3.png Hallway3.1.png Hoberman contraption.png 5.1.jpg 5.3.jpg

EXPERIMENT.jpg

Experiment #1

Single hoberman sphere, plastic surface with cotton/viscose finishing

Experiment #2

Mechanical arms for expanding and compressing the spheres without strings
Prototype 1
2017-06-09 12.45.58.jpg 2017-06-07 15.05.52.jpg Prototype 2
2017-06-09 11.09.29.jpg 2017-06-09 11.09.08.jpg

Experiment #3

More mechanical arms and materialsamples
2017-06-12 15.38.00.jpg 2017-06-12 16.40.50.jpg Materialsamples: Sheep wool on top of a polyester acoustic surface. The sheep wool is fireproofed:
it does not catch fire but turns into coal instead. The polyester surface is fire retardant. IMG 2855.JPG 2017-06-12 12.10.58.jpg 2017-06-21 17.51.38.jpg 2017-07-03 19.10.06.jpg Mmmaterial.jpg 5.5.jpg

FINAL DESIGN.jpg Hallway4.png 5.6.jpg Cloud.jpg 02.jpg

The final project code:

//Projectcode.ino

//========================================
//INITIALIZATION
//========================================

#include <Adafruit_NeoPixel.h>
#include <VarSpeedServo.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
 
#define PIN 2 
#define LED_COUNT 50
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ400);

//********************************
//Servo motors
//********************************

//small spheres: the MG960R's
VarSpeedServo servo180_1; 
VarSpeedServo servo180_2;
VarSpeedServo servo180_3;
VarSpeedServo servo180_4;

//big ball: the FS511R
VarSpeedServo servoTwister;
int servospeed = 20; int notify = 0; int stepcount = 0;

//********************************
//Loudness sensor and strips
//********************************

//loudness parameters
int loudnesssignal = 0;
float acceptable = 90;
float unacceptable = 275;
float dangerpivot = (unacceptable + acceptable)/2;

//light
float intensity = 255;
float rr = 0;
float bb = 0;
float gg = intensity;
float inc = 1;

//counter
float count = 0;
float countlimit = 500;
float totalsignal = 0;
float refsignal = 0;

//========================================
//PROGRAM
//========================================

void setup() 
  {
  //********************************
  //Setup
  //********************************
  Serial.begin(9600);
  strip.begin();
  strip.show(); //turn pixels off

  servo180_1.attach(5);
  servo180_1.attach(6);
  servo180_2.attach(9);
  servo180_4.attach(10);

  servoTwister.attach(3);
  servoTwister.write(93); //keep the continuous servo still while starting up
  }


void loop() 
  {
  //********************************
  //Loudness sensor and strips
  //********************************
  
  //read the loudness sensor
  analogRead(0);
  loudnesssignal = analogRead(0);
  
  //counting loop (for averaging signal values)
  if (count < countlimit) {totalsignal += loudnesssignal; count+=1;  } else { refsignal = totalsignal/countlimit;   totalsignal = 0; count=0;  }
  
  //regulate gradual transition between lightstrip states
  if (refsignal < acceptable)                            {if (gg > intensity) gg-=inc; if (gg < intensity) gg+=inc;   if (rr > 0) rr-=inc; if (rr < 0) rr=0; } else //to green
  if (refsignal > acceptable && refsignal < dangerpivot) {if (gg > intensity) gg-=inc; if (gg < intensity) gg+=inc;   if (rr > intensity) rr-=inc; if (rr < intensity) rr+=inc; } else //to yellow
  if (refsignal > acceptable && refsignal > dangerpivot) {if (gg > 0) gg-=inc; if (gg < 0) gg=0; rr=intensity;        if (rr > intensity) rr-=inc; if (rr < intensity) rr+=inc; } //to red

  //update the lightstrip
  for(uint16_t i=0; i<strip.numPixels(); i++)
  { strip.setPixelColor(i,strip.Color(gg,rr,bb)); }     
  strip.show();
  
  //********************************
  //Servo motors
  //********************************

  //manual control over movement
  if (Serial.available())
    {
     notify = Serial.parseInt();
     if (notify == 1) servoTwister.write(180);
     if (notify == 0) servoTwister.write(93);     
     servo180_1.slowmove(toAngle(150,20,0), servospeed );
     servo180_2.slowmove(toAngle(180,20,0), servospeed );
     servo180_3.slowmove(toAngle(180,20,0), servospeed );
     servo180_4.slowmove(toAngle(150,20,0), servospeed );
     delay(4000);
     servo180_1.slowmove(toAngle(0,20,0), servospeed );
     servo180_2.slowmove(toAngle(0,20,0), servospeed );
     servo180_3.slowmove(toAngle(0,20,0), servospeed );
     servo180_4.slowmove(toAngle(0,20,0), servospeed );
    }
}

//function toAngle deals with inaccuracies of the 180-degree turning motor
int toAngle(int inp, int overreach, int tweak)
  {
   int tweak = 0; int overreach = -20;
   return tweak + overreach + map( inp,0,180,0,180 - overreach);
  }