Midterm for Core Lab

match lamp

I want to make a lamp with high technology, but it looks very ordinary. People should not forget the match that brings light to us.

Research:

The smart home market will take off if IoT device prices come down and the general public comes to understand the benefits of these products. And from smart homes, the next logical step is smart cities, which would take the IoT to the next level.

 

 

Inspiration:

The movement of the user is tracked using the light bulb to create digital art. properties such as speed, vector, rotation are determined for each particle based on the movement of the user. I was considering about some motion tracking with the smart home.

The match was the first tool to bring light to people. I want to make a  normal surface likes like the matchbox with high technology.

Description:

  • Material: Infrared Obstacle Avoidance Sensor
  • Sound Microphone Sensor,RGB LED strip
  • Skill: laser cutting, Arduino
  • Target population: young people who like new things

 

Test vedio:

 

Demo:

1.Functuon:Infrared Obstacle Avoidance Sensor & LED

2.Function:Sound Microphone Sensor & LED

Code:

#include <Adafruit_NeoPixel.h>

#define PIN 6
int Led = 15;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Led, PIN, NEO_GRB + NEO_KHZ800);
int state =0;
int ledNum;
int val;
int buttonPin0 =2;
int buttonPin1 =3;
boolean buttonState0 = false;
boolean buttonState1 = false;
long st,st0,st1;
int changdiState = 0;
long changdiTime;

void setup() {
Serial.begin(9600);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
ButtonCK();
if(state==1){
if(millis()-st>100 & ledNum<Led){
st=millis();
ledNum++;
strip.setPixelColor(ledNum, strip.Color(200, 0, 200));
}

}else if(state==2){
ledNum=0;
rainbowCycle(20);
}else if(state==3){
colorWipe(strip.Color(255, 0, 0), 50); // Red
colorWipe(strip.Color(0, 255, 0), 50); // Green
colorWipe(strip.Color(0, 0, 255), 50); // Blue
}else{
ledNum=0;
for(int i=0; i<Led; i++){
strip.setPixelColor(i, strip.Color(0, 0, 0));
}
}
strip.show();

}

void ButtonCK(){
buttonCheck();
val=analogRead(A0);
if(changdiState==0 & buttonState0 & millis()-changdiTime>500){
changdiState=1;
changdiTime=millis();
}
if(changdiState==1 & buttonState1){
state++;
changdiState=0;
}
if(state>3)state=1;
if(val>800){
state=0;
}
Serial.print(val);
Serial.print(“,”);
Serial.println(state);
}

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));
ButtonCK();
}
ButtonCK();
if(state!=2)break;
strip.show();
delay(wait);
}
}

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

void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
ButtonCK();
if(state!=3)break;
}
}

void buttonCheck(){
if(!buttonState0 & !digitalRead(buttonPin0)){
st0=millis();
buttonState0 = true;
}else if(buttonState0 & digitalRead(buttonPin0)){
buttonState0 = false;
}

if(!buttonState1 & !digitalRead(buttonPin1)){
st1=millis();
buttonState1 = true;
}else if(buttonState1 & digitalRead(buttonPin1)){
buttonState1 = false;
}
}

Interactive Story(Core Lab)

The interactive story project is a big challenge for me because I never did the similar project before. I plan to use the all Arduino hardware that is our learning from the class such as RGB Led, photoresistor, and potentiometer. Then, I want to describe my daily life by the processing part.
In the first page, I am drawing the sunrise at the mountain in the background, and it expresses the morning. The photoresist to control the screen brightness. In the second page, I create a bouton which is the button of the RGB Led with Arduino because my first thing is turning on the light in the morning. The RGB Led is cycled color when the mouse clicked the button in the processing. In the third page, I want to express the rainy day, and I add the buzzer in order to simulate the sound of lightning. In the fourth page, A row rectangle represents the subway, and the background changes color when I rotate the potentiometer. In the fifth page, it is similar to the first page, and I want to express the sunset.

Laser Cutting Lamp (Core Lab)

The circuit below here.

The lamp.

Function: The RGB LED inside and it was cycling through colors.

code:

int redLedPin = 4;
int greenLedPin = 5;
int buleLedPin = 6;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(redLedPin, OUTPUT);
pinMode(greenLedPin, OUTPUT);
pinMode(buleLedPin, OUTPUT);

}

void loop() {

//red
analogWrite(redLedPin, 255);
analogWrite(greenLedPin, 0);
analogWrite(buleLedPin, 0);
delay(500);

//green
analogWrite(redLedPin, 0);
analogWrite(greenLedPin, 255);
analogWrite(buleLedPin, 0);
delay(500);

//bule
analogWrite(redLedPin, 0);
analogWrite(greenLedPin, 0);
analogWrite(buleLedPin, 255);
delay(500) ;
}