LithoMenorah

by rabbitcreek in Circuits > Microcontrollers

919 Views, 10 Favorites, 0 Comments

LithoMenorah

lithophane menorah
IMG_7152.jpeg

Well one problem with Hanukkah is that the dates are funny relative to Xmas which always occurs on Dec 25. So you never know when you're supposed to do the things with the candles and then you don't have any of the special candles for that old Menorah that may have gotten lost on the last move. Or like our family one, now resides in a storage unit in a city we no longer live in....it's easy to not celebrate this particular holiday. I went through Amazon and other google options and other than a few funny designs (bicycle...) they all have that creepy patina or that flashback of conflated childhood boredom and dread that stands in for my current belief system.

Time for a new approach and to start building it long before the day we have to use it. Additive manufacturing or 3D printing is the way to go with contemporary religious objects. Im being flip when I say all religions should probably use this wonderful technique for embracing the transient nature of most of our beliefs now. In this design I have eliminated two flaws in the original: the LithoMinorah knows when to start the show and it also sings those prayers that you're supposed to know which are written in encrypted english on the candle box you cannot find. Its design derives from lithophanes which were popular in the 1800's. Carvings of scenes were cast in ceramic and the enclosed candles would produce a translucent picture that nearly disappears when the candle goes out. Here, the photographic 3D print of a candle is multiplied for the holidays and the candles are replaced with LED filaments that are microcontroller controlled. The computer sleeps for most of the year and wakes on an embedded schedule for the next 20 years of Hanukkahs and lights the sequence of lights for the next 8 days before going back to sleep for a year. It has a large battery, a real time clock and a MP3 player with Jack Black singing the blessings over the candles. What's not to light?

Supplies

IMG_7489.jpeg

As with any 3D printed project the quality of the machine you are using makes such a huge difference. I now use a Bambu P1P for printing...perfect.

  1. Xiao ESP32 S3 $7--a super great board that does everything well and lots of great documentation
  2. AW 9523 GPIO expander $5 Adafruit -- great board to extend GPIO numbers with i2c
  3. LithoBattery 2000 mah $5 Only place that will mail these to you is eBay now
  4. Switch On/Off
  5. DFPlayer $9 Amazon
  6. RTC DS3231 Adafruit $17 --You can go generic off of Amazon ($2) but I haven't tried them for the wake up signal...
  7. LED filaments -- Amazon $6 get warm white, 3 volt, many varieties available ... also need a single red one for shamash candle
  8. TIP 120 Adafruit or equivalent
  9. Tiny Speaker 3 Watt 8 Ohm $3

Print Your Parts

IMG_7220.jpeg
IMG_7222.jpeg

The file for the face was too big for the Instructables account so it can be found on Thingaverse: https://www.thingiverse.com/thing:6579585 All the pieces were printed with a Bambu P1 printer. To get the effect of Litho on the face print reduce the speed to 50 on all things, increase resolution to 0.12 and print vertical. Make sure it is 99% solid. Print in PLA Matt---white. The rest of the pieces should be easy to print--only the back case requires support.

Wire It

Image 4-14-24 at 12.17 PM.jpg
IMG_7510.jpeg
IMG_7243.jpeg
IMG_7229.jpeg
IMG_7264.jpeg
IMG_7502.jpeg
Unknown.jpeg

