Infinite Pi Clock: a Desk Gadget That Blends Time With Endless Math
by RyanCreates in Circuits > Arduino
161 Views, 1 Favorites, 0 Comments
Infinite Pi Clock: a Desk Gadget That Blends Time With Endless Math
Ever notice how a regular clock just keeps looping through the same hours, minutes, and seconds? It’s predictable. Comforting, even. But π (pi) is the complete opposite — an infinite, non-repeating decimal that goes on forever without any pattern.
This project merges those two concepts into one clean, minimalist device: a clock that shows accurate real-world time while slowly scrolling through the never-ending digits of π.
The result is a small, always-running desktop piece that’s part timekeeper, part mathematical art. It’s simple enough for beginners, looks surprisingly polished, and quietly reminds you that while time cycles, mathematics never stops.
Why Build This?
- Super straightforward to assemble
- Clean, uncluttered display
- Educational and mesmerizing to watch
- Runs 24/7 with no interaction needed
How It Works
The Infinite Pi Clock has three main components working together:
- Accurate Timekeeping — A DS3231 Real-Time Clock (RTC) module tracks time precisely, even when the power is off.
- Pi Digit Stream — A pre-stored sequence of π digits acts as an endless data feed that the display advances through over time.
- Visual Output — A compact 128×64 OLED screen displays the current time (in 24-hour format), the familiar start of π (3.14159…), the advancing digits, and a counter showing how deep into the sequence you’ve gone.
The whole thing runs continuously, giving you a living visualization of infinity in motion.
Supplies
Parts List
- Arduino UNO or Nano
- ELEGOO 0.96" OLED Display (SSD1306, I2C, 128×64)
- DS3231 RTC module
- Jumper wires
- Breadboard (optional but recommended for prototyping)
- USB cable for uploading code
Wiring
Both the OLED and RTC communicate over I2C, so they happily share the same two pins.
Here’s the connection table:
ComponentPinArduino Pin
OLED VCC - 5V
OLED GND - GND
OLED SDA - A4
OLED SCL - A5
RTC VCC - 5V
RTC GND -GND
RTC SDA - A4
RTC SCL - A5
Pro tip: Keep your wiring tidy. It makes troubleshooting easier and the final build look much nicer.
Install the Libraries
Open the Arduino IDE and install these three libraries via the Library Manager:
- Adafruit SSD1306
- Adafruit GFX
- RTClib
Set the Correct Time on the RTC
Before the first run, you need to tell the RTC what time it is.
In the code, temporarily uncomment this line:
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
Upload and Run
Upload the final code to your Arduino. Once powered on, the display should show:
- Current time in 24-hour format (with a blinking colon)
- “PI” label at the top
- The starting digits: 3.14159…
- Continuously advancing π digits
- A live counter showing your progress through the sequence
What You’ll See on Screen
The layout is intentionally clean and balanced:
- Yellow top band: “PI” label
- Center area: Large, easy-to-read current time
- Bottom section: Scrolling π digits + progress counter
Everything is positioned to avoid visual clutter while staying highly readable.
The Pi Digit System
Instead of calculating π on the fly (which would be slow and heavy), the project uses a stored array of digits and simply walks through them step by step.
This method keeps everything smooth, responsive, and capable of running forever without bogging down the Arduino. The counter tracks how many digits deep you are.
How Long Until It Loops?
The counter uses an unsigned long, so it can count up to 4,294,967,295 steps before rolling over.
With the display advancing roughly every 0.4 seconds:
- ~2.5 updates per second
- ~9,000 updates per hour
- ~216,000 updates per day
That means it takes about 20 days of continuous running to hit the maximum and reset. When it does reset, the clock just keeps going — a nice little nod to the infinite nature of π.
Taking It Further
This basic version is deliberately minimal, but the concept scales beautifully.
Bigger Displays Swap the small OLED for:
- A larger OLED or LCD
- A color TFT screen
- Or even connect it to a Raspberry Pi and use a full monitor
With more screen real estate, you could show hundreds of digits at once, add smooth scrolling, or create animated π visualizations.
Better Enclosures Move beyond the breadboard with:
- A 3D-printed case
- Laser-cut acrylic box
- Round “clock face” housing
- Wall-mountable design
A proper enclosure instantly makes the project feel like a finished product instead of a prototype.
Testing & Troubleshooting
When everything is working, you should see:
- Time updating every minute
- Smoothly advancing π digits
- Steady counter increase
- No freezing or glitches
Common Issues & Fixes:
- Split-color display problems (yellow/blue OLED): Keep large text entirely within one color region.
- Nothing showing on OLED: Double-check the I2C address (usually 0x3C), wiring, and that the libraries are installed.
- Glitchy behavior or crashes: Avoid heavy use of String objects on the Arduino — stick with character arrays.
- Wrong time: Make sure you set the RTC properly and that the backup battery is in place.
Future Upgrade Ideas
- Add a 3D-printed or laser-cut enclosure
- Use a larger screen for more π digits
- Add ambient light-based brightness control
- Implement multiple display modes
- Upgrade to an ESP32 for automatic WiFi time synchronization
- Store even more π digits
Final Thoughts
The Infinite Pi Clock is a fun contrast between the predictable cycle of time and the endless, pattern-free world of π. It’s a small, easy build that creates something surprisingly thoughtful — a desktop reminder that while days repeat, mathematics stretches on forever.
Build it, let it run, and enjoy watching infinity unfold in real time.
Safety Notes
- Only use low-voltage USB power (5V)
- Double-check all connections before powering on
- Be careful not to create shorts on the breadboard
If you make one, I’d love to hear how it turns out — and whether you end up scaling it up into something even bigger!