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

night6.jpeg

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

  1. Arduino R4 WiFi (The WiFi capability is essential - regular Arduino won't work)
  2. 9 LEDs total:
  3. 8 standard LEDs (blue and white are traditional, but any color works)
  4. 1 LED for the shamas/helper (or use the 25mm arcade button's built-in LED)
  5. 8 or 9 Current-limiting resistors (220Ω - 330Ω) (The 25mm arcade button has a built-in resistor)
  6. 1 Momentary push button (preferably a 25mm arcade with built-in LED)
  7. Breadboard (full-size recommended)
  8. Jumper wires (at least 20)
  9. USB cable for Arduino
  10. 5V power supply (USB phone charger works great)

Optional Enclosure Materials

  1. Wood or cardboard for housing
  2. Diffusion material (tissue paper, ping pong balls, or frosted acrylic)
  3. Hot glue or mounting tape

Tools

  1. Computer with Arduino IDE installed
  2. Wire strippers (if not using pre-made jumpers)
  3. 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

Screenshot 2025-12-21 at 14.04.32.png

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

PXL_20251221_180058488.jpg
PXL_20251221_180145311.jpg

Let's build this step-by-step. Don't worry if it looks complex - we'll take it slowly.

Basic Setup

  1. Insert your Arduino R4 WiFi into the breadboard or place it nearby
  2. Establish power rails:
  3. Connect Arduino 5V to breadboard positive (+) rail
  4. Connect Arduino GND to breadboard negative (-) rail

Wire the Shamas (Button and LED)

  1. Connect the button:
  2. Positive (anode) leg of arcade button to Pin 13
  3. Other leg to GND (use internal pullup)
  4. Connect the shamas LED:
  5. Arcade button LED anode to Pin 11 (has built-in resistor)
  6. 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:

  1. Color coding: Use red wires for power, black for ground, and other colors for signals
  2. LED orientation: Remember - Long Leg = Positive (anode), Short Leg = Negative (cathode)
  3. Test as you go: Upload a simple blink sketch to test each LED as you wire it
  4. 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:

  1. Open Arduino IDE (download from arduino.cc if needed)
  2. Install the WiFiS3 library:
  3. Go to Tools → Manage Libraries
  4. Search for "WiFiS3"
  5. Install the official Arduino WiFiS3 library
  6. Install NTPClient:
  7. Still in Library Manager
  8. Search for "NTPClient"
  9. Install "NTPClient by Fabrice Weinberg"
  10. Install Time library:
  11. Search for "Time"
  12. Install "Time by Michael Margolis"

Board Configuration:

  1. Go to Tools → Board → Board Manager
  2. Search for "Arduino UNO R4"
  3. Install "Arduino UNO R4 Boards"
  4. Select Tools → Board → Arduino UNO R4 WiFi
  5. Select the correct Port (Tools → Port)


Now for the fun part - the code that makes it all work!

Key Customizations You MUST Make:

  1. WiFi Credentials (lines 27-28):cpp const char* ssid = "YOUR_HOME_SSID"; const char* password = "YOUR_HOME_WIFI_PASSWORD";
  2. 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

  1. Hanukkah Dates (if not 2025): The code is set for Hanukkah 2025 (Dec 14-22). For other years, modify the calculateHanukkahNight() function.

Upload Process:

  1. Copy the complete code (provided in the files)
  2. Paste into Arduino IDE
  3. Make your customizations
  4. Click the Verify button (checkmark) to check for errors
  5. Click Upload (arrow) to send to your Arduino
  6. Open Serial Monitor (Tools → Serial Monitor)
  7. Set baud rate to 115200
  8. Watch the status messages!

What You Should See:

Arduino R4 WiFi Hanukkah Menorah
=================================
Connecting to WiFi: YourNetwork
..........
WiFi connected!
IP address: 192.168.1.123
Setup complete!

----- Status -----
Date/Time: 12/14/2025 17:45
Hanukkah Night: 1
After Sunset: Yes
Mode: Automatic
WiFi Status: Connected
------------------


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:

  1. Power up your Arduino
  2. Open Serial Monitor (115200 baud)
  3. 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.
  4. 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:

  1. Press the button once - enters manual mode
  2. Press again - cycles through 1, 2, 3... 8 candles
  3. 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:

  1. Ping pong balls: Cut in half, place over LEDs
  2. Paper tubes: Roll white paper into candle shapes
  3. 3D printed: Design custom candle shapes
  4. 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:

float calculateAccurateSunset() {
int dayOfYear = getDayOfYear();
float P = asin(0.39795 * cos(0.98563 * (dayOfYear - 173) * PI / 180.0));
float argument = -tan(LATITUDE * PI / 180.0) * tan(P);
if (argument < -1) argument = -1;
if (argument > 1) argument = 1;
float sunsetLocal = 12 + (12.0 / PI) * acos(argument);
// Add equation of time and longitude corrections
float B = 2 * PI * (dayOfYear - 81) / 365.0;
float E = 9.87 * sin(2 * B) - 7.53 * cos(B) - 1.5 * sin(B);
float sunset = sunsetLocal - E / 60.0 - (LONGITUDE / 15.0) + TIME_ZONE_OFFSET;
return sunset;
}

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

  1. Post photos on social media with #ArduinoMenorah
  2. Share code improvements on GitHub
  3. Document your unique enclosure design
  4. Create variations for your community

Safety Reminders

  1. Never leave exposed electronics unattended
  2. Use appropriate resistors to prevent LED burnout
  3. Ensure stable power supply
  4. Keep away from flammable materials
  5. 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

Resources and References

Helpful Links:

  1. Arduino R4 WiFi Documentation
  2. NTP Time Protocol Explanation
  3. Sunset Calculation Algorithm
  4. Hanukkah Dates Calculator

Libraries Used:

  1. WiFiS3 (Arduino official)
  2. NTPClient by Fabrice Weinberg
  3. TimeLib by Michael Margolis

Community:

  1. Arduino Forum: forum.arduino.cc
  2. r/arduino subreddit
  3. Instructables Arduino channel

Troubleshooting Support:

  1. Arduino Discord server
  2. Stack Overflow arduino tag
  3. 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!