are you living on a prime numbered day of your life?
- Tracks up to 4 people's birthdates
- Calculates the number of days each person has been alive
- Lights up their dedicated LED when that number is prime
- Each LED stays on for the entire prime day
- Includes a status LED for system health monitoring
- Automatically syncs time via NTP (Network Time Protocol)
- Reconnects to WiFi automatically if connection drops
- ESP8266 microcontroller (choose one):
- NodeMCU v1.0
- Wemos D1 Mini
- Any ESP8266-based board with at least 5 available GPIO pins
- 5x LEDs (any color you prefer):
- 4 for family members
- 1 for status indicator
- 5x 220-330Ξ© resistors (one for each LED)
- Breadboard (or perfboard for permanent installation)
- Jumper wires
- Micro USB cable (for programming and power)
- USB power adapter (5V, 1A minimum) for permanent installation
ESP8266 (NodeMCU) Component
βββββββββββββββββ βββββββββ
D1 (GPIO5) ββ[220Ξ©]ββββββ LED1 (Person 1) ββββ GND
D2 (GPIO4) ββ[220Ξ©]ββββββ LED2 (Person 2) ββββ GND
D5 (GPIO14) ββ[220Ξ©]ββββββ LED3 (Person 3) ββββ GND
D6 (GPIO12) ββ[220Ξ©]ββββββ LED4 (Person 4) ββββ GND
D7 (GPIO13) ββ[220Ξ©]ββββββ LED5 (Status) ββββ GND
- Connect the long leg (anode) of each LED to a 220Ξ© resistor
- Connect the resistor to the corresponding GPIO pin
- Connect the short leg (cathode) of each LED to GND
- Double-check polarity before powering on!
-
Arduino IDE (1.8.x or 2.x)
- Download from: https://www.arduino.cc/en/software
-
ESP8266 Board Support
- Open Arduino IDE
- Go to
FileβPreferences - Add to "Additional Board Manager URLs":
http://arduino.esp8266.com/stable/package_esp8266com_index.json - Go to
ToolsβBoardβBoard Manager - Search for "esp8266" and install "esp8266 by ESP8266 Community"
-
Required Libraries (install via Library Manager):
NTPClientby Fabrice WeinbergTimeLibby Michael MargolisESP8266WiFi(included with ESP8266 board package)
- Open Arduino IDE
- Go to
SketchβInclude LibraryβManage Libraries - Search for and install:
- "NTPClient"
- "Time" or "TimeLib"
const char* ssid = "YOUR_WIFI_SSID"; // Your WiFi network name
const char* password = "YOUR_WIFI_PASSWORD"; // Your WiFi passwordconst long TIMEZONE_OFFSET = -7 * 3600; // GMT-7 (Pacific Time)Find your timezone offset:
- PST (Pacific):
-8 * 3600or-7 * 3600(DST) - MST (Mountain):
-7 * 3600or-6 * 3600(DST) - CST (Central):
-6 * 3600or-5 * 3600(DST) - EST (Eastern):
-5 * 3600or-4 * 3600(DST) - GMT/UTC:
0 - CET (Central Europe):
1 * 3600or2 * 3600(DST)
FamilyMember family[4] = {
{"Aba", 1990, 1, 15, D1, false, 0}, // Name, Year, Month, Day, Pin
{"Bobo", 1992, 6, 22, D2, false, 0},
{"Coco", 2015, 9, 8, D5, false, 0},
{"DeeDee", 2018, 12, 3, D6, false, 0}
};const int LED_BRIGHTNESS = 40; // 0-1023 (1023 = full brightness)- 40 = ~4% brightness (wasy on eyes)
- 100 = ~10% brightness
- 512 = ~50% brightness
- 1023 = 100% brightness
const bool TEST_MODE = false; // Set to true to test all LEDsWhen TEST_MODE = true, the system cycles through each LED (including status LED) every second.
- Connect your ESP8266 to your computer via USB
- Open
primetime.inoin Arduino IDE - Select your board:
ToolsβBoardβESP8266 BoardsβNodeMCU 1.0 (ESP-12E Module)(or your board)
- Select the correct port:
ToolsβPortβ (select your USB port)
- Click the Upload button (β)
- Wait for "Done uploading" message
- Open
ToolsβSerial Monitor - Set baud rate to 115200
- You should see:
- WiFi connection status
- Network scan results
- Time sync confirmation
- Current prime day status for each person
- System status updates
- Set
TEST_MODE = truein the code - Upload the code
- Watch each LED light up in sequence (1 second each)
- Verify all connections are working
- Set
TEST_MODE = falseand re-upload for normal operation
- Solid ON: System operational, WiFi connected
- Blinking: WiFi disconnected, attempting to reconnect
A prime number is a number greater than 1 that can only be divided by 1 and itself. For example:
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37...
The system calculates days since birth starting from day 0 (birth date). So:
- Day 0 = Birth date (not prime)
- Day 1 = 1st day after birth (not prime)
- Day 2 = 2nd day after birth (PRIME! β¨)
- Day 3 = 3rd day after birth (PRIME! β¨)
- Day 4 = 4th day after birth (not prime)
- Day 5 = 5th day after birth (PRIME! β¨)
As you age, prime days become rarer:
- First year: ~61 prime days
- Age 10: ~1 prime day every 5-6 days
- Age 30: ~1 prime day every 10-11 days
- Age 60: ~1 prime day every 14-15 days
- Age 90: ~1 prime day every 17-18 days
- Verify SSID and password are correct (case-sensitive!)
- Check that your router supports 2.4GHz (ESP8266 doesn't support 5GHz)
- Ensure router is within range
- Check serial monitor for connection error codes
- Verify wiring and LED polarity (long leg = positive)
- Check resistor values (220-330Ξ©)
- Test with
TEST_MODE = true - Measure voltage with multimeter (should be ~3.3V on GPIO pins)
- Verify timezone offset is correct
- Check that ESP8266 can access internet (required for NTP)
- Wait a few minutes for initial time sync
- Verify all libraries are installed
- Check that ESP8266 board package is installed
- Try updating to latest library versions
NTPClient timeClient(ntpUDP, "us.pool.ntp.org", TIMEZONE_OFFSET, NTP_UPDATE_INTERVAL);Use regional NTP servers for faster sync:
- North America:
us.pool.ntp.org - Europe:
europe.pool.ntp.org - Asia:
asia.pool.ntp.org
Currently limited to 4 members due to available GPIO pins. To expand:
- Use GPIO expander (MCP23017)
- Use ESP32 instead (more GPIO pins)
- Use multiplexing
delay(60000); // Check every minute (default)
delay(10000); // Check every 10 seconds (more responsive but higher power usage)- NTP library by Fabrice Weinberg
- TimeLib by Michael Margolis
- Don Zagier
- Sieve of Eratosthenes