There are four main components of this machine: the microcontroller, the RTC, the GPIO expander and the MP3 player. The AW 9523 expands the number of LED controlled PWM outputs you can have from these limited number of GPIO outputs from the tiny Xiao board. It communicates over I2C along with the RTC. The ports that it opens to control the LED filaments are sunk ground connections so all of your anode filament connections are common and you individually call the grounds to control them from the AW board. So in the fritzing diagram above the basic connection for the two boards (AW and RTC) are the four wires for the I2C (3V, GND, D4, D5). There is an additional alarm wire from the RTC to the Xiao (D3) and a wire to control the MP3 (D1) through the transistor. The transistor is used to control the large amount of power used by the MP3 player to play the song. It has its own connections to the speaker and the power directly from the battery(can't be supplied by the Xiao...). The lipo battery is connected to the main switch and then to the battery connections on the back of the Xiao. It provides charging through the USB-C connection on the Xiao. The battery for the RTC can be replaced with a direct connection to the large lipo battery for back-up, but make sure you take out the coin cell if you do this. The wiring for the AW for the filaments looks complicated but it is just a single numbered black wire to the cathode of each filament. The filaments are numbered 0 through 8 and then 9 is used for the red filament which is additional for the Shamash. The TIP 120 transistor is connected to the Xiao with a 2.2 k ohm resistor through the base (pin 1) to D1 and pin2 is connected to ground of the MP3 player (see wiring diagram of MP3 player) and pin3 is connected to ground.

Build It

IMG_7492.jpeg
IMG_7262.jpeg
IMG_7494.jpeg
IMG_7491.jpeg
IMG_7509.jpeg
IMG_7497.jpeg
IMG_7512.jpeg

The filaments are the only finicky section of the build. You can get them everywhere and they are the innards from the "Edison" bulbs. They consist of tiny strings of LEDs that are enclosed in colored silicon and have cathode and anode metal tabs on their ends. The anode is designated by the tiny hole cut in its tab. They have no current limiting resistors in the strand and they can run on 3V. The AW provides the current limiter so no resistors are needed. These agents are fragile and rigid so if you bend them they're done. Make sure you check and make sure they are all working after you do the wiring so you can replace them prior to sealing the whole case. Do not place these filaments into a clamp of any sort or it will die. You can place a small clamp on the end tab for soldering if necessary. The 3D printed lattice is designed to hold a single filament and its pair of wires. It's opened on the back so you can solder the wires to the filament tabs and then hot glue them into position. The best way to solder them is to place a small bit of solder on each tab and then add the pre tinned wires with a light touch. Hot glue all nine filaments into position in the mid space. The red xtra filament for the Shamesh is tacked next to the white filament for bulb (1). Once you have all the filaments working and in place then solder all the cathodes to their appropriate connections on the AW board (0 through 9) and provide power to the anodes which can all be joined together. Carefully line up the lattice with the face of the menorah so that the filaments center behind the candle and the sides clear the edges of the face symmetrically and superglue it into place. The speaker is super glued over its opening in the back case. The AW and RTC are attached with M2 screws to their holder. The MP3 player is hot glued into its holder in slots. The TIP 120 is hot glued to holder next to MP3 player. The Xiao is hot glued into its holder and the holder is superglued into the opening for it in the side of the case with its USB-C sticking out. The power switch is placed into its snap fit hole in side of case and then wired into the battery. The battery is hot glued into its holder and then super glued to the lattice carefully placing it so it does not encumber the closing of the case. The component mount has two hot threaded inserts (M2) placed and is then superglued to the face plate in back to attach the components to with M2 screws. The placement of the this should be done with appropriate forethought to allow all the wiring to fit as well as the back case. When wiring, the connections should allow for enough spacing so the Xiao can be attached to the case side. The case is superglued to the back of the face plate. The cover is snap fit over the access hole in the back of the case. The wall hanger is superglued to the back of the case. All of the components should fit exactly.

Program It

IMG_7597.jpeg
IMG_7422.jpeg

The software for this project involves the alarm functions provided by the RTC library by Adafruit. It is heavily documented on the web and works well. The RTC is given alarm information from a holiday array which contains month, day, year and unix time for the next twenty years of celebrations. The governing principle is that the software must accommodate the instrument either waking from sleep or being turned on/off at any time in its cycle of days. It could wake in the middle of the eight day celebration or sometime in June. If it's asleep and wakes at the matched time of 19:00 hours at the right day month and year it starts its celebratory prayer song provided by the wonderful Jack Black. (MP3 file recorded/edited from some interview...) It then goes back to sleep for 24 hours and does this for the eight day cycle. If the cycle is interrupted by on/off or other it adapts and finds out where in the cycle it is and restarts. Any time it is power cycled it plays a short version of the eight day cycle complete with Prayer and lighting of all the candles just in case you get bored and want to show the cat something.

The software is well annotated but here is the basics:

Include libraries for RTC and AW.

PrimeIndex is index in array that holds current year of information.

PrimeDay hold the current day of celebration...(1 to 8) they are RTC variables to survive sleep and go back to zero for power switch.

Checks for both AW and RTC and starts them. Zeros out the output from all candles...the AW unit annoyingly starts with everything on.

Checks to see if RTC lost power...if it has you will have to adjust clock. (I have it connected to main battery for backup)

GPIO 4 is initialized to high and GPIO_hold_en holds this pin high during sleep so that the RTC can wake it with alarm.

If primeIndex and primeDay are zero it means the unit has been power cycled and goes to function onPower() which plays the cats entertainment and uses function firstDater() to access primeIndex and primeDay again. If it is time to celebrate it uses function startHoliday() to play the eight days with sleep in between. Total time between candle lights and the flickering time can be adjusted in the variables candleHold and candleTimer in this function. Randomizer uses a simple algorithm for randomizing which candle goes out next. We always used to bet on which one died first...probably the only spontaneous fun thing about the whole process. Unix time is used to access where in the cycle you are relative to months, days years which are hard to parse because of the change in hours and days per month. The goto sleep function takes the time and arranges the correct alarm limits. SeeunextYr function sets the time for the next year wake up call which I arbitrarily made for 7:00 pm at night, but you can easily change this. The flicker functions do just that. They make the candles flicker. Its functions are borrowed from the web. The prayer function allows GPIO pin 2 to go high for the 17 seconds of the prayer to open the gate of the transistor and allow the MP3 player to activate. It then sets it back to low.



Using It

IMG_7297.jpeg
IMG_7154.jpeg

The unit has a large battery and while it could probably last a year without any help I haven't measured its power consumption with the AW and the RTC going. The easiest thing to do is to keep it turned off for most of the year...the RTC runs either on its own coin cell or the big Lipo depending on how you wired it. When November hits you should plug the USB-C in for a day to charge it up and then leave it on until the start of Chanukah and let it do its thing. Make sure you leave the on/off switch in the on position for the Lipo to charge. It will certainly do the eight days without extra power so you can keep it unplugged for the week either on the table or attached to the wall with its hanger. Anytime you turn it on it should go through its lighting sequence and also play the prayer. The MP3 of the prayer should be loaded onto a microSD card and slipped into the player. Modifications can be easily made in the software for your birthday with a separate MP3 file that would light up all the candles and play happy birthday for you sung by my favorite: Biko Wright from Alone season eight on Cameo.