Introduction: Arduino Controlled Model Moon Synchronizes Phase Changes With Actual Lunar Calendar

Picture of Arduino Controlled Model Moon Synchronizes Phase Changes With Actual Lunar Calendar

See it in action.

YouTube Video of Model Moon cycling through lunar phases

The as-delivered Uncle Milton Moon In My Room includes an infrared remote that controls the model moon from across the room. The remote has buttons to turn the LEDs on or off, trigger each progression of the moon's phases sequentially, or set it to slowly cycle through each phase automatically.

This project replaces the remote control with an Arduino Nano and real time clock (RTC) that synchronize the displayed model moon phase with the actual lunar calendar. Based on the current year, month, and date from the real time clock, the phase of the moon is calculated, the Arduino then turns on the right LEDs to more-or-less replicate the real current moon phase. I say more-or-less since the moon only has 6 LEDs, so replication is approximate.

Additionally, this project allows programming when the moon is illuminated (say 9:00 - 10:00 PM) and LED brightness level (0 = off, 255 = full on). The moon's 4 AA batteries and remote control's 2 AAA batteries are no longer needed as the moon is now powered via USB cable. Low current draw enables powering from computer USB port or most any USB wall charger. The USB cable also enables reprogramming the moon's behavior via the Arduino IDE.

You might think of this project as a large (10 inch diameter) programmable night light.

The Uncle Milton Moon in My Room is about $20 from or Add Arduino Nano, Real Time Clock module, plus a few other items you're looking at $50-60 total. The construction is quite simple - just connect the 6 LEDs and RTC to the Arduino and upload the provided sketch (program) -someone familiar with Arduinos and soldering should be able to complete the project in 2-3 hours.

Acknowledgement - This project was inspired by a similar project by Tim. I made some simplifications and modifications.

Step 1: Parts Needed

Picture of  Parts Needed

(1) Moon in My Room from or

(1) Arduino Nano 5 volt model - I actually used an Arduino Nano clone, see link below. It's better if the Nano does not have male header pins soldered to the board ...

(1) Real Time Clock Module

(6) 1/8-Watt, 150 Ohm Carbon-Film Resistors. Radio Shack, DigiKey ...

(1 USB 2.0 A to 5-Pin Mini B Cable - 10 Feet. Amazon, Best Buy ... Note: Since this cable will hang below the model moon, you might want to get one to match your wall color, or paint it to match.

(1) USB Wall Charger. You can also power from computer USB port

Step 2: Build Real Time Clock (RTC) Module Test & Connect to Arduino Nano

Picture of Build Real Time Clock (RTC) Module Test & Connect to Arduino Nano

Build the RTC module per the Adafruit instructions, except omit the 5 pin male header as it's better for this project to just use short wires to directly connect the RTC to the Arduino Nano (see photos and wiring diagram).

Test the module using the Adafruit example code to ensure everything is working correctly - you can set the RTC current time and date and read back date values.

Step 3: Disassemble the Moon, Add Ardunio Nano, Program & Test

Picture of Disassemble the Moon, Add Ardunio Nano, Program & Test

1) Remove and save the 2 sets of screws holding the 3 moon "disks" together. The middle finned disk has a strip on 6 LEDs, cut the LED wires at THE MAIN PRINTED CIRCUIT BOARD (PCB). Also cut the leads from the 4 AA batteries to the PCB, and remove the infrared sensor and the PCB itself.

2) Solder the LED wires and 150 ohm current limiting resistors to Arduino Nano as shown in the photo and wiring diagram. I sandwiched the resistors between two strips of foam tape to prevent them from shorting together.

3) Connect the Arduino to your computer via USB cable and prepare to upload the sketch MoonPhase2.ino. For your first test, making the following edit to the sketch:

1) Around line 65 adjust the if statement so the moon is "on" during the hours of the day when you're running your test, for example, if you're testing around 3:00 PM then... if (h < 14 || h >16)

4) Now upload the program - check that the correct LEDs are illuminated based on the actual phase of the moon for that date (date value from the RTC). To check what the actual moon phase should be, use the link below.

5) Unfortunately, depending on the day of the month, the current moon phase may be such that no LEDs should be illuminated. In that case you can either (1) take it on faith that no LEDs illuminated really means everything is working OK, (2) wait for a better day to test when some LEDs should be illuminated, or (3) manually adjust the RTC date to a fake date when the LEDs should be illuminated. To manually adjust the RTC, see the link below:

Step 4: Final Assembly

Picture of Final Assembly

Once you're confident the electronics and software are working properly, you can readjust the Arduino sketch "on time" hours to what you really want, and begin the final assembly.

First drill a 1/2 inch hole in the lower part of the rear disk, thread the USB cable end through and knot it to provide strain relief (see photo).

Attach the Arduino and RTC using a combination of double-sided foam tape and hot glue. Reassemble the three disks together using the original screws.

Wall mount the moon and attach the USB cable to a power source.



rgrokett made it! (author)2017-01-07

Here's mine (using modified instructions mentioned in my comment below)

rgrokett (author)2016-11-25

Just a note, looks like the manufacturer changed the circuit design of the Moon in My Room consolidating the control circuits directly into the LED strip.

To get mine to work, I had to snip the SMD resistors connecting to each LED, and solder wires there. Also, the LEDs are now connected to +5v line on their circuit board, so I had to connect that to +5v on the Arduino, instead of GND.

I then had to invert the GPIO pin logic to get the pins to go LOW to light the LEDs. (0 = on, 1 = off)

void lightLeds (int L6, int L5, int L4, int L3, int L2, int L1) {

// New (2016-11) "Moon in my Room" requires reverse logic)

digitalWrite (led1, 1-L1);

digitalWrite (led2, 1-L2);

digitalWrite (led3, 1-L3);

digitalWrite (led4, 1-L4);

digitalWrite (led5, 1-L5);

digitalWrite (led6, 1-L6);


...but it does work!

tommo_79 (author)2016-06-23

This is great - its the first time I've come across the moon phase calculator based on date. You've saved me a massive headache figuring out how to automatically set the moon phase!

This is awesome! I've seen that moon light before and I kept thinking I should get it, but now I definitely have to and do this hack!

About This Instructable




More by e024576:Small Parts Rack From Repurposed Chick-Fil-A Fruit CupsMagnetically Attached Small Part BinsArduino Controlled Game: Pong-Bot Vs Human
Add instructable to: