Chanting LED Hanukkah Menorah
In this instructable we will create a chanting menorah for Hanukkah.
Every day we light another candle, this will be done by simply pressing a push button. The middle candle (called shamash - servant) is always lit.
The music is played from a microSD card, through a simple speaker. I used an old PC speaker for that purpose.
Bill of Materials
For this menorah you need:
- Arduino (I used UNO, but nano can be used also)
- SPI Micro-SD card for Arduino (you can also use data-logger shield).
- NPN transistor. I recommend 2N2222.
- 9 LEDs.
- 9 1K resistors.
- 1 10K resistor.
- A speaker.
- Wires.
Wiring Scheme
Wire all together using the attached scheme.
For the microSD card:
- VCC goes to 5V on the Arduino UNO (for power)
- GND goes to Ground on Arduino UNO
- D0 (MISO) goes to pin 12 on Arduino UNO
- D1 (MOSI) goes to pin 11 on Arduino UNO
- CLK (SCK) goes to pin 13 on Arduino UNO
- D3 (CS) goes to pin 10 on Arduino UNO
The push button is connected to an analog input with a pull-up resistor. It is a good solution if you are out of digital pins.
The speaker is connected via a transistor so that the digital pin won't draw too much current. I added the 2N2222 pinout for reference.
Code
To play the wav file I used the TMRpcm library found here.
A lot of forums tell you to put delay in the loop() in order to play, but this is wrong. The library is asynchronous, it means you can play a file and continue executing other code. To do this, write: tmrpcm.play("1.wav");. Then, check if the file finished playing using if (tmrpcm.isPlaying() == 0).
For example, to play continuously, use:
if (tmrpcm.isPlaying() == 0) {tmrpcm.play("1.wav");}
All the code is in the attached zip file. You can also find there the WAV file with a Hanukkah song, I used Audacity to convert it to unsigned 8 bit PCM wav audio, at 16000Hz. I also doubled the playing speed.
Downloads
Play the Menorah
One thing is missing: stop playing on long press. It is not hard to add, I plan to add it soon.