Moon Phase Zodiac Display, Indicating Black and Blue Moons
by pgeschwi in Circuits > Arduino
119 Views, 1 Favorites, 0 Comments
Moon Phase Zodiac Display, Indicating Black and Blue Moons
It started out with just an attempt to build a moon phase display a couple of years ago. I used the original design from 'G4lile0' and also posted my variation of the project which had the zodiac signs added. This was five years ago and it was time to add a couple of features I always wanted to include.
My wife got the idea to add the zodiacs around the moon. Allowing a decent size of zodiac symbols required an increase of the moon shell. The display is now 12in (300mm) in diameter. If your printer has a typical 200x200mm bed, you can cut the back-plate in three sections (four segments each) which will fit on a smaller print bed. All other parts are fitting the smaller print beds.
In this version, I added a couple of features which are astronomically irrelevant, but may be appreciated by others.
- Zodiacs as we use them in the western system, based on fixed dates.
- Zodiac position of the moon.
- Calculation of black and blue moons
- Monthly black/blue moons (second new/full moon in the same month)
- Seasonal black/blue moons (third new/full moon in a season with four new/full moons)
- All calculations are based on: Jean Meeus "Astronomical Algorithms" second edition
As shown in the main picture above, the sun zodiacs based on date are white, the moon zodiac position in blue. The moon zodiac takes about 2.5 days to move to the next sign. If the moon and sun zodiac are occupying the same slot, the sign will fade briefly from white to blue and back every 15 seconds. I added an LDR to adjust brightness following ambient lighting.
Showing blue moons is simple, just change the full moon from white to blue. A seasonal blue moon will show a slightly checkered pattern. For distinguishing between ordinary new moons and black moons, I keep the moon mostly dark besides fading in/out a partial pattern every 15 seconds. If someone has an idea how to indicate black moons in a better way, I'd love to hear your ideas. Images of these patterns are shown in the last chapter of this instructable.
I did not make these patterns adjustable via a settings menu, but that's not difficult to do in the code. I will outline the major parts in the sketch later.
Supplies
- Access to a 3D-Printer, ideally with a 300x300mm bed (12in). The only bigger part to print (holder for the zodiac signs) could be divided into three parts suitable for 200x200mm (8in) printer beds.
- Access to a laser-cutter/engraver for the zodiac signs
- 5mm acrylic sheet, about 1.5 letter sized sheets
- E6000 glue or similar to get PLA plastics stick to another
- Soldering Iron, thin electronic solder
- 24-AWG magnet wire (⌀ 0.5mm) or other suitable cabling. I prefer magnet wire over the classic insulated version due to its thin insulation and ease to work with.
- A 10 kOhm resistor
- LDR, common type.
- Two 100uF capacitors for buffering power spikes
- LED-Strip WS2812B with 30 LEDs, spacing 30LEDs/M, preferably black PCB, but not a must.
- USB cable (I used a 6ft white) and wall wart or other methods to feed 5V to the display. Max consumption is about 1.6A, so please use one which can deliver 2A. There are still 'special offers' which can deliver just one Ampere, these may cause flickering and at times causing odd LED behavior.
- An ESP32 board, literally any you may have in the drawer. My build uses an ESP32-C3 mini, the cheapest version of the ESP32 series.
- OLED display, 128x64
- Real-Time-Clock with NVRAM
- Rotary Encoder with button
Parts and Preparation
First we need the individual parts printed. The main LED holder and the back-plate holding the electronics are printed in black. The color is not important as these parts are not visible from the front while hanging on the wall. If you decide to print the LED-holder in white, I could imagine that there will be more light bleeding between the six compartments of the moon in the center (which could be desirable). Printing these parts requires support. For the LED-holder, you can disable support structures for the inner dome and the LED-Strip entry holes.
Color choice for the ring holding the acrylic zodiac signs is your choice, I used a silk-silver filament for a metal-like touch. This part is being printed upside down from how it is shown in the Tinkercad model. This reduces the need for support drastically and results in a nicer finish for the visible parts.
I used silk-white for the moon dome, adding a nice shine to the illuminated parts. I think plain white works, but makes the appearance a bit dull if you used a silky filament for the zodiac ring. The model for the moon is not hollow, so it needs some changes in the printer settings. I tried just spiralizing the print, but that caused lots of gaps in the top part. The best setting I found is as follows:
- Layer height 0.1 mm (the smaller, the more consistent wall thickness, but 0.1 did the job for me)
- No bottom layer
- No support
- No infill
- Combing: Not in skin
We need 12 of the thin back covers for the zodiacs. You could cut somewhat thicker paper with your laser cutter or print the segments in any color you prefer. You may want to stay with darker colors for better contrast.
The STL files are attached below and if you like to remix these, I published these in Tinkercad here. I arranged the parts in an exploded view with some remarks.
The zodiacs are laser etched and cut. I used 5mm acrylic sheets and grouped the 12 zodiacs in four groups of three. This way these can be handled by smaller machines as well. The slits in the zodiac ring towards the LEDs are 5.5mm high which should accommodate slight variations in thickness. Etching is done on the back side, so the SVG files are mirrored. Once these are cut, try not to file the edges unless needed. Frosted edges are causing a bright shine around the segment when lit.
Placing LED Strips and Wiring
Placing the LED-Strip on the main holder requires six strips with three LEDs each (six moon compartments) and one strip with 12 LEDs for the zodiacs. (Total of 30). These will be wired as a single strip, moon segments first from right to left when viewing from the side with the dividers. (top-view image) I added a marker in the center of the dividers to make placing the strips easier. Make sure you place these in a zig-zag pattern starting (D-in) at the bottom right (bottom view image showing the notch pointing up). The ends of each strip are tucked into the slits at the upper and lower end of each compartment. The ends can be bent and fixed on the inside, but will possibly detach again as the remaining length of the strip is barely enough to keep it attached. No problem if these detach later as there is no danger of any shortcuts, we got plenty room. Starting with 'D-in' at the bottom right (top-view, divider side) will place the 'D-out' of the moon segments on the bottom left, close to the begin of the 12 LEDs for the zodiacs. If you mixed this up, no biggie, the only thing changing is that the distance between the moon segments end and the begin for the zodiacs is longer. No need to rework everything.
Attach the LEDs for the zodiacs starting with 'D-in' as outlined in the 'bottom view' image in direction as shown by the arrow. Align the LEDS with the V-shaped grooves. If they are a little off, no problem, but deviating too much will impair even illumination of the zodiacs. I think the images above are showing this in great detail.
Wiring is pretty straight forward. All intermediate 'D-out' will be connected to the next 'D-in'. GND and +5V can be connected as you like and do not need to follow the exact sequence. I simply bridged all GND connections on one side of the strips, same for the +5V tabs. To fix the magnet wire in place, one can simply push these into the plastic using the soldering iron tip where needed.
There is also one of the 100uF capacitors, about in the middle of the entire string, right at the beginning of the zodiac LEDs. The images should show all important details.
Processor, RTC and OLED
Start with mounting the rotary encoder and glue the OLED display in place. On the backside, fix the RTC and ESP board with glue. I did not add any holders for these, there are many different variations of these boards. There is an issue with the particular RTC board I used. It is intended to use LIR2032, the rechargeable version of the famous CR2032 battery. the charging circuit (a simple diode and resistor) is constantly overcharging the LIR2032 and will kill it within a couple of months - DUH!!!
There are two ways to fix this:
- Either remove the diode or resistor and use a CR2032 instead. This will keep the RTC running for several years, like the BIOS battery in your PC. It may make sense placing the battery holder on the outside of the backplate for easier access.
- I replaced the battery holder by a 1.5F supercap which I had lying around. This one has no issue being constantly charged and no need to have access to the battery.
The wiring diagram is straight forward. RTC and OLED-Display are sharing the I2C bus, a few more wires to the rotary encoder and LDR. The small size of the ESP32-C3 allows using a standard USB3 cable. If you use a different ESP32 like the common WROOM DEV-Board, pin numbers are different but this is all documented in the sketch. Just change the matching '#define' statements. More about the sketch later.
Wiring LED Holder and Backplate
There are three wires for the LEDs: GND, 5V and Data plus two wires for the LDR. The LDR will be connected to 'Pin 0' and the 3.3V board connection.
You can connect the LDR to 5V as well, but there is the danger that the analog input may go higher than 3.3V possibly killing the input pin or eventually more. If you do so, please check if the max voltage LDR/Resistor combo will stay below 3.3V at max lighting. You may also need to adjust the limit and mapping statement on line 309/310.
Now you can put the backplate on and fix it with the three screws. You may need to drill the backplate holes a little wider to allow the threads to go through. Make sure the screws are not longer that 8mm (3rd of an inch) because they may cut into the LED strips. I should find a better placement for these and use dedicated studs.
Some Details About the Sketch
The zodiac signs haven't been mounted yet, but I think it is easier to handle the display if these are not tucked in. We still need to mount the moon dome. I don't want to say these are just cosmetics but for uploading and LED functionality tests, these are just not helpful if we need to fix things.
Since this is a project with boards from the ESP32-family, I presume everybody has some experience with either the Arduino IDE or Visual Studio Code.
We need a few libraries, which I guess most may have installed already. Just try compiling the sketch and the IDE will bark about those missing ones.
U8g2lib.h -> Text and Graphics for the OLED
Wire.h -> I2C Library
RTClib.h -> RTC and NVRAM
FastLED.h -> NEO Pixels
ESP32RotaryEncoder.h -> Rotary and button handling
TimeLib.h -> for time and timezone calculations
The following lines may need adjusting if you are using a different board than the ESP32-C3:
line 103:
line 109:
line 112:
line 115:
I added a couple of time zones for USA, UK, Europe and UTC. If you like to add others or remove those you are not going to use, modify the 'TZdata' array. A description of the array format and its fields starts at line 147.
You can add/remove entries in any way, no need to keep track of the array size. The summer/winter time switching time/dates are defined in Posix format. The description in the sketch has some reference links as well.
Some general remarks about the sketch:
All astronomical calculations are based on UTC, so the RTC is running on UTC as well. The display is showing the local time based on the timezone rules. This works fine for calculating dates for new and full moons, but may have some impact for blue and black moons. The average moon cycle is 29.53 days and squeezing two new/full moons into a month does not allow lots of wiggle room. So it could be that based on UTC a full moon is falling on the 1st of a month, but for me in US-Central (-6h), the full moon in local-time falls on the last day of the previous month and could be mistaken as a second full moon in the same month. I don't think anybody will be watching the OLED display on the back too closely, but if you like to avoid these occasional display issues due to time zones, you may want to set the timezone to UTC. For comparison, there is a new/full moon calculator for us stargazers at 'stellafane' and comparing the calculations with this website, the ESP32 is inside +/- 20 minutes.
The idle display is showing dates only. The debug output via the USB-serial link is showing the exact local time from the calculations for the next for quarter moons and the upcoming black/blue moons. Calculations are done once per minute. While in settings mode, calculations are triggered immediately with every change to update the OLED display.
For settings to survive a restart, timezone, color mode and display brightness are stored in NVRAM.
Basic operation:
Once you have uploaded the sketch, the display will be active for 60 seconds before being switched off. These OLEDs do not have a long lifetime and there is no reason keeping it on while facing the wall so to say. Any motion of the encoder will revive the display until it's running idle for 60 seconds.
- Navigate between menus with short press.
- For entering settings (except idle screen) use long press, release when blinking setting box appears.
- Adjust value with rotary encoder. Jump to next setting with short press.
Let's do a lamp-test to see if all LEDs are working as intended. Press the encoder button a few times until the 'Config Menu' for brightness and Moon mode appears. Hold the button down to enter settings mode and a box is blinking on the brightness setting. Adjust by turning the encoder button. A single click will advance to moon mode. Moon modes are:
Simple white moon-phase and zodiac, no colors (setting: phase)
Adding black/blue moon display and moon zodiac position (setting: color)
Three demo modes for Halloween or other parties or just demo (settings: Demo 1,2,3)
Lamp test (setting: Full)
If all LEDS are working, you're good to go inserting the zodiacs and back covers as well as attaching the moon dome.
Downloads
Moon Dome and Zodiac Segments
The moon dome will simply be glued into place. When attaching the LED-holder to the zodiac ring, you may have noticed, that the LED-holder is about 1.5 mm above the Zodiac Ring. This makes sure that the moon dome is equally spaced from the LED-Holder dividers. Just add glue around the rim as shown in the image above. Once in place, turn the display upside down to slide in the zodiacs. To make life easier, find something round (a pot, large mug), a bit smaller than the moon diameter to hold the display for you. Some cushion works as well.
Slide in the zodiacs, starting from any segment you want. A good starting point is the LDR at the bottom of the display. Looking at the back-plate, the first zodiac sign counter clockwise from the LDR is Aquarius. Capricorn is its neighbor on the other side of the LDR. Last thing to do is placing the back covers. I prefer the glossy side on top, the rough side facing the acrylic zodiac segment (avoiding a slight mirror effect). Fix all with a dab of glue at the four corners each. Don't use watery superglue, this will run in between the edges and may cause a foggy residue.
Display Pattern
Finally, here is the answer to what you will see when there is the proverbial "once in a blue moon" event.
A blue moon happens about every 2.5 years but there are exceptions. About every 20 years there are two blue moons in a single year. The last time this happened was in January and March of 2018. Similar intervals are true for black moons. Then there are the seasonal black and blue moons which are the third of four new/full moons in a season between solstice and equinox or vice versa. The images above show the various patterns.
For black moons I added a pulsing pattern showing every 15 seconds. I tried to do this in a smooth way, so it will not be annoying. I also used a less intense color. If you like to change the frequency , change the interval in line 1082. The default frequency is 15 seconds (15000ms)
Changing the color hue is in line 1085
A similar construct is in place for the case when the moon zodiac and the sun zodiac are on the same segment. The white sun zodiac will briefly change to blue every 15 seconds. The timing for this part is in line 980.
One word about the sun zodiacs which are on fixed dates: These had been set about 2000 years ago and have shifted for about one sign. This is caused by the earth's wobble which takes about 26000 years for one revolution or about 72 years for one degree. This makes no difference in a lifetime, but over two millennia, it's about 26 days. I do not want to join the discussion if these dates should be abandoned/changed, it's just the curiosity that over such time frames, everything is a little bit in motion.
I hope you enjoyed this instructable and please let me know if there are any parts which should be reworked/edited and if you got better ideas for the various patterns or additional features.