Introduction: RGB LED & Breathing Mood Light

The RGB LED & Breathing Mood Light is a simple night light that contains two modes. For the first mode, you can alter the color of the RGB LED by turning the three variable resistors, and for the second mode, it presents the state of a breathing light. The mood light mainly consists of 1 RGB LED, 2 pushbuttons, and 3 variable resistors. There will be an object placed on each pushbutton and in order for the mood light to work, take the objects away from the pushbutton. For example, if you want the first mode, take the object off the pushbutton that controls the first mode. If you want to change it to breathing light, first put the object back onto the pushbutton that controls the first mode, then take the object off the pushbutton that controls the second mode.

Step 1: Supplies

Materials for the Circuit:

- 1 Arduino Leonardo (Arduino)

- 1 Breadboard (Amazon)

- 1 RGB LED (Amazon)

- 2 Pushbuttons (diameter: 30mm, include Dupont wires) (Amazon)

- 3 Variable resistors (B10K, 3 legs) (Amazon)

- 1 100ohm resistor (Amazon)

- 2 10kohm resistor (Amazon)

- 3 Male to female jumper wires (Amazon)

- 22 Male to male jumper wires (Amazon)

- 9 Alligator clip to male jumper wires (Amazon)

Materials for the Mood Light:

- 1 Black cardboard (A4)

- 1 Plastic/glass cylinder container (height: 16cm, diameter: 7.5cm)

- Cotton wool/cotton balls

- 1 Cardboard box (5.5cm x 14.5cm x 17cm)

- 1 Black paper (octavo, 26cm x 38 cm)

- 2 Heavy objects (for pressing the pushbutton)

- Glue, scissors, tape, utility knife

Step 2: Character Inside the Mood Light

For the character inside the mood light, first, draw the character on a white paper. Then, cut the character drawn on the white paper down and trace it onto the black cardboard. After tracing, cut the character on the black cardboard along the line. The black cardboard needs to be hard enough to let the character stand still inside the mood light.

Step 3: Mood Light Hood

For the hood of the mood light, I glued cotton wool inside the plastic cylinder container to create a misty and hazy feeling. This also dims the light and makes it not as dazzling at night. First, apply glue to the inner wall of the cylinder container. Then, take some cotton wool and stick it onto the inner wall. The amount, thickness, and shape of the cotton wool can be altered, as long as you leave enough space for the character to stand inside. Also, don't press the cotton wool too hard when sticking it onto the cylinder container. This lets the cotton wool to become flat and thick, which doesn't look good and won't let light pass through.

Step 4: Circuit Box

For the circuit box, I used a random cardboard box (5.5cm x 14.5cm x 17cm) and covered it with a piece of black paper (26cm x 38 cm).

1) Measure the size of the box you will use

2) Draw the net of the box onto the black paper (the size of the paper is only able to cover 5 sides of the box, so make sure the side that is not covered is at the bottom of the box. Use a larger paper if you want to cover all 6 sides).

2) Cut the paper according to the net drawn, using a utility knife

3) Tape the black paper onto the cardboard box

4) Measure the surface area of the components (2 pushbuttons, 3 variable resistors, 1 RGB LED, 1 USB cable)

5) Briefly draw them onto the cardboard box

6) Using a utility knife, cut out holes for each component

- Hole for pushbutton: 3cm (diameter)

- Hole for variable resistors: 0.6cm (diameter)

- Hole for RGB LED: 1cm x 0.6cm

- Hole for USB cable: 1cm x 0.7cm

Step 5: Circuit

After finishing making the character, the mood light hood, and the circuit box, the next step would be connecting the circuit. Connect all the wires to the breadboard and Arduino Leonardo according to the circuit diagram.

- The RGB LED is connected to digital pin 5, 6, and 9. Digital pin 5 controls the color and brightness of R, digital pin 6 controls the color and brightness of G, and digital pin 9 controls the color and brightness of B. Connect a 100ohm resistor from the breadboard to the negative electrode.

- The 3 variable resistors are connected to analog pin 0, 1, and 2. Each variable resistor is also connected to a negative and positive electrode on the breadboard. The value of R in the RGB LED connected to digital pin 5 can be altered from 0 to 255 as you turn the variable resistor connected to analog pin 2. The value of G in the RGB LED connected to digital pin 6 can be altered from 0 to 255 as you turn the variable resistor connected to analog pin 1. The value of B in the RGB LED connected to digital pin 9 can be altered from 0 to 255 as you turn the variable resistor connected to analog pin 0.

- The two pushbuttons are connected to digital pin 2 and 3. The pushbutton connected to digital pin 2 controls whether or not the color of the RGB LED can be altered, while the pushbutton connected to digital pin 3 controls whether to not the brightness of the RGB LED can be altered. Each pushbutton is also connected to a positive electrode and a 10kohm resistor from the breadboard to the negative electrode.

- Make sure there is also a wire connecting from 5V to the negative electrode and a wire connecting from GND to the positive electrode.

Step 6: Code

Code:https://create.arduino.cc/editor/janewu331/24debe2...

- Line 1 to 6 shows that brightness is an integer and the two pushbuttons are connected to digital pin 2 and 3

- Line 16 to 47 shows how the entire device works. If the button connected to digital pin 2 is pressed, then the RGB LED will not light up (line 16-20), and the device detects whether the button connected to digital pin 3 is pressed (line 21). If the button connected to digital pin 3 is pressed, the RGB LED will not light up (line 21-24). If the button connected to digital pin 3 is not pressed, the RGB LED will light up and present the state of a breathing light (26-40). If the button connected to digital pin 2 is not pressed, the RGB LED will light up and you can alter the color by turning the variable resistors (44-47).

- When you transfer the code onto your circuit board, make sure to connect the board to your desired device.

Modification:

For the breathing light, you can alter the speed (how fast the breathing light runs) and the length of delaying (each time it delays after it becomes the brightest). By changing the number (millisecond) in line 32 and 40, the speed of the breathing light can be altered. By changing the number (millisecond) in line 34, the length of delaying after the light becomes the brightest can be altered. The brightness of the breathing light can also be modified. By changing the number "255" in line 27 and 35 into other numbers less than 255 (since the brightest the LED can be is 255, it can not be greater than 255), you can alter the brightness of the breathing light and change it to the most suitable and comfortable light for you.

Step 7: Assemble the Components

After finishing the circuit, code, and all the components for the mood light, the last step would be to assemble everything together.

1. Place the circuit into the circuit box (Make sure the hole for the USB cable faces the right direction in the circuit box).

2. Attach each component (1 RGB LED, 2 pushbuttons, 3 variable resistors, 1 USB cable) to its corresponding hole.

3. Use tape to ensure and stabilize each component so it won't move or fall out when you press.

4. Stick the character in front of the RGB LED hole to let it block the wire of the RGB LED.

5. Use tape to stick the RGB LED on the back of the character.

6. Place the mood light hood on the circuit box and let it cover the character. Make sure the character stands at the center. Use glue to fix its position.

7. Plug in the USB cable and transfer the code onto your circuit board.

Step 8: Enjoy!

How to Operate:

There will be an object placed on each pushbutton and in order for the mood light to work, take the objects away from the pushbutton. For example, If you want the first mode, take the object off the pushbutton that controls the first mode. If you want to change it to breathing light, first put the object back onto the pushbutton that controls the first mode, then take the object off the pushbutton that controls the second mode. Each time you want to change a mode, you need to first put the object back onto the original pushbutton. The device will not work properly if both objects on the pushbuttons are taken away. Enjoy!