OLED Candle Light Circuit With Fotoresistance for Intensity Control (TfCD)
785 Views, 11 Favorites, 0 Comments
OLED Candle Light Circuit With Fotoresistance for Intensity Control (TfCD)
In this instructable we show you how to make a circuit which shows (O)LED's flickering like a candle and react to the intensity of the environment. With a lower light intensity a lower light output from the lightsources is needed.
With this application you can build your own flickering candle light to create a comfortable and pleasant home lamp for extra atmosphere. You can try to replace the LED's with OLED if you have the components (Currently they are hard to get due to the cost and infancy of the technology). This new technology will be the future of solid state lighting.
Step 1: Collect Components
Collect the components:
1x Arduino Uno + USB cable
1x Breadboard
3x 330R resistor
1x 220R resistor
1x Foto resistor
10x Cable
Step 2: Set Up Your Arduino Breadboard
Set up your arduino breadboard according to the image.
Step 3: Upload the Code
Upload the following code.
Values can be adjusted or added for different desired results.
int ledPin1 = 9;
int ledPin2 = 10; int ledPin3 = 11; int lightSensor = A1; int randomValue = 120; int baseValue = 135;
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A1); if(sensorValue > 800) { randomValue = 120; baseValue = 135; } else if(sensorValue > 750) { randomValue = 110; baseValue = 115; } else if(sensorValue > 700) { randomValue = 90; baseValue = 100; } else if(sensorValue > 650) { randomValue = 70; baseValue = 80; } else if(sensorValue > 600) { randomValue = 55; baseValue = 65; } else if(sensorValue > 550) { randomValue = 40; baseValue = 55; } else { randomValue = 30; baseValue = 40; } // print out the value you read: Serial.println(sensorValue); analogWrite(ledPin1, random(randomValue)+baseValue); analogWrite(ledPin2, random(randomValue)+baseValue); analogWrite(ledPin3, random(randomValue)+baseValue); delay(random(100)); }
Step 4: Check Result
Check if the (O)LED's flicker like a candle and react on the light intensity of the environment.