Night Light

by ZakriyaP in Circuits > Arduino

1525 Views, 15 Favorites, 0 Comments

Night Light

Nano.jpg
51SecJzLE0L__SL1336_.jpg

Nightlight is a very simple project for beginners. It is set of lights which will be light up when there is no light in the room.

Products you would need.

1. ARDUINO BOARD

2. LIGHT SENSOR

3. LEDS

4. WIRES

You can found all these products on amazon.

Making a Led Strip

DSC01806.JPG

Make a LED strip. Just connect the leds in parallel connection and use long wire for connections. I have used four white LEDs and gave a distance of almost 1 foot between each LED. I have used thin wire to connect all the cathodes and anodes of all LEDs.

Connections

1.jpg

The connections are simple.

  1. Positive terminal of LED strip to digital pin "12" of Arduino.
  2. "gnd" terminal of LED strip to "gnd" pin of Arduino.
  3. "gnd" terminal of sensor goes to "gnd" of Arduino.
  4. Positive terminal of sensor to 5v of Arduino.
  5. "do" pin of sensor to digital pin "11" of Arduino.
  6. 5v of adapter to "vin" pin of Arduino.
  7. "gnd" terminal of adapter to gnd of Arduino.

Programing

Just plug your arduino with your computer and download "IDE SOFTWARE" of arduino. Then upload the code to arduino. The code is given below:

void setup() 
{
pinMode (12,OUTPUT);
pinMode (11,INPUT);
int buttonstate=0;
}

void loop()
{
  if(buttonstate==HIGH)
        {
        digitalwrite(12,HIGH);
        }
  else
       {
       digitalwrite(12,LOW);
       }  
}

Ending

DSC01810.JPG
DSC01816.JPG

Just put every thing in a container. I used a project box. Make sure the LDR (Light Dependent Resistor) is out of the box so that light can reach it.