Diwali Special
Winter is Coming...festival decorations are everywhere.
One of the gadgets that can be found everywhere are led light diya . They are cheap, clean and not as dangerous as real diya.
Let's start it.....
Preparation of the Materials
What we need for this DIY is a
- Diya
- Leds
- Arduino uno
- Gas sensor
- General purpose Pcb
- Wire
- Lm 324 or 358
- Photodiode
- Resistances 330 ohm , 10k
- Potentiometer 10k
- Hot glue gun
- A box
- Soldering iron
- Screwdrive
Preparing the Led Diya
STEPS are :
- Takes some Yellow Leds and glue it on Diya with the help of hot glue gun.
- Now connect the all leds in parallel (positive to positive and negative to negative) with the help of soldering iron.
- Than I drilled the hole for I.R SENSOR and GAS SENSOR wire.
Circuit Diagram for Sensor
I used two sensors :
- one is I.R SENSOR with the help of I.R SENSOR. I am able to operate my DIWALI SPECIAL DIYA with any I.R remote (T.V, A.C).
- second one is GAS SENSOR.
WATCH MY VIDEO if you want to know why i am using Gas sensor in my instructable.
Final Touch Up
Take a box and cut it from the bottom portion and glue it on base surface of Diya
Code
int ledPin = 3; // choose the pin for the LED
int switchPin =4; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
int counter = 0;
int currentState = 0;
int previousState = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(switchPin, INPUT); // declare pushbutton as input
pinMode(A0, INPUT);
}
void loop(){
int pot_value = analogRead(A0);
val = digitalRead(switchPin); // read input value
if(pot_value>=180)
{
digitalWrite(ledPin, HIGH);
}
else if(pot_value<=180&&pot_value>=150)
{
digitalWrite(ledPin, LOW);
}
if (val == LOW) { // check if the input is HIGH (button released)
currentState = 1;
}
else {
currentState = 0;
}
if(currentState != previousState)
{
if(currentState == 1)
{
counter = counter + 1;
}
if(counter%2==0)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
previousState = currentState;
delay(250);
}