Project tutorial # Pi Day Clock with Arduino © CC BY-NC-ND

This clock uses the first 192 digits of Pi number to display the time in a 32 x 8 LED matrix in an original way.

• 3,238 views
• 8 respects

## Apps and online services

### 1 - Introduction

The Pi-Clock is a fun way to use the first 192 digits of irrational Pi number (3.1415926...) to display the time using a 32 x 8 LED matrix driven by Arduino.

The main challenge for coding this project was to figure out how to combine the digits of Pi to make the time readable.

Let's see it!

### 3 - Pi-Clock

The Pi number is a mathematical constant and it is defined as the ration of a circle's circumference to its diameter (Pi = C/d).

Pi is a irrational number and cannot be expressed as a commom fraction.

Using high-precision multiplication algorithms is possible to calculate billions of digits. These methods are used to test super-computers.

Fortunately for this clock, the first 192 digits are enough.

Pi (192 digits):

3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895

My algorithm split the hour, minute and seconds on its tens and units.

The position of tens and units are searched in the sequence of Pi digits to be converted into rows and columns of LED matrix.

This is very effective and fast.

This time I used a RTC (Real Time Clock) to provide a more accurate time reading than the Arduino can do.

Note:

Using DS1307RTC.h library is possible to setup the time on RTC according to the following statements on Arduino code:

`````` setTime(21, 46, 00, 19, 01, 2019); // Set Time & Date (hh,mm,ss,dd,mm,yyyy)
RTC.set(now());                    // Set RTC
``````

After the setup, change the statements to comments before compiling the code again:

`````` //setTime(21, 46, 00, 19, 01, 2019); // Set Time & Date
//RTC.set(now());                    // Set RTC
``````

### 4 - MAX7219 Module (32 x 8 LED Matrix)

The MAX7219 module is very simple to be used with LedControl library.

The following pin numbers of Arduino should be connected into LED matrix:

• Pin 2: connected to the DataIn (DIN)
• Pin 3: connected to LOAD (CS)
• Pin 4: connected to the CLK (CLK)

To read the clock, you should observe the following conventional sequence: starting from the top down and from the left to right.

## Custom parts and enclosures

Paper template (scale 1 : 1) to cover the LED matrix module.

## Schematics

Schematic for Pi Clock

January 23, 2019

#### Members who respect this project

See similar projects
you might like

#### Analog Clock with LED Matrix and Arduino

Project tutorial by LAGSILVA

• 17,488 views
• 65 respects

#### 4-Stroke Digital Clock With Arduino

Project tutorial by LAGSILVA

• 14,936 views
• 45 respects

#### Digital & Binary Clock In 8 Digits x 7 Segments LED Display

Project tutorial by LAGSILVA

• 3,494 views
• 11 respects

#### Tiny Calendar and Clock Featuring Moon Phase in a LED Matrix

Project in progress by LAGSILVA

• 7,678 views
• 37 respects

#### Stopwatch and Lap Timer with Arduino

Project tutorial by LAGSILVA

• 22,661 views