Shared:Group 3

From ip
Jump to: navigation, search

ACCORDION/ Hua Fan & Yixin Lyu

Rendering.jpg

Concept development | "Accordion"

001.jpg


The concept came from accordion. The space created by a folded material of an accordion will be an interesting design character if it could be scaled up. Additionally, it has flexibility for movement. Then when there is no one nearby, it will be in a close position. One of the corner will open when the sensor is activated by human’s movement. A charming room will appear that will attract people’s attention. In original design, a loudness sensor was applied. However, this equipment is too small for the sensor to interact. As a result, PIR motion sensor has replaced loudness sensor with two directions blocked to reduce distributions.

20170419123732.jpg Tumblr m0we1gkOBE1r4fbz5o1 400.jpg 255.jpg Prova2.jpg

Mechanism design

1. Changing continious servo to Linear Motor
[1]

Motor.jpg

3D print gears, groundplate, rack, topplate and assembled into a linear motor


2.Structure

674302351.jpg

4 PIR motion sensors are in each corner od the installation

IMG 2412.JPG

A basement for arduino, breadboard and servos.
Strings connect with the rack of linear servo and the bottom of the accordion.
Neo pixels are in the each corner of the accordion to show that the sensor detected the motion and the servo is going to move.

3.Effect

0001.png
One motion sensor detected--Blue
0003.png
Two motion sensors detected--Pink
0002.png

Three motion sensors detected--Rainbow Circle

It should be for PIR sensors. Because of the delivery problems, only three sets are used to present.

Video

electronics use and code sample

List of sensors
1 seeeduino
1 breadboard
3 continuous servo
3 PIR motion sensor
3 Neo pixel LED (5 in each)

code sample
+#include <Adafruit_NeoPixel.h>

  1. ifdef __AVR__
  2. include <avr/power.h>
  3. endif
  4. include <Servo.h>

int sen1 = 0; int sen2 = 0; int sen3 = 0;


Servo myservo01; Servo myservo02; Servo myservo03;//creates a servo object //a maximum of eight servo objects can be created

int pos01 = 0; int pos02 = 0; int pos03 = 0;//variable to store servo position

//amount of time we give the sensor to calibrate(10-60 secs according to the datasheet)

int calibrationTime = 2;

//the time when the sensor outputs a low impulse long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low //before we assume all motion has stopped long unsigned int pause = 5000;

boolean lockLow = true; boolean takeLowTime;

int pirPin01 = 2; //digital pin connected to the PIR's output int pirPin02 = 5; //digital pin connected to the PIR's output int pirPin03 = 6;

