Rainy Day Fun By Calculating Pi

If you need a truly random event generator, just wait till your next rainstorm. Whether any given spot on the ground is hit by a drop at a particular time is anyone’s guess, and such randomness is key to this simple rig that estimates the value of pi using raindrop sensors.

You may recall [AlphaPhoenix]’s recent electroshock Settlers of Catan expeditor. The idea with this less shocking build is to estimate the value of pi using the ratio of the area of a square sensor to a circular one. Simple piezo transducers serve as impact sensors that feed an Arduino and count the relative number of raindrops hitting the sensors. In the first video below, we see that as more data accumulates, the Arduino’s estimate of pi eventually converges on the well-known 3.14159 value. The second video has details of the math behind the method, plus a discussion of the real-world problems that cropped up during testing — turns out that waterproofing and grounding were both key to noise-free data from the sensor pads.

In the end, [AlphaPhoenix] isn’t proving anything new, but we like the method here and can see applications for it. What about using such sensors to detect individual popcorn kernels popping to demonstrate the Gaussian distribution? We also can’t help but think of other ways to measure raindrops; how about strain gauges that weigh the rainwater as it accumulates differentially in square and circular containers? Share your ideas in the comments below.

[via r/electronics]

14 thoughts on “Rainy Day Fun By Calculating Pi

  1. Put a square container and a circular container in the rain, and one the rain has passed calculate PI from the ratio of the adjusted volume (if different sizes) captured in each.

  2. Really nice!
    You could possibly do a similar calculation of π using radiation detectors shielded with lead except for the square and circular apertures.

    You could use a banana or the Americium in a smoke detector as a radiation source.
    Actually, you could probably modify the smoke detector…

  3. Isn’t it easier to just cut a circle and a square out of the same material and then do the ratio based on their weight? No need to accumulate water drops, volume displaced or anything else

Leave a 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.