DIY Nightlight

by mls157 in Craft > Art

145 Views, 0 Favorites, 0 Comments

DIY Nightlight

DIY Nightlight Beach House
IMG-2066 (1).jpg

I wanted to create my own version of a DIY nightlight and had the idea to use an already made wooden beach house model, but you can use any item you want for your Nightlight. It is designed so the light changes colors from red, blue, and green based on how much light is being sensed by the sensor when dark, but if it's bright it turns off.

Supplies

  • Arduino Uno, breadboard and USB connector
  • RGB Led
  • Photo-resistor
  • (3) 330 Ohm resistor
  • (1) 10K Ohm resistor
  • (9) Jumper Wires Male-Male
  • (6) Jumper Wire Female- Male, (4) for (blue, green, black, and red colors rgb led)
  • Any cardboard box that fits your breadboard and Arduino Uno (optional)
  • Any Wooden pre-made model of your choice to put led in (any premade model or item)
  • Drill

Wire Everything Together

IMG-2060.jpg
IMG-2059.jpg
DIY Nightlight_bb.png

I wired my nightlight as follows,

Blue wire, Male to Male Jumper Arduino position 11 to breadboard I row 1

Orange wire, Male to Male Jumper Arduino position 10 to breadboard I row 2

Black wire, Male to Male Jumper Arduino position GND to breadboard 1(-)

Red wire, Male to Male Jumper Arduino position 9 to breadboard I row 4

Blue wire, Male to Male Jumper Arduino position A0 to breadboard E row 26

Red wire, Male to Male Jumper Arduino position 5V to breadboard 1(+)

Black wire, Male to Male breadboard (-), then to E 27

330 OHM resistors, breadboard from F 1, 2, 4 to E 1, 2 ,4

10K OHM resistor breadboard from C 26 to D 27

Attach RBG LED and Photoresistor

IMG-2062.jpg
RGB_LED_Pins2.png

Now attach the RGB and photoresistor to your breadboard as follows according to the RGB color code.

RGB LED using Male to Female jumpers, red from A 1 to LED, black (common) to A 2, green to A 3, and orange to A 4.

Next attach the photoresistor using Male to Female jumper, attach gray wire to breadboard position 25 B Female and to any leg of the photoresistor. Attach the white Male to Female jumper to breadboard position 26 A and to the other leg of the photoresistor. (IMPORTANT) position your photoresistor where it is not obstructed and can sense the current light conditions.

Coding

Here I have a code that I had edited to meet my project, but it was inspired by the coding from (https://learn.sparkfun.com/tutorials/sparkfun-inve... You can use it as is or edit it to your particular needs.

Code:

Construct Cardboard and Decorate Wooden Model of Choice

IMG_2078.jpg
IMG-2045.jpg

This step is optional, but I chose to house the Arduino and breadboard in a cardboard box to make the light more appealing. You can decorate your item of choice however you like. I put three holes in the box to run the LED jumper into the model to put the photoresistor outside the box and to run USB cable for programming.

Drill a Hole and Put RGB Led In

IMG-2064.jpg
IMG-2056.jpg
IMG-2053.jpg

After I put everything in the cardboard box I drilled a hole in my model to run the RGB and jumpers up and inside my beach house model.

ALL FINISHED!!!

You did it!! Now you have made your own DIY Nightlight.