I love making projects for my kids and I also love making projects using RGB LEDs, so I came up with the idea of a light-detecing, star-shaped RGB LED nightlight for my kids' rooms.
The nightlight can detect if it is in darkness and turn on the RGB LEDs to 50% brightness, and then dim them back to 10% brightness over an hour.
If the nightlight detects it is in light, it will turn off the LEDs which of course, also saves battery life.
The star is 3D-printed and uses a TinyDev ATtiny85 board to control the LEDs, because it has super low power consumption and is only 26mm x 9mm in size, the same width as an RGB strip, but you can of course substitute the TinyDev with any Arduino-compatible microcontroller.
The nightlight runs off 2x AA batteries.Step 1 - 3D Print the Star
Grab the STL of the star and print it out (or design and 3D print any other shape).Step 2 - Gather the Electronics and a Microcontroller
Once you have your TinyDev or other microcontroller, work out which digital GPIO you are going to use for the RGB Strip output and which analog GPIO you will use for the LDR input and adjust the code to use the correct pins.
Now is a good time to upload the code to the microcontroller so you don't have to pull the project apart later to do it.Step 3 - Solder the RGB Strip to the Microcontroller
You now want to solder the VCC, DATA and GND pads on the RGB strip to some wires or header and then solder/connect those to your microcontrolller.
Ideally, if your microcontroller has a 5V pin, connect the VCC of the RGB strip to that, otherwise 3.3V is fine.
Connect the GND on the RGB strip to a GND pin on the microcontroller, and lastly connect the DATA to the digital GPIO you selected earlier.Step 4 - Connect the LDR and the 220 Ohm Resistor
Solder one leg of the LDR to one leg of the resistor and then cover with some heat shrink to both shield and strengthen the connection.
Now solder/connect the other leg of the LDR to the analog GPIO you selected earlier and solder/connect the other leg of the resistor to a GND pin on the microcontroller.Step 5 - Power or Battery
Lastly, decide how you are going to power your nightlight. I used 2x AA batteries in a battery holder, and soldered the wires to the VCC IN and GND IN of the TinyDev.
Depending on your microcontroller, you ay choose to use a Lipo rechargeable battery, a USB cable (be careful how much current you pull from it) or a 2.1mm jack with a 5V power pack.
Note: If you are using your own microcontroller, it's good practice to put a 300-500 ohm resistor between the GPIO and Data line of the RGB strip, and to put a 10uF capacitor across the VCC and GNC connections to the RGB strip.Step 6 - Insert the RGB Strip into the Star
Carefully insert the RGB strip, bending it around the star shape until all of the strip is in the correct place. be careful when bending the strip around the sharper edges to ensure you don't crack or break the strip.Step 7 - Hang It on the Wall
I added velcro tape to my battery pack to stick it to the wall, so it can be removed easily to change the batteries, but feel free to use any mounting mechanism you like.Extra Step: Change Up the Colours or Animations
Feel free to code whichever colours or animations for the nightlight... set specific colours that you like most, or have the LEDs pulse instead or move.. it's totally up to you!
That's it... a quick and simple project that is both useful and amazing to look at, and your kids or family or friends are just going to love it.Hope You Enjoy This Project!
Follow me on: