Introduction: FRIEND'S LIGHT_프렌즈라이트

FRIEND'S LIGHT : friendly and interactive light like a friend!


Background

Most lights sold in the market have a structure in which light is emitted from the body. We tried an interesting approach by switching the existing stereotypes and tried to make a concept lighting that is turned on through the head (incandescent lamp). We will be able to appreciate our original lighting combining storytelling, sensing and coding.

This project can expect a variety of series!

Step 1: Idea Sketch

Analyze and research exciting and dynamic poses, and go through several sketches!

Step 2: Story & How It Works

Imagine and set up each story and how it works of 6 poses!

Step 3: Materials

All that you need is:

HARDWARE

1. Arduino Uno R3 (x6)

2. The Customized Module : AC to DC Converter (AC Input / DC Output) + Dimmer Functions (X6)

3. Socket (+Cover) (x6)

4. Socket terminal

5. 220V Power Cord (x6)

6. 220V Vintage Light Bulb_G125 Globe (x6)

7. 5V CDS Sensor Module (x1)

8. Touch Sensor Module (x1)

9. HC-SR04+ / Ultrasonic Sensor Module (x1)

10. Pull switch (x1)

11. USB Cable (x1)

SOFTWARE

- Arduino IDE

*** The Customized Module

We want to realize animation that controls brightness and speed of incandescent lamp(Vintage Light Bulb) according to ambient brightness. For this purpose, "The Customized Module" that converts the AC voltage supplied to the 220V incandescent lamp to a DC voltage is used. Also This makes it possible for incandescent lamp to be interlocked with Arduino.


Depending on the characteristics of the module, the B value of R, G, B is used for Brightness Control. A "255" value turns off the light bulb, and a "0" value makes the light bulb brighter.

Step 4: Measuring the Size

Measure the size of materials for accurate modeling.

The Measured Size (Width X Length X Height(mm))

● The Customized Module : 79 x 46 x 45 mm

● Arduino Uno R3 : 68 x 53 x 13 mm

● CDS Sensor Module : 40 x 14 mm (CDS Diameter : 3mm)

● Vintage Light Bulb : 125 x 125 x 170mm

● Socket : 44 x 44 x 55 mm

● Power Cord : Diameter 6mm

● The Outer Hole

The size of the outer hole is determined in consideration of the size of the materials.

- Neck section where socket is inserted : Diameter 60mm

- The hole through which the sensor is exposed : Diameter 5mm

- The hole where the power cord comes out : Diameter 6mm

Step 5: 3D Modeling & Making Output by 3D Printer ~

3D Modeling

1. Create a modeling file based on the measured size.

2. Convert the modeling file to an ".stl " file and upload it to the 3d printer.

Making output by 3D Printer

A body shaped like a person

3. Print it by 3d printer.

4. Sand the print by sandpaper. And combine the pieces of sanded print.

5. Use a putty to fill the gap.

6. Repeat the operation of the sandpaper and the surfacer until the surface of the print is smoothed.

7. When the above work is completed, finish with painting and clear (coating agent for abrasion resistant).

Step 6: Assembly

1. Connect the pin to "The Customized Module", "Arduino Uno R3", and "6 Sensors" according to the attached image.

The code is uploaded to Arduino with USB Cable.


[Common Connections]

● The Customized Module - Arduino

- The GND of "The Customized Module" is connected to GND of "Arduino"

- The PMW of "The Customized Module" is connected to 6 PIN of "Arduino"

- +, - (DC Output) of "Converter" in "The Customized Module" is connected to V-IN, GND of "Arduino"

[Different Connections]

no.1 Gi-dong

● Arduino - Pull Switch
- The GND of "Arduino" is connected to GND of "Pull Switch" through 1k resister

- The 5V of "Arduino" is connected to VCC of "Pull Switch"

- The A0 PIN of "Arduino" is connected to SIG of "Pull Switch"

no.2 Young-hee

● Arduino - CDS Sensor
- The GND of "Arduino" is connected to GND of "CDS Sensor"

- The 5V of "Arduino" is connected to VCC of "CDS Sensor"

- The A0 PIN of "Arduino" is connected to SIG of "CDS Sensor"

no.3 Hyun-chul

● Arduino - Touch Sensor
- The GND of "Arduino" is connected to GND of "Touch Sensor"

