May 29th, 2015
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
- Ikea Vate Lamp from Amazon
- Arduino Uno
- 9V, 250mA or more, 2.1mm center pin positive adapter or other Arduino power supply
- Ultrasonic Rangefinder - LV-EZ0 from Adafruit. Other distance sensors will work but I picked this one for its long range and wide beam width.
- 7-pin female header
- light dependent resistor (LDR) salvaged from a lawn light
- white 5mm dome piranha LED x4 from DigiKey
- 220Ohm resistor x4
- 10kOhm resistor
- small recycled plastic container to mount contents inside lamp
- solid core wire
- Arduino IDE
- A-B USB cable
- wire cutters
- soldering iron
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.
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.
Step 5: Enjoy
Plug the Arduino in and enjoy...at night.