Pi-On-Pi: Happy Pi Day 2023! (or, 2nd Generation Pi Machine)
https://www.flickr.com/photos/catherinecronin/8558070292

Pi-On-Pi: Happy Pi Day 2023! (or, 2nd Generation Pi Machine)

Here we go again! It's time, folks! Pi Day is upon us, rejoice!

Today is Pi day (3/14), and I'm publishing once more my salute to this magnificent creature.

Some selected interesting facts about Pi:

  • "We can never truly measure the circumference or the area of a circle because we can never truly know the value of pi. Pi is an irrational number, meaning its digits go on forever in a seemingly random sequence."
  • "In the Star Trek episode “Wolf in the Fold,” Spock foils the evil computer by commanding it to “compute to last digit the value of pi.”"
  • "One of the earliest known records of pi was written by an Egyptian scribe named Ahmes (c. 1650 B.C.) on what is now known as the Rhind Papyrus. He was off by less than 1% of the modern approximation of pi (3.141592)."
  • "Computing pi is a stress test for a computer."
  • "Thirty-nine decimal places of pi suffice for computing the circumference of a circle girding the known universe with an error no greater than the radius of a hydrogen atom."

No alt text provided for this image
https://www.flickr.com/photos/morgantj/5575500301

By the way, I tried Spock's trick with ChatGPT. It didn't fall for it :(

No alt text provided for this image
ChatGPT didn't bite it

Last year my humble contribution included a dedicated Pi calculator, which can run indefinitely calculating and scrolling Pi digits through a 4 digits display (https://www.dhirubhai.net/pulse/happy-%CF%80-day-2022-cristiano-monteiro/).

This year I produced a revamped 2nd generation version of it, called Pi-On-Pi! Why? Well, because now I'm using a Raspberry Pi Pico board to calculate Pi.

No alt text provided for this image
https://commons.wikimedia.org/wiki/File:Raspberry_Pi_Pico.jpg

Raspberry Pi Pico possesses a Dual-core ARM Cortex M0+ running at 133 Mhz, which I put to work, one dedicated to calculating Pi and the other to keep the display updated (felt the need to have a 1 Hz blinking dot to indicate that the machine is working, since the computation will get slower over time, appearing to be frozen. It is not! The machine never gives up!).

On top of it, added a MAX7219 8-digit 7-segment display and a real case, hand cut for the task (not my best job, but...).

No alt text provided for this image
MAX7219 driven 8-digit 7-segment display

The calculation is based on the Simon Plouffe algorithm, which allows calculating individual digits of Pi not knowing the previous digits, and makes use of Fabrice Bellard C code (which is perfect for limited memory machines, like the 264Kb of our Pi Pico board) adapted for this machine purpose.

Here you can see it working in full glory:


And its assembly:

No alt text provided for this image
Raw enclosure


No alt text provided for this image
Marks for cutting


No alt text provided for this image
Cutting on Dremel


No alt text provided for this image
Fixating module to enclosure bottom using 2.5mm screws and nuts


No alt text provided for this image
Final assembly


No alt text provided for this image
Fully assembled unit



Source code for this project can be found here:


That's all for today, hope you enjoyed it!


References:

https://www.factretriever.com/pi-facts

https://bellard.org/pi/

https://www.plouffe.fr/simon/articlepi.html

https://lacim.uqam.ca:16080/~plouffe/

https://www.flickr.com/photos/47738026@N05/8476624791

https://youtu.be/EqVtY_VB7Jw

Roberto Sano

Technical Field Coordinator - ICAO

2 年

Very good to have Dr Spock reminded in the context!

要查看或添加评论,请登录

Cristiano Monteiro的更多文章

社区洞察

其他会员也浏览了