Adafruit_NeoPixel strip(5, 4, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel strip02(5, 12, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel strip03(5, 13, NEO_GRB + NEO_KHZ800);

void setup() {


 myservo01.attach(10);
 myservo02.attach(9);
 myservo03.attach(3); //attaches servo to pin 4
 Serial.begin(9600);    //begins serial communication
 Serial.println("SETUP....");
 pinMode(pirPin01, INPUT);
 pinMode(pirPin02, INPUT);
 pinMode(pirPin03, INPUT);
 strip.begin();    //led1
 strip.show();
 strip02.begin();    //led2
 strip.show();
 strip03.begin();    //led3
 strip.show();
 //give the sensor time to calibrate
 Serial.println("calibrating sensor ");
 for (int i = 0; i < calibrationTime; i++) {
   Serial.print(calibrationTime - i);
   Serial.print("-");
   delay(1000);
 }
 Serial.println();
 Serial.println("done");
 //while making this Instructable, I had some issues with the PIR's output
 //going HIGH immediately after calibrating
 //this waits until the PIR's output is low before ending setup
 while (digitalRead(pirPin01) == HIGH) {
   delay(500);
   Serial.print(".");
 }
 Serial.print("SENSOR ACTIVE");

}

void loop() {

 sensorRead();
 if (sen1 == 1 && sen2 == 1 && sen3 == 1)
 { rainbowCycle(5);
   rainbowCycle02(5);
   rainbowCycle03(5);
   delay(1000);
   colorWipe (strip.Color (0, 0, 0), 0);
   colorWipe02 (strip.Color (0, 0, 0), 0);
   colorWipe03 (strip03.Color (0, 0, 0), 0);
   delay(500);
   myservo01.write(100);
   myservo02.write(100);
   myservo03.write(100);
   delay(1000);
   myservo01.write(90);
   myservo02.write(90);
   myservo03.write(90);
   delay(800);
   myservo01.write(80);
   myservo02.write(80);
   myservo03.write(80);
   delay(1000);
   myservo01.write(90);
   myservo02.write(90);
   myservo03.write(90);
   delay(1000);
   strip.show();
   strip02.show();
   strip03.show();
 }
 else if (sen1 == 1 && sen2 == 1 && sen3 == 0 || sen1 == 1 && sen2 == 0 && sen3 == 1 || sen1 == 0 && sen2 == 1 && sen3 == 1 ) {
   if (sen1 == 1 && sen2 == 1 && sen3 == 0) {
     colorWipe (strip.Color (255, 187, 218), 1000);
     colorWipe02 (strip02.Color (255, 187, 218), 1000);
     delay(2000);
     colorWipe (strip.Color (0, 0, 0), 0);
     colorWipe02 (strip02.Color (0, 0, 0), 0);
     delay(800);
     myservo01.write(100);
     myservo02.write(100);
     delay(1000);
     myservo01.write(90);
     myservo02.write(90);
     delay(800);
     myservo01.write(80);
     myservo02.write(80);
     delay(1000);
     myservo01.write(90);
     myservo02.write(90);
     delay(1000);


   }
   if (sen1 == 1 && sen2 == 0 && sen3 == 1) {
     colorWipe (strip.Color (255, 187, 218), 1000);
     colorWipe03 (strip03.Color (255, 187, 218), 1000);
     delay(2000);
     colorWipe (strip.Color (0, 0, 0), 0);
     colorWipe03 (strip03.Color (0, 0, 0), 0);
     delay(800);
     myservo01.write(100);
     myservo03.write(100);
     delay(1000);
     myservo01.write(90);
     myservo03.write(90);
     delay(800);
     myservo01.write(80);
     myservo03.write(80);
     delay(1000);
     myservo01.write(90);
     myservo03.write(90);
     delay(1000);
   }


   if (sen1 == 0 && sen2 == 1 && sen3 == 1) {
     colorWipe02 (strip02.Color (255, 187, 218), 1000);
     colorWipe03 (strip03.Color (255, 187, 218), 1000);
     delay(2000);
     colorWipe02 (strip02.Color (0, 0, 0), 0);
     colorWipe03 (strip03.Color (0, 0, 0), 0);
     delay(800);
     myservo03.write(100);
     myservo02.write(100);
     delay(1000);
     myservo03.write(90);
     myservo02.write(90);
     delay(800);
     myservo03.write(80);
     myservo02.write(80);
     delay(1000);
     myservo03.write(90);
     myservo02.write(90);
     delay(1000);


   }


   strip.show();
   strip02.show();
   strip03.show();
 }
 else if (sen1 == 1 && sen2 == 0 && sen3 == 0 || sen1 == 0 && sen2 == 1 && sen3 == 0 || sen1 == 0 && sen2 == 0 && sen3 == 1) { // Testing both sensors at same time, if high, go to apropriate line.
   if (sen1 == 1 && sen2 == 0 && sen3 == 0) {
     if (sen1 == 1) {
       colorWipe (strip.Color (30, 50, 255), 1000);
       delay(2000);
       colorWipe (strip.Color (0, 0, 0), 0);                                                   // This is needed for turn everything off, clear all pixels. More efficient with this here
       moveServo(myservo01);
     }
   }
   if (sen1 == 0 && sen2 == 1 && sen3 == 0) {
     if (sen2 == 1) {
       colorWipe02 (strip02.Color (30, 50, 255), 1000);
       delay(2000);
       colorWipe02 (strip02.Color (0, 0, 0), 0);
       moveServo(myservo02);
     }
   }
   if (sen1 == 0 && sen2 == 0 && sen3 == 1) {
     if (sen3 == 1) {
       colorWipe03 (strip03.Color (30, 50, 255), 1000);
       delay(2000);
       colorWipe03 (strip03.Color (0, 0, 0), 0);
       moveServo(myservo03);
     }
   }
   strip.show();
   strip02.show();
   strip03.show();
 }

}

void moveServo(Servo s) {

 s.write(100);
 delay(1000);
 s.write(90);
 delay(800);
 s.write(80);
 delay(1000);
 s.write(90);
 delay(1000);                  // both motors have instructions BEFORE the delay (!)

}

void sensorRead() {

 sen1 = digitalRead(pirPin01);
 sen2 = digitalRead(pirPin02);
 sen3 = digitalRead(pirPin03);
 Serial.print(sen1);
 Serial.print("   /   ");
 Serial.println(sen2);
 Serial.print("   /   ");
 Serial.println(sen3);

}

void colorWipe(uint32_t c, uint8_t wait) {

 for (uint16_t i = 0; i < strip.numPixels(); i++) {
   strip.setPixelColor(i, c);
   strip.show();
 }

}

void colorWipe02(uint32_t c, uint8_t wait) {

 for (uint16_t i = 0; i < strip02.numPixels(); i++) {
   strip02.setPixelColor(i, c);
   strip02.show();


 }

}

void colorWipe03(uint32_t c, uint8_t wait) {

 for (uint16_t i = 0; i < strip03.numPixels(); i++) {
   strip03.setPixelColor(i, c);
   strip03.show();


 }

}



// Slightly different, this makes the rainbow equally distributed throughout void rainbowCycle(uint8_t wait) {

 uint16_t i, j;
 for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
   for (i = 0; i < strip.numPixels(); i++) {
     strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
   }
   strip.show();
 }

} void rainbowCycle02(uint8_t wait) {

 uint16_t i, j;
 for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
   for (i = 0; i < strip02.numPixels(); i++) {
     strip02.setPixelColor(i, Wheel(((i * 256 / strip02.numPixels()) + j) & 255));
   }
   strip02.show();
 }

} void rainbowCycle03(uint8_t wait) {

 uint16_t i, j;
 for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
   for (i = 0; i < strip03.numPixels(); i++) {
     strip03.setPixelColor(i, Wheel(((i * 256 / strip03.numPixels()) + j) & 255));
   }
   strip03.show();
 }

}

uint32_t Wheel(byte WheelPos) {

 WheelPos = 255 - WheelPos;
 if (WheelPos < 85) {
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
 }
 if (WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
 }
 WheelPos -= 170;
 return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

} uint32_t Wheel02(byte WheelPos) {

 WheelPos = 255 - WheelPos;
 if (WheelPos < 85) {
   return strip02.Color(255 - WheelPos * 3, 0, WheelPos * 3);
 }
 if (WheelPos < 170) {
   WheelPos -= 85;
   return strip02.Color(0, WheelPos * 3, 255 - WheelPos * 3);
 }
 WheelPos -= 170;
 return strip02.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

} uint32_t Wheel03(byte WheelPos) {

 WheelPos = 255 - WheelPos;
 if (WheelPos < 85) {
   return strip03.Color(255 - WheelPos * 3, 0, WheelPos * 3);
 }
 if (WheelPos < 170) {
   WheelPos -= 85;
   return strip03.Color(0, WheelPos * 3, 255 - WheelPos * 3);
 }
 WheelPos -= 170;
 return strip03.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

}


Development Sketches

IMG 2538.JPG IMG 2539.JPG IMG 2540.JPG 20170419123751.jpg