Introduction: Lunar Phase Clock

Picture of Lunar Phase Clock


In this Instructable we will be building a dynamic lunar lamp with the Raspberry Pi. With your very own lunar clock you'll always know the current phase of the moon, no matter the weather!

Step 1: History and Theory

Picture of History and Theory

Budding astronomer? Recently bitten by a werewolf? Whatever your lunar-phase-knowing needs, the Lunar Phase Clock has you covered! If you're interested in getting started on the build, move on over to the next step. Here we'll talk about the astronomy behind the project.

So what are the phases of the Moon?

Just as the Earth orbits the Sun, so too the Moon orbits the Earth. The Moon is tidally locked to the Earth, which means that because the Moon completes its own rotation in the same time it take to orbit around the Earth, we always see the same side of the Moon. While we may be stuck to the same view of the Moon, the relationship between the Earth and Sun as the Moon completes its orbit is constantly changing. This means that it will be illuminated to varying degrees (or not at all!) and will take on a distinct shape. These distinct shapes are what we refer to as the lunar phases. The Moon completes a cycle around the Earth every 29.53 days; this is referred to as a synodic month.

Step 2: Materials

Picture of Materials

Materials:

Raspberry Pi (RadioShack #277-196)
SD card
protoboard (RadioShack #276-168)
(2x) LED strip (RadioShack #55065456) web only
(8x) n-channel MOSFET (3V3 Gate-Source level or lower) Mouser
(8x) 10K resistor (RadioShack # 271-1126)
12V AC adapter (RadioShack #Catalog #: 273-318)
USB wifi adapter (RadioShack #55044156) web only
USB power supply (RadioShack #55075817) web only
Micro USB cable (RadioShack #26-2738)
22 gauge wire (RadioShack #278-1218)
(2x) 4/40 nut (RadioShack #64-3018)
(2x) .75" 4/40 machine screw (RadioShack #64-3011)
(4x) 2" 6/32 screw
(4x) 6/32 nut
plywood

Step 3: Configuring the Raspberry Pi: OS and Networking

Picture of Configuring the Raspberry Pi: OS and Networking

For these next steps, you'll need to have the Raspberry Pi set up with an operating system and hooked up to a full keyboard/mouse/HD monitor setup or connected to a computer via SSH. Click through the link below to see my brief companion guide for setting up the wireless connection Netgear Wi-Fi adapter. This guide also includes a link to a great Instructable for setting up the Raspberry Pi. Since the RasPi doesn't have a hardware clock, we'll be using the internet as a consistent time source. We'll also need to install a few things in order for us to use the GPIO on the pi. Setting up an internet connection varies depending on how your network is set up. For this Instructable, we'll be using a wireless connection via USB.

Connect the Raspberry Pi to the NetGear G54/N150

Step 4: Configuring the Raspberry Pi: Python Program

Picture of Configuring the Raspberry Pi: Python Program

Initially, I had considered having the moon-clock pulling the lunar data from the internet over wifi, but as luck would have it, there's an algorithm for calculating the current lunar phase for a given date. Math to the rescue! I found the algorithms here. The particular algorithm we'll be using was written by John Conway, whom you may know as the person behind the cellular automata program "Game of Life." The lunar phase algorithm was written in java, but it was not too difficult to translate this over to python.

Before we can run the Python program we'll need to install the GPIO library and developer headers.

Type the following into the terminal:

sudo apt-get install python-dev

sudo apt-get install python-rpi.gpio

We'll need to install and run the Python program as soon as the Pi boots up. Download the attached program "moonlight.py" and copy it over to the Pi. Make sure it's in the directory "/home/pi" (some info on moving the program over)

We'll make the program into an executable with:

sudo chmod +x moonlight.py

Next we'll need to open up another file. Type in:

sudo nano /etc/rc.local

Comment out any text below by putting a "#" at the start of the line. Below the text type in:

sudo python /home/pi/moonlight.py &

Hit ctrl+x to save and then "y" to confirm the changes to the file. Now when the Pi boots up our program will run automatically.

Step 5: Build the Circuit: Design

Picture of Build the Circuit: Design

Here is the schematic for our LED driver board. We're using N-channel MOSFETs to connect the 12V powered LEDs to ground. I chose N-channel MOSETSs as this setup has logic "high" pulses from the Pi activating the lights, which was more intuitive to program.

Step 6: Build the Circuit: MOSFETS

Picture of Build the Circuit: MOSFETS

Space the MOSFETs evenly on the circuit board all facing the same direction.

Step 7: Build the Circuit: Resistors

Picture of Build the Circuit: Resistors

Bend the leads of the resistors over so they'll fit into two adjacent holes on the board. Place one resistor from the gate pin of the MOSFET (the leftmost pin when looking directly at it) to the power bus in the middle of the board.

Step 8: Build the Circuit: Terminal Blocks

Picture of Build the Circuit: Terminal Blocks

Place the terminal blocks along the edge of the board so that one of the pins is aligned with the drain pin (middle pin) of each MOSFET.

Step 9: Build the Circuit: Wiring

Picture of Build the Circuit: Wiring

Using the clipped leads of the resistors, make tiny jumpers with a pair of needle-nose pliers.

Step 10: Build the Circuit: Light Strips

Picture of Build the Circuit: Light Strips

Unroll the LED spool and cut the strip into 16 pieces of 3 LEDs. The strip has copper pads every 3 LEDs for power and ground.

Step 11: Building the Frame: Design

Picture of Building the Frame: Design

The Lunar Phase Clock is made of stacked sheets of laser-cut plywood for the body and the base. I designed the frame in Illustrator and used an Epilog 120 watt laser to cut out the pieces from 1/4 inch ply and 1/8 inch acrylic. The body plates are stacked together with segmented ribs that organized the light into eight distinct segments. This gives us enough resolution to display the main phases of the Moon. The LEDs lay flat along the back panel and shine light through a sheet of paper that has an image of the Moon printed on it. The paper acts to diffuse the light for more gentile progressions as the segments light up. The body is held together with 4 screws along the top rim. This allows it to be easily disassembled if the LEDs were to be damaged or the face replaced.

The base of the clock is made of three stack pieces of ply that have slots for the body to slide into. The holes are designed with tight tolerances so that the body and base can be held together with a "friction fit." The quarter-circle edge pieces serve to support the weight of the body and hide the wiring and electronics from view.

Download and cut out the attached .ai files.

"MoonFrameComplete" should be 1/4 inch wood. (Note that the ribbed piece should be cut out three times)

"MoonClearPlates" should be 1/8 inch clear acrylic.

Step 12: Glue the Frame

Picture of Glue the Frame

Lay the three base pieces out on a large surface. With course sand paper, remove the unsightly laser burns and charred sap from the edges. Making note of the proper layout, flip the two top pieces over and coat with wood glue. Lay the middle piece upon the base, using the finger holes as a guide to properly align them. Lay the top piece upon the middle plate, using the large rectangular body slot as a guide. Clamp the base pieces together and allow to dry for 24 hours.

Step 13: Moon Graphic

Picture of Moon Graphic

Print out the attached Moon graphic and cut out along the white line. Place the new piece between the two circular pieces of acrylic.

Step 14: Finish the Frame

Picture of Finish the Frame

Lay the solid base plate down with one ribbed piece on top. Using a pencil, outline the inside segments; we'll use this as a guide for properly placing the LED's.

Take the eight elongated LED strips and fish the power wires through the holes near the middle of the base plate. Bend the white wires between each segment so that the strips follow the curves of each segment. Glue the underside of the strips in place.

Place the next two ribbed body plates, followed by the plates with the hole large enough for the acrylic circles. Place the acrylic containing the Moon shape into the body, using the straight edges of the paper to properly align the Moon with the edge.

Place the face-plate over the acrylic sheets. This holds them in place and covers the edges of the paper. Fasten the panels together with the 2 inch screws.

Step 15: Mount Electronics

Picture of Mount Electronics

Mount the Raspberry Pi over the two left holes with the 4/40 screws. Attach the wires from the strips to the driver board, referring to the schematic on step 7 (The leftmost wires while facing the back are attached to the lowest pin number).

Step 16: Power Supplies

Picture of Power Supplies

Cut off the plug of the 12 volt power supply and plug the wires into the terminal block of the driver board.

Plug the micro USB cable into the Pi and the USB adapter. Plug in the 12 volt supply into the wall.

Step 17: Finishing

Picture of Finishing

The Lunar Phase Clock is fine and dandy on its own, but a touch of color could certainly improve upon its laser-cut appearance. I decided to give my clock a dark stain and a few coats of polyurethane to seal it in. There's lots of open flat panels to coat, so it would make a great canvas for some custom artwork too.

Comments

Lendss (author)2015-05-10

Great instructable man! This is my version, made with Arduino!

sleepingseva made it! (author)2017-09-02

Great instructable! I added an LCD display to show the moon phase along with the next time that the full moon will occur. Also the moonlight.py does not calculate the current moon phase correctly so I had to find another source.

tamosan (author)2017-01-04

Excellent job bro.

ZacharyG13 (author)2016-02-14

I really appreciate this instructable. I've made everything but it seems I might have used the wrong transistor. I am only getting about 6.2V out. I'm using the IRF840 "IR" Power MOSFET N-Channel 8A 500V. The link to the transistor is dead. Am I supposed to be using an IRF510?

MicioGatta (author)2014-09-19

Beautiful.... a dream....

Fission Chips (author)2014-09-04

Whoa. Really cool! DJ, you are very smart and this is an awesome project.

veryvexing (author)2014-08-15

Am I blind or are the dimensions for the plywood not listed? I'm only afraid to do this project because of the woodwork needed.

Aleator777 (author)veryvexing2014-08-15

Theyre not explicity stated since it was orignally cut with a laser. If you download the vector files on step 11, you can see the dimensions when you open them up. Send me a message if you need anything else!

mojoatomic (author)2014-07-15

Outstanding!

mswope (author)2014-06-15

Not to be an ass about this, but your original parts list on the first page doesn't mention the terminal blocks... They do make for a nicer install.

spylock (author)2014-06-05

They sell a lunar phase nightlight at Chinamart,as well as the other warehouse type stores.Its a little larger than this design,but what I was getting at is you could take the electronics out of the nightlight,and put them into his design which is a lot more pleasing to the eye,the nightlight can be programmed with the true moon phase,and they even have a remote for around $11.00.

Aleator777 (author)spylock2014-06-06

Cool idea! It could definitely be made with other such parts. This clock does show the true moon phase already though.

spylock (author)Aleator7772014-06-07

Right,all I suggest was using the guts out of the Moon phase light in the making of
his design.Like I said,the night light has all the LEDs ready to install in his design and with the remote that comes with it,one can program it to do true moon phase,or go through them fast,or whatever.It would make it easier for those who would like to do this Able without having to do any of the electronics.

Robibame (author)spylock2014-06-05

two things. First, great thought on using the ready-made lunar clock..... and second thing... I laughed pretty hard at the word Chinamart. ..... much better than WallyWorld.

spylock (author)Robibame2014-06-06

No doubt bro,I would like to know how may Made in America items they have in any given store,not including food items I would bet no more than a couple dozen,what do you think?

jtetreault2 (author)2014-06-03

Love it,.. Sadly not many of us have a laser cutter readily available... Ever consider offering the parts as a "diy kit". For a reasonable price I'd love to be able to build this. Also just a thought adding into the algorithm a way to calculate lunar eclipse's and add some red LED's to activate at the eclipse to give the proper coloring.

Robibame (author)jtetreault22014-06-05

I dig your idea of the red LED's for during an eclipse. that would be too cool ..... as for the use of laser cutters.... you could use a reciprocating saw, or some sorta' LARGE hole-saw (the can shaped bit put in a drill to cut door knob holes etc.) to cut the hole in the wood body of the clock... then for the curved ribs within the hole you could carefully bend some cheap aluminum angle-iron. aluminum strips are pretty cheap and can be found at most hardware stores or farm supply stores. :)

Johnkaye (author)jtetreault22014-06-03

This is an amazing and ingenious project. Using lights and no moving parts to indicate the moon's phases is awesome. At 65 years of age comments like jtetreault2 left do sadden me. I have made projects from wood, metal, glass and paper for most of my life long before laser cutters were invented. At its most basic the clock case is a woodworking project that can be constructed by hand with simple woodworking tools and time. At one time the worth of a project was judged by the hand work and craftsmanship that went into it. Today it is more the idea and the programming skills that are admired. Nothing wrong with that but let's not forget that many projects can still be made without a laser cutter and CNC machine.

jtetreault2 (author)Johnkaye2014-06-05

It saddens me too... My grandfather was a carpenter / cabinet maker... Sadly he passed before I was old enough for him to pass on any of his knowledge in that field to me. I'm going to try but lacking the knowledge and skill it's going to be hit or miss i'm afraid.

Aleator777 (author)Johnkaye2014-06-04

Wow, thank you very much! Yes, this most certainly could be made using traditional woodworking techniques. I had a rather short timeline to build this, so I turned to the laser cutter. There are definitely many other ways it could be made!

Aleator777 (author)Johnkaye2014-06-04

Wow, thank you very much! Yes, this most certainly could be made using traditional woodworking techniques. I had a rather short timeline to build this, so I turned to the laser cutter. There are definitely many other ways it could be made!

Aleator777 (author)jtetreault22014-06-03

True. Really, as long as you had some stiff material like thin sheet metal, or even cardboard to bend as dividers between the light segments behind a round face, it could work just the same. The outer body is arbitrary. Eclipse mode would be a cool feature!

Robibame (author)2014-06-05

that is freakin' cool.

Jan_Henrik (author)2014-06-04

Wow, im very impressed!! It looks awesome!

boocat (author)2014-06-03

I love this! Very cool family project.

Eunix (author)2014-06-01

This is such a cool concept! Of course, it would have been cooler if the moon was in 3D... But still, great project!

psavas (author)Eunix2014-06-03

Might not be too hard to do, really. I think software exists to take a 2D photo and create a 3D printable model from it...

jtetreault2 (author)2014-06-03

Looks like the NASA web site even tells you the specific times for each phase of the eclipse, so just adding a red led to each segment and some logic to the program to light and sunlight them at the proper times and you could watch the eclipse progress... I think I'll play with it and see what I can come up with.

Constructed (author)2014-06-02

Amazing.

Jdsardone (author)2014-06-02

Awesome Clock!

I wonder if you could use a large magnifying glass lens instead of acrylic to give a 3D round appearance to the moon.

Aleator777 (author)Jdsardone2014-06-02

Thank you! Ooh, good idea. That would look great!

iamtar (author)2014-06-02

This is a really great tutorial but I only have a ardunio board.... is there anyway to make it work with that or should I just buy the pi... I'll try in the mean while to see what I can do to make it work.

Aleator777 (author)iamtar2014-06-02

This would work great with an arduino. You'll need to convert the python code to arduino style c++, but it shouldnt be too bad. A simple rtc like the ds1307 for timekeeping will work too. Since the algorithm measures units in days, slight innacuracies in the time keeping shouldnt have a noticeable effect. Post a photo if you do!

doodlecraft (author)2014-06-01

Speechless! This is amazing and beautiful! Great work! :)

wliu3 (author)2014-05-30

Think the correct from the rpi is big enough to drive the LEDs. So why are you using the mofsets?

Aleator777 (author)wliu32014-05-30

The RasPi pins can only source a few mA each. The led strips need ~300 mAh each.

wliu3 (author)Aleator7772014-05-30

I see. But I was told that those mini LEDs only need ~40mA. Do they work well in this application?

Aleator777 (author)wliu32014-05-31

I think so. They're quite blidingly bright to look at directly.

salexandridis (author)2014-05-30

Great idea for a project! Really like how well the light is diffused! Btw, you can replace the back acrylic sheet with a white one for even better results.

Aleator777 (author)salexandridis2014-05-30

Thanks! True, I didn't have any on hand, but it would be worth trying. I've been thinking about making a mini one...

craftclarity (author)2014-05-30

I really like the stain you used. Along with the brass fasteners, it has a sort of ship's-clock atmosphere.....

Aleator777 (author)craftclarity2014-05-30

Thanks, I was definitely aiming for that aesthetic :)

rimar2000 (author)2014-05-30

Very interesting idea, well done.

liquidhandwash (author)2014-05-30

that is real cool

It looks awesome! Great to see it in action!

amandaghassaei (author)2014-05-30

Sooo good!

About This Instructable

105,821views

1,005favorites

License:

Bio: My name is DJ and I previously made electronic whatsits, 3D-printed thingamabobs, and laser-cut kajiggers for the Instructables Design Studio; now I build and repair ... More »
More by Aleator777:MiniSub ROVBasics of Thermal ImagingMiniature Autonomous Blimp
Add instructable to: