Color Sensing Lithopane Nightlight

Use color sensor and Arduino to change RGB LED for a childs nightlight. Teach cause and effect with colors!

Similar projects worth following

My toddle recently started to learn colors so I wanted to find a fun way to let her have control of her little world and learn colors!

I 3D printed the case that would hold all the electronics using Fusion 360. It was critical to control the light sensor regardless of the room's ambient light. Any stray light or shadow can throw off the color sensor readings, so by making a [somewhat] enclosed case you can ensure proper reading in the dark or light. 

The case also has a convenience USB micro port to connect directly to the Arduino for power (or calibrating). 

I simply drilled 4 small holes in the largest circle of the case and fed the RGB LED through and hooked it up to the 3 digital pins controlling color and the 1 ground. I also wired the I2C ports of the Arduino to the color sensing unit. 

The Adafruit color sensing unit is extremely finicky when it comes to sensing color (hence the importance of controlling stray light). I originally wanted my toddler to hold any color object up, but find a reliable color value was challenging. So, I opted to paint 3 blocks a (Red, Blue, Green) to ensure the color sensor could find the correct color. Id like to add more colors in the future, but for now I'm pleased with the result. 

I utilized  various example libraries to start using the sensor, see example code in the library. The code senses the 3 various return values from the reflected light from the colored blocks. Depending on the 3 values (RGB), the code will digital write to the 3 pins on the RGB LED.  I also hae an additioanl block of code that senses if the RGB values are wildely different than the 3 blocks above, and shuts the LED off (this prevents any weird colors from showing while switching blocks)

Finally, i generated a Lithopane from the following website. 

Image to Lithophane Generator (

If you arent familiar with Lithopanes, this is a 3d printing technique that prints a solid piece of plastic and varies the thickness of the print according to an image's darkness or lightness. The above website allows you to upload your own image and it will generate a 3d printing file of your specifications that can be printed on common desk top 3d printers. I printed the shown lithopane using White PLA plastic ona CR-10s V2. 

Put it all together, and you have a color sensing nightlight that the kids just love. 

View project log

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates