Arduino Lamp Photocell Serial Control with Bottle Cork

Description

I’m interested in how to push certain part of a system to create changing outputs over the time. With this in mind, for this project, I tried to mimic a serial lighting input environment for the photocell sensor, by making a paper bottle cork which is long enough to cover the photocell entirely inside. In this way, if I push and pull the hollow bottle cork, it can cover the photocell from the outside lighting from 100% to 0%. However, since white paper is actually semi-translucent to light, so I decide to use black paper to make the bottle cork, which is designed to be an excellent shading barrier for the photocell.

Components

  • 1 paper diffuser
  • 1 black bottle cork
  • Arduino uno
  • wires
  • 1 LED
  • 1 photocell
  • 2 resistors
  • 1 laptop

 

Code

int sensorPin = A0; 
int ledPin = 13; 
int sensorValue = 0; 

void setup() {
 // declare the ledPin as an OUTPUT:
 pinMode(ledPin, OUTPUT);
}

void loop() {
 // read the value from the sensor:
 sensorValue = analogRead(sensorPin);
 // turn the ledPin on
 digitalWrite(ledPin, HIGH);
 // stop the program for <sensorValue> milliseconds:
 delay(sensorValue*5);
 // turn the ledPin off:
 digitalWrite(ledPin, LOW);
 // stop the program for for <sensorValue> milliseconds:
 delay(sensorValue*5);
}

 

Video

 

Photos

img_0910 img_0911 img_0914 img_0915

 

Leave a Reply