Introduction: Night Light

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.

Step 1: Making a Led Strip

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.

Step 2: Connections

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.

Step 3: 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);
       }  
}

Step 4: Ending

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.

Comments

author
DIY Hacks and How Tos (author)2017-04-12

Nice idea for a night light. I like how it could look like fireflies in a jar. My kids would love to have something like this in their rooms.

author

It will be awesome.Please let me know if you try this.

About This Instructable

686views

15favorites

Bio: I live in Pakistan . I am 16 year old and I am passionate about electronics since my childhood. I have a hobby to design and ... More »
More by ZakriyaP:Vanlife Cheap Lab for Electronic Hobiest.Matal Levitating Device.Generate Electricity From Vinegar.
Add instructable to: