WiFi-Enabled Arduino Hanukkah Menorah: Automagic Candle Lighting at Sunset
by Novysan in Circuits > Arduino
49 Views, 1 Favorites, 0 Comments
WiFi-Enabled Arduino Hanukkah Menorah: Automagic Candle Lighting at Sunset
Every year during Hanukkah, families light the menorah (or chanukiah) for eight nights, adding one candle each night after sunset. But what if your menorah could light itself at exactly the right time, with exactly the right number of candles?
This project combines tradition with technology to create a WiFi-enabled menorah using an Arduino R4 WiFi. It automatically: - Connects to the internet to get the current date and time - Calculates sunset for your location - Lights the appropriate number of LED "candles" for each night of Hanukkah - Turns off at midnight for safety and power conservation - Includes a manual override mode for traditional lighting
Whether you're a maker looking for a meaningful holiday project or someone who wants to ensure their menorah is always lit on time, this build brings together programming, electronics, and cultural celebration in one glowing package.
Supplies
Electronics
- Arduino R4 WiFi (The WiFi capability is essential - regular Arduino won't work)
- 9 LEDs total:
- 8 standard LEDs (blue and white are traditional, but any color works)
- 1 LED for the shamas/helper (or use the 25mm arcade button's built-in LED)
- 8 or 9 Current-limiting resistors (220Ω - 330Ω) (The 25mm arcade button has a built-in resistor)
- 1 Momentary push button (preferably a 25mm arcade with built-in LED)
- Breadboard (full-size recommended)
- Jumper wires (at least 20)
- USB cable for Arduino
- 5V power supply (USB phone charger works great)
Optional Enclosure Materials
- Wood or cardboard for housing
- Diffusion material (tissue paper, ping pong balls, or frosted acrylic)
- Hot glue or mounting tape
Tools
- Computer with Arduino IDE installed
- Wire strippers (if not using pre-made jumpers)
- Multimeter (helpful for debugging)
Total Cost Breakdown: - Arduino R4 WiFi: $25-30 - LEDs and resistors: $5 - Button: $2 - Breadboard and wires: $10 - Power supply: $5 (or use one you have)
Understanding the Circuit
Before we start building, let's understand what we're making. Our menorah has three main components:
The Shamas (Helper Candle)
The shamas is traditionally used to light the other candles. In our version: - Pin 11 controls the shamas LED (can be the arcade button's built-in LED) - Pin 13 reads the button input - The button serves dual purpose: manual override and visual shamas indicator
The Eight Candles
Eight LEDs represent the eight nights of Hanukkah: - Pins 2, 3, 4, 5, 6, 7, 8, and 12 each control one LED - We skip pins 9-11 to keep the shamas separate - Each LED needs a current-limiting resistor
The Brain
The Arduino R4 WiFi: - Connects to your home WiFi - Gets accurate time from internet time servers (NTP) - Calculates which night of Hanukkah it is - Determines sunset time for your location - Controls the LEDs accordingly
How the Logic Works: 1. Every minute, the Arduino checks the current date and time 2. During Hanukkah dates (December 14-22 for 2025), it checks if it's after sunset 3. If yes, it lights the appropriate number of LEDs (1 for first night, 2 for second, etc.) 4. At midnight, all candles turn off automatically 5. The button allows manual override for traditional lighting
Build the Circuit
Let's build this step-by-step. Don't worry if it looks complex - we'll take it slowly.
Basic Setup
- Insert your Arduino R4 WiFi into the breadboard or place it nearby
- Establish power rails:
- Connect Arduino 5V to breadboard positive (+) rail
- Connect Arduino GND to breadboard negative (-) rail
Wire the Shamas (Button and LED)
- Connect the button:
- Positive (anode) leg of arcade button to Pin 13
- Other leg to GND (use internal pullup)
- Connect the shamas LED:
- Arcade button LED anode to Pin 11 (has built-in resistor)
- Arcade button LED cathode to GND
Wire the Eight Candles
For each LED (1 through 8): 1. Place the LED on the breadboard 2. Connect the anode (longer, positive leg) to its control pin through a 220Ω resistor: - LED 1 → Pin 2 - LED 2 → Pin 3 - LED 3 → Pin 4 - LED 4 → Pin 5 - LED 5 → Pin 6 - LED 6 → Pin 7 - LED 7 → Pin 8 - LED 8 → Pin 12 3. Connect all cathodes (shorter legs) to the GND rail
Pro Tips:
- Color coding: Use red wires for power, black for ground, and other colors for signals
- LED orientation: Remember - Long Leg = Positive (anode), Short Leg = Negative (cathode)
- Test as you go: Upload a simple blink sketch to test each LED as you wire it
- Organization: Arrange LEDs in a line or arc to mimic a real menorah
Install Required Libraries
Before uploading the code, we need to install some libraries.
Using Arduino IDE:
- Open Arduino IDE (download from arduino.cc if needed)
- Install the WiFiS3 library:
- Go to Tools → Manage Libraries
- Search for "WiFiS3"
- Install the official Arduino WiFiS3 library
- Install NTPClient:
- Still in Library Manager
- Search for "NTPClient"
- Install "NTPClient by Fabrice Weinberg"
- Install Time library:
- Search for "Time"
- Install "Time by Michael Margolis"
Board Configuration:
- Go to Tools → Board → Board Manager
- Search for "Arduino UNO R4"
- Install "Arduino UNO R4 Boards"
- Select Tools → Board → Arduino UNO R4 WiFi
- Select the correct Port (Tools → Port)
Now for the fun part - the code that makes it all work!
Key Customizations You MUST Make:
- WiFi Credentials (lines 27-28):cpp const char* ssid = "YOUR_HOME_SSID"; const char* password = "YOUR_HOME_WIFI_PASSWORD";
- Your Location (lines 30-33):cpp const float LATITUDE = 40.8136; // Your latitude const float LONGITUDE = -96.7026; // Your longitude const int TIME_ZONE_OFFSET = -6; // Your timezone (CST = -6, EST = -5, PST = -8)
To find your coordinates: - Go to Google Maps - Right-click your location - Click the coordinates that appear - Copy them into the code
- Hanukkah Dates (if not 2025): The code is set for Hanukkah 2025 (Dec 14-22). For other years, modify the calculateHanukkahNight() function.
Upload Process:
- Copy the complete code (provided in the files)
- Paste into Arduino IDE
- Make your customizations
- Click the Verify button (checkmark) to check for errors
- Click Upload (arrow) to send to your Arduino
- Open Serial Monitor (Tools → Serial Monitor)
- Set baud rate to 115200
- Watch the status messages!
What You Should See:
Understanding the Code Structure
Let's break down how the code works - understanding this will help you customize it or debug issues.
Main Components:
Setup Function: - Initializes all pins (button as input, LEDs as outputs) - Connects to WiFi - Syncs with internet time server - Runs once at startup
Loop Function: - Updates time every minute - Checks if button is pressed - Calculates current Hanukkah night - Determines if it's after sunset - Lights appropriate number of candles - Prints status every 10 seconds
Key Functions Explained:
calculateHanukkahNight(): - Checks if current date falls within Hanukkah - Returns 0 if not Hanukkah, 1-8 for each night - Example: Dec 14 = night 1, Dec 15 = night 2
isAfterSunset(): - Gets current time - Calculates approximate sunset time - Returns true if current time > sunset time
lightCandles(int number): - Takes a number 0-8 - Lights that many LEDs using a for loop - 0 = all off, 8 = all on
handleButtonPress(): - Toggles between manual and automatic modes - In manual: cycles through 0-8 candles with each press - Flashes shamas LED as feedback
The Clever Midnight Reset:
The code naturally resets at midnight because: 1. At 23:59 on Dec 14, it shows night 1 candles 2. At 00:00 on Dec 15, it's now "before sunset" on Dec 15 3. Candles turn off and stay off until sunset on Dec 15 4. After sunset on Dec 15, night 2 candles light
This creates perfect daily cycling without extra code!
Testing and Troubleshooting
Time to make sure everything works correctly!
Initial Testing:
- Power up your Arduino
- Open Serial Monitor (115200 baud)
- Watch for WiFi connection - should take 5-15 seconds; it seems to take a few minutes before the correct time and date are updated. Be patient.
- Check the status messages every 10 seconds
Testing Without Waiting for Hanukkah:
To test any time of year, temporarily modify the date check: ```cpp // Change line 173 from: if (currentYear == 2025 && currentMonth == 12) { // To: if (true) { // Always Hanukkah for testing!
// And change line 180 from: if (currentDay >= 14 && currentDay <= 22) { // To: if (currentDay >= 1 && currentDay <= 31) { // Any day works ```
Manual Mode Testing:
- Press the button once - enters manual mode
- Press again - cycles through 1, 2, 3... 8 candles
- After 8, next press returns to automatic mode
Common Issues and Solutions:
Problem: WiFi won't connect - Double-check SSID and password (case-sensitive!) - Ensure 2.4GHz network (Arduino doesn't support 5GHz) - Try moving closer to router - Check if network requires web portal login
Problem: Wrong number of candles - Verify your date/time in Serial Monitor - Check timezone offset (remember DST!) - Ensure Hanukkah dates are correct in code
Problem: Candles won't light - Test each LED with simple blink sketch - Check LED polarity (long leg = positive) - Verify resistor connections - Ensure ground connections are solid
Problem: Candles light at wrong time - Verify latitude/longitude coordinates - Check timezone offset - Remember: lights turn on AFTER sunset, not at sunset - For testing, temporarily set sunset to current time
Problem: Serial Monitor shows garbage - Set baud rate to 115200 - Reset Arduino - Re-upload code
Making It Beautiful (Optional Enclosure)
Now let's make it look like a real menorah!
Design Options:
Option 1: Traditional Linear Display - Mount LEDs in a straight line on wood or acrylic - Place shamas LED slightly higher or offset - Drill 9mm holes for LEDs (they friction-fit perfectly)
Option 2: Curved Arc Design - Use flexible material or 3D print a curved holder - Follows traditional menorah shape - More challenging but stunning result
Option 3: Modern Minimalist - Mount LEDs behind frosted acrylic - Creates glowing panels instead of point lights - Very contemporary look
Building the Enclosure:
Materials Needed: - Base material (wood, acrylic, or thick cardboard) - Diffusion material (ping pong balls, tissue paper, or frosted tubes) - Wire management clips - Project box for Arduino (optional)
Assembly Steps: 1. Plan your layout - sketch LED positions 2. Drill/cut holes for LEDs (9mm for standard 10mm LEDs) 3. Insert LEDs from behind 4. Hot glue in place (careful not to melt LED!) 5. Add diffusers over each LED 6. Hide wiring on back with clips or channels 7. Mount Arduino in project box or underneath 8. Add power jack for clean power connection
Diffusion Ideas:
- Ping pong balls: Cut in half, place over LEDs
- Paper tubes: Roll white paper into candle shapes
- 3D printed: Design custom candle shapes
- Glass tubes: Use test tubes for lab-themed look
Advanced Customizations
Ready to level up? Here are some advanced modifications:
Add Real Sunset Calculations
Replace the simple sunset function with accurate astronomical calculations:
Add RGB LEDs for Multi-Color Effects
Use WS2812B addressable RGB LEDs: - Different colors for each night - Flame-like flickering effects - Rainbow animations during lighting
Web Interface Control
Create a web server on the Arduino:cpp // Users can visit Arduino's IP address to: // - See current status // - Manual override from phone // - Adjust settings // - View lighting schedule
MQTT Integration
Connect to home automation: - Integrate with Home Assistant - Control via Alexa/Google Home - Sync with other smart home devices
Add a Real-Time Clock (RTC)
For locations without reliable WiFi: - Add DS3231 RTC module - Maintains time during power outages - Works offline after initial setup
Sound Effects
Add a small speaker to: - Play traditional songs when lighting - Chime when candles light - Audio countdown to sunset
Motion Activation
Add PIR sensor to: - Light up when someone approaches - Dim when room is empty - Save power intelligently
Final Thoughts and Variations
What You've Accomplished
Congratulations! You've built a menorah that: - Automatically celebrates Hanukkah at the right time - Combines ancient tradition with modern technology - Teaches programming, electronics, and cultural heritage - Can be customized and improved year after year
Educational Extensions
For Classrooms: - Students calculate sunset times manually, then verify with Arduino - Explore how latitude affects sunset times - Learn about time zones and UTC - Discuss intersection of technology and tradition
Programming Challenges: - Add Hebrew date calculations - Implement Jewish calendar conversions - Calculate Hanukkah dates for any year - Add other Jewish holidays
Electronics Learning: - Experiment with PWM for candle flickering - Try multiplexing for more LEDs - Add current measurement for power analysis - Implement sleep modes for battery operation
Cultural Variations
For Other Holidays: - Advent calendar (25 LEDs, one per day) - Diwali lights (patterns and sequences) - Christmas tree lights (synchronized patterns) - Ramadan calendar (sunset/sunrise for Iftar/Suhoor)
Sharing Your Build
- Post photos on social media with #ArduinoMenorah
- Share code improvements on GitHub
- Document your unique enclosure design
- Create variations for your community
Safety Reminders
- Never leave exposed electronics unattended
- Use appropriate resistors to prevent LED burnout
- Ensure stable power supply
- Keep away from flammable materials
- This is decorative - keep real candles for traditional ceremonies
Going Further
This project opens doors to: - IoT and connected devices - Home automation - Calendar and time-based computing - Cultural preservation through technology - Community STEM education
Remember: Technology doesn't replace tradition - it can enhance and preserve it. This LED menorah ensures the lights of Hanukkah shine on time, every time, while you maintain the meaningful traditions of gathering, blessing, and celebrating.
Happy Making and Happy Hanukkah!
Code
Downloads
Resources and References
Helpful Links:
- Arduino R4 WiFi Documentation
- NTP Time Protocol Explanation
- Sunset Calculation Algorithm
- Hanukkah Dates Calculator
Libraries Used:
- WiFiS3 (Arduino official)
- NTPClient by Fabrice Weinberg
- TimeLib by Michael Margolis
Community:
- Arduino Forum: forum.arduino.cc
- r/arduino subreddit
- Instructables Arduino channel
Troubleshooting Support:
- Arduino Discord server
- Stack Overflow arduino tag
- Local maker spaces
Thank you for building this project! If you found this Instructable helpful, please vote for it in any applicable contests and share your build in the comments. Your variations and improvements help the whole maker community grow!