Story
An hourglass is a device used to measure the passage of time. It consists of two glass bulbs connected by a narrow passage, allowing a substance (typically fine sand) to flow from the upper bulb to the lower one at a consistent rate.
Once all the sand has flowed to the lower bulb, the hourglass is flipped to measure time again. The time it takes for the sand to flow completely from one bulb to the other depends on the size of the hourglass and the amount of sand. Recently, in one of my previous projects I presented you with a way to create a virtual hourglass on a small OLED display.
Detailed video instructions at: https://youtu.be/ycQXSKxFcHU
In this project, quite the opposite, I will present you with another simple way to make such a device, but now on a huge color "Display" which actually represents a 16x16 LED matrix with LEDs, each of which contains a WS2812b LED chip, so that each LED can be controlled individually.
The device is really very simple to make and consists of a few components.
- ESP32 DEV Board
- 16x16 led matrix with WS2812bLeds
- Tilt switch
- and small speaker
The components are built into a suitable box made of PVC material that I made for a previous project of mine, and on the front of the matrix there is a 3D printed grid for which you can find the .STL file at the end of this text.
To achieve a more realistic simulation, I used a tilt switch, so by rotating the clock 180 degrees the countdown starts over. If we look at the code, we will see that it is designed in a way that allows us to easily change almost all parameters, starting from the number of particles, through the flow rate, the brightness of the LEDs, and even defining the colors.
In particular, we can change the color of the hourglass wall, the sand, the environment around it, the internal empty space, as well as the color of the numbers. The numbers on both sides of the hourglass show the remaining time in seconds. I also added simple sound effects to start and end the countdown, as well as a short sound to indicate each second that passes.
Let's see from the beginning how this looks in reality. Immediately after switching on, a sound effect is emitted that indicates the start of the countdown, and with each passing second a short beep. In the upper bowl there are 30 grains of sand that should run out in 1 minute, so each grain runs out to the lower bowl in two seconds.
The grains in the lower bowl are arranged randomly, which is another approximation to a real simulation. After one minute has passed, a sound effect is emitted that indicates the end of the countdown, and now all the sand particles are in the lower bowl. If I now rotate the hourglass 180 degrees, the countdown starts from the beginning.
And finally, a short conclusion. This is a visually impressive hourglass simulation project, and despite its simplicity, there are many possibilities for modifying most parameters.