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. The light is only as bright as you need it.
Start by preparing the ultrasonic rangefinder. Solder the 7-pin female header pins to the through-holes. We'll only be using three of the pins: GND, +5, AN. Wire the rangefinder, leaving enough slack for the sensor to sit on top of the lamp shade. Continue populating the breadboard according to the below pictorial and schematic diagrams.
Copy and paste the Arduino program from GitHub into your Arduino IDE. Run Verify and Upload. If you don't see a lot happening, try covering the LDR sensor. The program is configured to only power the rangefinder in low-light conditions. This value can be tweaked under
// enable distance sensor only if day.
Place the lamp shade over your circuit and thread the rangefinder through thee top. If necessary, use the plastic container to house and center your circuit.
Plug in your Arduino and enjoy...at night.