Introduction: Music Player Night Light

This night light will turn on by itself when you turn off your lights when you go to bed which you can then press the attached button to play some music off your laptop!! To make it even more useful I placed a box of tissue in the box to also stabilize my breadboard.


  • 10 LEDs ( Blue, Green, Red, White, Yellow ) * two of each
  • 8 220-ohm resistors
  • 4 100-ohm resistors
  • Arduino LEONARDO or DUE
  • USB cable 12 M-to-M jumper wires
  • 2 pin pushbutton
  • 1 photoresistor
  • Double-headed female to male wires
  • Double-headed male to male wires
  • Alligator clip to Dupont wires
  • A breadboard
  • A box that fits your breadboard
  • Decorations ex: colored paper, decorative tape, markers, etc.
  • A pair of scissors and or a utility knife
  • Staplers
  • Tape

Step 1: Circuits

LED Lights

I aligned them in a row and 2 holes from each other to have all 10 LEDs fit on the breadboard. The right side is the longer lead, the positive end, that connects with a digital pin. The left side is the shorter lead, the negative end, uses either a 220 or 100-ohm resistor connecting to the negative rail of the breadboard. The order and arrangement of the colors don't matter, you can place them based on personal preferences.

*Using a 220-ohm resistor gives you a smaller and more concentrated light while using a 100-ohm resistor seems a lot brighter compared to a 220-ohm resistor. So you can randomly change any color of light from a 220-ohm resistor to a 100-ohm resistor to show a sense of variety in your results.

Push Botton

I'm using a 2 pin push button since it has a longer wire it would be easier for me to push the bottom even with the box too so close to me. There are no polar to the bottom so using two male to male wires you connect the pushbutton to the breadboard.

Photoresistor ( Light Sensor )

A photoresistor has two pins. Since it is a kind of resistor, we do NOT need to distinguish these pins. They are symmetric. The more the light the photoresistor's face is exposed, the smaller its resistance is. Therefore, by measuring the photoresistor's resistance, we can know how bright the ambient light is. Using the photoresistor or light sensor, we're making it into a type of switch that activates the LED lights when it is exposed to a less than a certain amount of light.

Step 2: Program

Connect the Arduino LEONARDO or Arduino DUE to your device. The link to the code is here. On line 31, where it sets up a requirement for the light exposed to the photoresist, it should be changed accordingly using Serial.begin(9600) to detect the number most suitable in your environment. Using the Arduino serial plotter, you see the number when the lights in your room are turned on. For example; in my program when my lights were turned on the number was at about 1050. So the equation in the code would be the pin less than 1050 so when the number is less than 1050 the night lights would be activated.

Step 3: The Box

The box has to be able to fit your Arduino thing and doesn't have to have a look pretty because you get to decorate it later on. What I did was cut out a rectangle and stuck a piece of paper to soften the light on the long side of the box. There is a second square hole on the left short side for your USB cable to go through. Then I decorated the box with colored paper. On the right short side is a tiny square for the pushbutton's wires to go through. But make sure it isn't' too big or else the whole thing would be pulled out. The last small whole is on the top of the box where the photoresist can fit and detect the most direct of energy. And because I made part of my box a tissue box, on one side of the top of the box, I also cut out a small rectangle so the tissue can be pulled out. The two pieces on top were fixed with staples because I couldn't find anything better that could make them stay. But if you have a better idea please do so since using staples is really inconvenient.

Step 4: Operation

When you turn off the lights, supposedly the lights should be lighting up one by one. Then when you want to, you may press the pushbutton the play music from your device. Keep in mind that the device has to be on in order to play music.