It's PI_Time

by Gammawave in Circuits > Software

2369 Views, 8 Favorites, 0 Comments

It's PI_Time

PI2.png

PI its all around in every aspect of life and invariably goes un-noticed like most things until you have a requirement to take note.

But what is PI, it's the 16th letter of the Greek alphabet and expressed as an irrational number that's a decimal infinite.

Meaning it's a real number that cannot be expressed as a simple fraction and after the decimal point the digits are infinite.

For example

PI to 8 decimal digits: 3.14159265 which for most general purposes should be more than enough.

But if you feel the need for greater precision how about 5 trillion digits.

Here is just one source of PI to many digits. Digits of Pi - Up to 1 Million Digits (angio.net)

* No association or affiliation and you may have your own favourite. *

Take the circumference of any circle and divide it by its diameter and you have your piece of Pi(E).

π = Circumference / Diameter.

Downloads

Supplies

Excel for VBA

This Instructable assumes you have access to Developer in Excel and can create a Module in which to copy the main body of the code and the Workbook_Open.

Details can be found here: spreadsheeto.com * No association or affiliation and you may have your own favourite. *

Round in Circles

circle.png

PI is all around us and in no more an obvious use than the passage of time represented by a analogue clock.

After all its a circle that's divided in to 12 periods of time representing the hours.

PI is equal to 180 degrees, therefore 2PI =360 degrees.

360 degrees/12 = 30 degrees per hour = hours*(1/12)*(2*PI) = hours*(1/6)*PI

But making use of PI what more fitting a way to represent time than with a PI chart.

The PI(E) chart will be created in Excel using VBA and display and update the clock in real time.

Pie Hands

skel_1hand.png

We can represent time in intervals of PI on a chart but how will the time interval be presented using a pie chart.

In this case the start & end point will be reference as 12*(PI/6),.

Meaning that each interval of time will be indicated by an ever decreasing pie as each slice of time is removed.

Example - Hour hand of the PI clock representing 1 o'clock.

The same methodology will be applied for the minutes and the seconds, meaning that the clock will require 3 pie charts.

Pie Time

skel_3hand_olap.png
skel_3hands.png

Including the 3 pie charts on the same axis gives the following:

Time = 1 hour, 20 minutes & 45 seconds.

The same diameter circumferences overlap making it difficult to determine the time when pie edges overlap.

Therefore, each pie will have a different diameter in a similar manner to a conventional clock.

Pie Filling

filled_3hands.png

By filling each pie in a different colour we can now differentiate the hours, minutes and seconds and the overlaps are clearer.

It was decided to make the seconds the larger pie, next the minutes and the smallest the hours.

Baked Pie

PI_time.png

The final modifications are a title, replacing the PI identities with whole numbers (substituting with roman numerals), and automating the process such that it updates in real time.

The Code

TimeFormat

The heart of the PI_Time clock is this function.

This function reads Now(), which contains a string with the date and time.

From this is extracted the time section this is then split into the 3 main parts of Hours, Minutes and Seconds.

This data is then formatted to enable creation of the 3 pie charts (which in reality are 3 series in a Radar/Spider chart with a fill).

The position in the pie stack is determined by the order in which the data series is presented this being Seconds, Minutes and Hours.

The chart data elements are divided into 24 cells per time type for circumference. Greater resolution can be achieved by having more cells per time type and therefore more increments on the circumference. But as its an analogue clock its not deemed a significant issue having less resolution. If absolute values of time are needed than its probably better to have a digital clock. Although digital time can be displayed on the same chart if required.

The time value is converted into a linear end point were all intermediate values except the first value are all set to 0. All the points between the first and end point represent the part of the pie which is removed as time progresses the end point is extended until all the values except the first are set to zero. At which point the pie is no more.

Each chart data element per time type has a different maximum value to which all the elements are set which defines the diameter of the associated pie. Hence each time type has a different diameter enabling each time type its own display circumference.

The Category data being the Roman Numerals and the XlValues are assigned to the Radar chart and the time is displayed.

All data processing is carried internally with no external cells required for calculation the only external process is the displaying of the chart.

An OnTime event is initiated when the spreadsheet is opened to automatically call the functions to display the current time. By default this is set to run every 5 seconds although this time can be adjusted as required.

Downloads

Finally

Hope you like this little piece of Pi, Pies and other morsels.