A Smart Night Lamp for Kids

Smart Night Lamp for Kids

Few weeks ago I heard my nephew (aged 7) complaining of the dark at night. Basically he was afraid So I decided to put knowledge into practice and build a night lamp for kids. Since the project was intended for kids, I thought of making the lamp change color every now and then. It should also be sensitive to light so that if the room is well lit, the lamp would remain off.

For this project Arduino Uno was used.You can use any other Arduino instead, and all should work fine.




So basically the idea was that as a first, the lamp should be switched on only when the photo-resistor reading goes below a certain threshold, meaning that the ambient light went down considerably; secondly the lamp should change color at certain intervals. That is why an RGB LED was used.

The Photo Resistor or Light Dependent Resistor (LDR) is a resistor which decreases its resistance when exposed to light. This means that the more light the LDR receives the more current passes through it and through the Arduino pin which is then read by the Arduino. The Resistor connected in series with the LDR serves to limit or increase the range of the LDR sensitivity to light. A 10kOhm resistor is a good choice to read ambient light but not if the LDR is exposed to direct sunlight, and also not good for low light conditions because the values saturate rapidly in these extremes.

The code is self explanatory but I will outline some points here. Remember that this sketch needs to do 2 things, first check the LDR for ambient brightness, if the ambient brightness is less than the ‘darkThreshold’ variable (which obviously you can tweak) the LED is lit by choosing 3 random values for the Red, Green and Blue pins. The ambient light is read every second so for example if the suddenly you switch on the room’s main light the LED would turn off almost instantly. The LED color changes every ‘changeColorTime’ in milliseconds. By default it is set to 900000 milliseconds equivalent to 15 minutes (as usual feel free to play with these figures).

For more detail: A Smart Night Lamp for Kids

Scroll to Top
Read previous post:
raspberry pi vpn access point setup a basic vpn router
Raspberry Pi VPN Access Point: Setup a Basic VPN Router

In this Raspberry Pi VPN access point tutorial, we will be exploring how to setup a VPN for use with...