- The 5V of "Arduino" is connected to VCC of "Touch Sensor"

- The 8 PIN of "Arduino" is connected to SIG of "Touch Sensor"

no.4 Chun-ja

● Arduino - CDS Sensor
- The GND of "Arduino" is connected to GND of "CDS Sensor"

- The 5V of "Arduino" is connected to VCC of "CDS Sensor"

- The A0 PIN of "Arduino" is connected to SIG of "CDS Sensor"

no.5 Yun-a

● Arduino - Touch Sensor
- The GND of "Arduino" is connected to GND of "Touch Sensor"

- The 5V of "Arduino" is connected to VCC of "Touch Sensor"

- The 8 PIN of "Arduino" is connected to SIG of "Touch Sensor"

no.6 Duk-gu

● Arduino - Ultrasonic Sensor

- The GND of "Arduino" is connected to GND of "Ultrasonic Sensor"

- The 5V of "Arduino" is connected to VCC of "Ultrasonic Sensor"

- The 13 PIN of "Arduino" is connected to TRIG of "Ultrasonic Sensor"

- The 12 PIN of "Arduino" is connected to ECHO of "Ultrasonic Sensor"

2. After removing the cover of the end of the 220V power cord, fill it with lead. Then insert the wires filled with lead into the 220V + - terminal of the module.

3. Plug the socket wires into the socket terminal of the module.

4. After installing the assembled parts inside the 3D printing mock-up, close both sides of the joint.

Install the CDS Sensor and 220V power cord considering the position of the hole!

5. After inserting the light bulb into the socket, plug the cord into the multi-tap. Then turn on the switch.

Step 7: 6 Types Coding

We want to realize animation that controls brightness and speed of incandescent lamp(Vintage Light Bulb) according to ambient brightness. For this purpose, "The Customized Module" that converts the AC voltage supplied to the 220V incandescent lamp to a DC voltage is used. Also This makes it possible for incandescent lamp to be interlocked with Arduino.

Depending on the characteristics of the module, the B value of R, G, B is used for Brightness Control. A "255" value turns off the light bulb, and a "0" value makes the light bulb brighter.

The following is a neopixel coding based on this.

<p>//no1. Line Gi-dong coding</p><p>#include  <br>#ifdef __AVR__
#include 
#endif
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다
#define SensorPin A0 //센서 신호값 선을 아두이노 8번에 꽂는다
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----) 
int lightVal = 0; // 센서값 선언
float timers = 80;
void setup() {
  strip.begin();   //네오픽셀 초기화
  Serial.begin(9600); // 직렬 포트를 열고 데이터 속도를 9600 bps로 설정
}
 
void loop() {
  lightVal = analogRead(SensorPin); //빛센서값 읽어오기
  int data = map(lightVal,0,1024,0,255);
  data = abs(data-255);
  
  Serial.println(lightVal); //빛센서값 시리얼 창에서 확인하기
  int cnt = 255; //카운터 변수값의 조절을 통해 전체적인 노이즈의 끝과 시작이 결정됨
  if(analogRead(SensorPin)!=0){ //풀스위치값이 높을 때
    for(int i=0;i<40;i++){ //40번 반복을 하겠다
      if(i<39){ //횟수가 39번째까지
        int noise = random(-25,25); //노이즈의 범위를 -25~25 로 설정</p><p>        cnt-=5; //255의 값을 가진 카운터 변수를 5씩 차감한다
        strip.setPixelColor(0, strip.Color(0, 0, cnt+noise)); //카운터+노이즈값 (횟수가 높아질수록 빛의 밝기가 밝아짐)
        strip.show();
        delay(timers); //80ms 만큼 대기
      }
      else if(i == 39){ //횟수 40번째에 동작 (마지막 동작)
        cnt = 255; //카운터 변수 초기화
        strip.setPixelColor(0, strip.Color(0, 0, cnt)); //전구 끔   
        strip.show();
        delay(700);
      }
    }
        //timers-=2; //타이머를 조금씩 줄임 (영차영차가 진행될수록 조금씩 빨라짐)
  }
  else if(analogRead(SensorPin)==0){ 
    timers = 80;
    strip.setPixelColor(0, strip.Color(0, 0, 255));   //전구 빛 꺼짐
    strip.show();
    delay(80);
  }
}</p><p>//no2. tired Young-hee</p><p>#include  <br>#ifdef __AVR__
#include 
#endif
 
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다.
#define lightSensorPin A0 //조도센서 신호값 선을 아두이노 A0에 꽂는다.
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----)</p><p>// 아래쪽에 쓰일 변수들 선언해준다.</p><p>int red = 0;    
int green = 0;
int blue = 0;
 
