Arduino Controlled Model Moon Synchronizes Phase Changes With Actual Lunar Calendar
by e024576 in Circuits > Arduino
15436 Views, 51 Favorites, 0 Comments
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 Amazon.com or Wlamart.com. 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.
Parts Needed



(1) Moon in My Room from Amazon.com or Walmart.com
http://www.amazon.com/Uncle-Milton-Moon-In-Room/dp...
(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 ...
http://www.amazon.com/gp/product/B00ASSQ9S6/ref=wm...
(1) Real Time Clock Module
https://www.adafruit.com/products/264?gclid=Cj0KEQ...
(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
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).
https://learn.adafruit.com/ds1307-real-time-clock-...
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.
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.
http://stardate.org/nightsky/moon
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:
Downloads
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.
Enjoy!