Youtube Twitter Pinterest Instagram GitHub

Moonlighting Lamp

May 29th, 2015

Moonlighting Lamp

The Moonlighting Lamp is a glorified nightlight that changes brightness based on proximity. Most nightlights use a motion sensor to detect someone's presence and abruptly turn on. The Moonlighting Lamp uses a proximity sensor to detect someone's presence and calmly illuminates as they approach. If you're like me and can't stand those abrupt nightlights, this lamp is for you.

Step 1: Materials + Tools




Step 2: Assemble the Circuit

Begin by preparing the LV-EZ0. Solder a 7-pin female header through the holes. We'll only be using 3 of these pins: GND, +5, AN. Populate the breadboard according to the below pictorial diagram and schematic. I used a breadboard and jumper wires as opposed to soldering the components to a through hole board because of the circuit's simplicity. When wiring the LV-EZ0, use long enough wires so that the sensor can poke out the top of the lamp shade.

Pictorial Circuit

Schematic Diagram

Actual Circuit

Step 3: Upload the Code

Connect your Arduino to your computer. Copy and paste the linked code into your Arduino IDE. Run Verify and then Upload. At first glance, not much might happen. Make sure the LDR is covered and then try testing the circuit. The Arduino is progrmamed to only power the distance sensor in low-light conditions. This value can be tweaked under

enable distance sensor only if day


Step 4: Hide the Circuit in the Lamp Shade

Carefully stuff your lamp shade with the assembled circuit. Be sure to thread the distance sensor through the opening at the top. Connect your Arduino to its power source. Lastly, insert your recycled plastic container mount to rest the circuit on and center the LEDs.

Hidden Circuit

Step 5: Enjoy

Plug the Arduino in and enjoy...at night.

Moonlighting Lamp

Moonlighting Lamp