int lightVal = 0; // 센서값 선언</p><p>int wait=300;  // 1/300초 기다려라
float timers = 0; </p><p>void setup() {
  strip.begin(); // 네오픽셀 초기화
  Serial.begin(9600); // 조도센서의 동작 상태를 확인하기 위하여 시리얼 통신을 설정한다.(전송속도 9600bps)
}
 
void loop() {
  lightVal = analogRead(lightSensorPin); //조도센서로부터 측정된 빛센서값 읽어온다.</p><p>  // 조도센서의 밝기 범위를 0~1023에서 0~255로 변경한다.
  int data = map(lightVal,0,1024,0,255);
  data = abs(data-255);</p><p>  int temp_data = map(lightVal,0,1024,0,150);
  temp_data = abs(temp_data-150);
  
  Serial.println(data); //빛센서값 시리얼 창에서 확인한다.</p><p>  // 조도센서로 부터 측정된 밝기 값이 140 이하면, 아래의 블록을 실행한다.
  // 조도센서로부터 측정된 센서값에 따라 전구 빛이 결정된다. (data 값)
  // 랜덤값에 따라 빛이 연출되며, 시간이 지날수록 timer값이 증가하고 랜덤 노이즈가 감소하여 빛이 점차 안정화된다.
  if(data <= 140){
    Serial.println("off");
    if (timers < 55){   // 타이머가 55/100초 미만이면
          int ran = random(200,255-timers); // ran 값 선언 
          strip.setPixelColor(0, strip.Color(0, 0, ran));   // 200~200-timers 사이의 랜덤값으로 전구 빛 연출!
          strip.show();
          timers += 0.2; // 0.2초씩 더해준다.
         delay(50+timers); //delay값 증가
    }
    else{   // 타이머가 55/100초 이상이면
          strip.setPixelColor(0, strip.Color(0, 0, 200));   
          strip.show();
          delay(50+timers);
  }
    </p><p>  
  // 조도센서로 부터 측정된 밝기 값이 141 이상이면, 아래의 블록을 실행한다.  
  }
  else if(data >= 141){
    timers = 0;
    Serial.println("ON");
    strip.setPixelColor(0, strip.Color(0, 0, 255));   // 전구 빛이 꺼진다.</p><p>    strip.show();
  }</p><p>  
}</p><p>//no3. dam Hyun-chul</p><p>#include  <br>#ifdef __AVR__
#include 
#endif
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----)</p><p>int touchSensor = 8;  // 터치센서 핀 설정
int ledPin = 13;       // LED 핀 설정</p><p>int fadeVal = 1;  //페이딩값 설정
int brightness = 0; //밝기값 설정</p><p>void setup() {
  strip.begin();   //네오픽셀 초기화
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  
  pinMode(touchSensor, INPUT);
}
 
void loop() {
  //터치값 읽음
  int touchValue = digitalRead(touchSensor);
  
  if (touchValue == HIGH){      // 터치됨</p><p>    delay(100);
    
    if (brightness >= 255 || brightness < 0)
    fadeVal = fadeVal * -1; //페이딩 역으로</p><p>    if (brightness == -1)
    brightness = 1; //전구밝기 어두워지면 밝기값 1로  
    
//위와같으면
    strip.setPixelColor(0, strip.Color(0, 0, brightness)); // 전구밝기값 0 = 꺼짐
    strip.show(); // 실행
    delay(100);      // 1/200초 지속
    brightness = brightness + fadeVal; 
    </p><p>    
    for(int i=0;i<15;i++){
      //int ran = random(0,random(150); // 랜덤값으로 빛의 흔들림 중 밝기 정도를 조절 (0~255)</p><p>      //strip.setPixelColor(0, strip.Color(0, 0, ran));  //ran으로 밝기설정
      //strip.show();</p><p>      //delay(50);  //어떠한 시간간격으로 밝아질 것인지 50ms 기본값</p><p>      int ran = random(100,200);  // 랜덤값으로 빛의 흔들림 중 어두움 정도를 조절 (0~255)</p><p>      strip.setPixelColor(0, strip.Color(0, 0, ran));   
      strip.show();</p><p>      delay(100);  //어떠한 시간간격으로 밝아질 것인지 50ms 기본값</p><p>      ran = random(200,255);  // 랜덤값으로 빛의 흔들림 중 어두움 정도를 조절 (0~255)</p><p>      strip.setPixelColor(0, strip.Color(0, 0, ran));   
      strip.show();</p><p>      delay(100);  //어떠한 시간간격으로 밝아질 것인지 50ms 기본값</p><p>    } </p><p>  } else {        //터치 안됨
    
    strip.setPixelColor(0, strip.Color(0, 0, 255));   //빛 꺼짐
    strip.show();</p><p>    }
  }</p><p>
//no.4 OTL Chun-ja</p><p>#include  <br>#ifdef __AVR__
#include 
#endif
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다
#define lightSensorPin A0 //센서 신호값 선을 아두이노 A0에 꽂는다
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----)</p><p>int lightVal = 0; // 센서값 선언
int wait=300;  // 1/300초 기다려라
int count = 0;</p><p>void setup() {
  strip.begin();   //네오픽셀 초기화
  Serial.begin(9600); // 직렬 포트를 열고 데이터 속도를 9600 bps로 설정
}
 
void loop() {
  lightVal = analogRead(lightSensorPin); //빛센서값 읽어오기
  int data = map(lightVal,0,1024,0,255); //읽어들인 빛센서 데이터값을 0~255 까지로 비율 조정하기
  data = abs(data-255); //실제 전구의 동작범위가 255에서 꺼지므로 반대값생성
  
  Serial.println(data); //빛센서값 시리얼 창에서 확인하기</p><p>  if(data < 100){ //빛센서값의 불꺼짐 값을 100 으로 제한
    Serial.println("off");
    if(count == 0){  //if문의 루프가 한번 다 돌았을 때 베토벤노래가 반복되지 않게 하는 안전장치
          vietnam(); //베토벤 함수 실행 
          vietnam(); //두번실행
    }
    count = 1; //if문 두번째때 위에서 말한 베토벤 함수 여러번 반복되지 않게 하는 안전 장치</p><p>    int ran = random(200,230); //노이즈값 생성 (매우 약한 값으로)
    strip.setPixelColor(0, strip.Color(0, 0, ran)); 
    strip.show();
    delay(100);
    }</p><p>  else if(data >= 100){ //빛이 밝아졌을 때
    Serial.println("on");
        count = 0; // 베토벤 함수가 다시 실행될 수 있도록 하는 안전장치를 풀어주는 변수 변경
          strip.setPixelColor(0, strip.Color(0, 0, 255));
          strip.show();
  }
}</p><p>//베토벤함수</p><p>//빛의 밝기와 딜레이값을 설정한다</p><p>void vietnam(){
    int ran2;  </p><p>    strip.setPixelColor(0, strip.Color(0, 0, 90));
    strip.show();   
    delay(150);
    strip.setPixelColor(0, strip.Color(0, 0, 255));
    strip.show();   
    delay(150);
    strip.setPixelColor(0, strip.Color(0, 0, 140));   
    strip.show();
    delay(150);
    strip.setPixelColor(0, strip.Color(0, 0, 255));   
    strip.show();
    delay(150);
    strip.setPixelColor(0, strip.Color(0, 0, 210));   
    strip.show();
    delay(150);
    strip.setPixelColor(0, strip.Color(0, 0, 255));   
    strip.show();
    delay(500);</p><p>//밝기 50일때 노이즈값 10번반복
    for(int i=0;i<10;i++){
      ran2 = random(0,50);
      strip.setPixelColor(0, strip.Color(0, 0, ran2));   //add noise
      strip.show();
      delay(100);      
    }</p><p>    strip.setPixelColor(0, strip.Color(0, 0, 255));   
    strip.show(); 
    delay(400);
}</p><p>//no.5 Skating Yun-a</p><p>#include  <br>#ifdef __AVR__
#include 
#endif
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----)</p><p>int touchSensor = 8;  // 터치센서 핀 설정
int ledPin = 13;       // LED 핀 설정
int control = 0;
bool count = 0;</p><p>void setup() {
  strip.begin();   //네오픽셀 초기화
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  
  pinMode(touchSensor, INPUT);
}
 
void loop() {
  //터치값 읽음
  int touchValue = digitalRead(touchSensor);
  if (touchValue == HIGH){      // 터치됨
    Serial.println("hi");</p><p>    for(int i = 0; i<3;i++){
            float x = 1.1;
            float y = 1.1;</p><p>            
            x = 1.1;
            y = 255;
            strip.setPixelColor(0, strip.Color(0, 0, 0));   // 전구 빛 밝기 최대
            strip.show();
            delay(400);           
            
            while(y > 2){
              y /= x;
              strip.setPixelColor(0, strip.Color(0, 0, abs(int(255-y))));   //전구 빛 밝기 점점감소
              strip.show();
              delay(40);
            }
    }</p><p>  } else {                      // 터치 안됨</p><p>    strip.setPixelColor(0, strip.Color(0, 0, 255));   //전구 빛 꺼짐
    strip.show();</p><p>    delay(70);
  }</p><p>}</p><p>//빛의 밝기 점점 증가
void sky(){
  float x = 1.5;
  float y = 255;
  while(y < x){
    y /= x;
    strip.setPixelColor(0, strip.Color(0, 0, y));   
    strip.show();
    delay(70);
  }
  //빛의 밝기 점점 감소
  while(y<255){
    y *= x;
    strip.setPixelColor(0, strip.Color(0, 0, y));   
    strip.show();
    delay(70);
  }</p><p>  
}</p><p>
//no6. Kidnap Duk-gu</p><p>#include  <br>#ifdef __AVR__
#include 
#endif</p><p>unsigned int minimum = 90;</p><p>int echoPin = 12;
int trigPin = 13;</p><p> 
#define PIN 6 // 네오픽셀 신호값 선을 아두이노 핀 6번에 꽂는다
#define lightSensorPin A0 //센서 신호값 선을 아두이노 A0에 꽂는다</p><p>Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); // (네오픽셀 알 개수, 꽂는 핀, -----)</p><p>void setup() {
    strip.begin();   //네오픽셀 초기화</p><p>  Serial.begin(9600);
  // trig를 출력모드로 설정, echo를 입력모드로 설정
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}</p><p>void loop() {</p><p>  
  // 초음파를 보낸다. 다 보내면 echo가 HIGH 상태로 대기하게 된다.
    digitalWrite(trigPin, LOW);
    digitalWrite(echoPin, LOW);
    delayMicroseconds(2);
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);</p><p>  
  // echoPin 이 HIGH를 유지한 시간을 저장 한다.
    unsigned long duration = pulseIn(echoPin, HIGH); 
  // HIGH 였을 때 시간(초음파가 보냈다가 다시 들어온 시간)을 가지고 거리를 계산 한다.
  float distance = ((float)(340 * duration) / 10000) / 2;  
  
  Serial.print(distance);
  Serial.println("cm");
  // 수정한 값을 출력</p><p>//거리에 따라 BLINK 빛 연출됨 (거리가 가까울수록 빠르게 BLINK됨)</p><p>//측정값이 90보다 적거나 같을때
if (distance <= minimum){
    strip.setPixelColor(0, strip.Color(0, 0, 50));   
    strip.show();
    delay(distance*7);
    strip.setPixelColor(0, strip.Color(0, 0, 255));   
    strip.show();
    delay(distance*7);
  
//측정값이 90보다 클때
}
  else if (distance > minimum){
    strip.setPixelColor(0, strip.Color(0, 0, 50));   
    strip.show();
    delay(630);
    strip.setPixelColor(0, strip.Color(0, 0, 255));   
    strip.show();
    delay(630);
  
}</p><p>}</p>

Step 8: Output

FRIEND'S LIGHT has a shape like a person. It consists of Black color body made with 3D printer and The head part replaced by the vintage light bulb.

This reflects life of the people who return from their exhausted lives, lights up a room, and contains a story that comforts and communicates someone. Through brightness of the surrounding space or human motion, sensor reacts and works by animating the light spontaneously. The Light Bulb can realize the light I want by the value set by Arduino coding.

In this way, we can experience the storytelling light reflecting the user's feelings and situations, and also has the function of interior lighting.