2025 One Hertz Challenge: Estimating Pi With An Arduino Nano R4

Humanity pretty much has Pi figured out at this point. We’ve calculated it many times over and are confident about what it is down to many, many decimal places. However, if you fancy estimating it with some electronic assistance, you might find this project from [Roni Bandini] interesting.

[Roni] programmed an Arduino Nano R4 to estimate Pi using the Monte Carlo method. For this specific case, it involves drawing a circle inscribed inside a square. Points are then randomly scattered inside the square, and checked to see if they lie inside or outside the circle based on their position and distance of the circle’s outline from the center point of the square. By taking the ratio of the points inside the circle to the total number of points, you get an approximation of the ratio of the square and circle’s areas, which is equal to Pi/4. Thus, multiply the ratio by 4, and you’ve got your approximation of Pi.

[Roni] coded a program to run the Monte Carlo simulation on the Arduino Nano R4, taking advantage of the mathematical benefits of its onboard Floating Point Unit. It generates 100 new samples for the Monte Carlo approximation every second, improving the estimation of pi as it goes. It then displays the result on a 7-segment display, and beeps as it goes. [Roni] readily admits the project is a little too close in appearance to a classic Hollywood bomb.

We’ve seen some other neat Pi-calculating projects before, too.

10 thoughts on “2025 One Hertz Challenge: Estimating Pi With An Arduino Nano R4

  1. Great project!

    There is a convenient, highly accurate rational approximation for pi; the most accurate rational approximation for almost all of the physical constants.

    Pi can be found to an accuracy of 3 parts in 10 million with the easily remembered mnemonic “write the first three odd numbers, writing each one twice.” (result? 113355).
    “Now now divide the last three digits by the first three.” ( 355/113)
    Result? 3.1415929.
    The true value of pi, to this resolution, is 3.1415926

    …used to use this as a good check on the quality of a cheap calculator, but even cheap calculators don’t fail this test any more; don’t waste your time.

    It’s probably easier to simply remember “pi = 3.1415926” for those times when you’re stranded on a desert island and need to know pi to seven decimal places.

        1. Please break with commenting tradition, and be more specific.
          Which “other side”?
          If you mean “to the left of the decimal point”, that number of digits is infinite.
          If you mean “to the right of the decimal point”, that number of digits is approximately 300 X 1012, or 300 million million.

Leave a Reply to macsimkiCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.