The Hourglass Project came to a finalization point. Project goals have been achieved. The LEDs light up and turn off giving the illusion of balls/sand particles falling down with the pull of gravity in all compass directions now. The hourglass also does automatic dimming/power saving if unused and on touch wakes up after power save. The combination of these make it a simple, but fully functional object satisfying the original targets.
I used 1 arduino UNO in combination with 3 LED matrix displays that can be cascaded. The picture below shows these connections. The connections are also covered as part of the source file comments on github.
The actual matrix looks like this: the side with the max7219 chip is where you connect to the arduino pins and the rest of the display matrices are connected from the other side. You can go up to 8 cascaded displays:
The above matrix can easily be driven by the Led Control Library. You need to add this to your arduino IDE via manage library options.
The other part of the puzzle is to have a good gyroscope/acceloremeter combo to determine the object tilt angles. I used a GY-521 breakout board. It uses 2-wire communications and the library I used needs one more interrupt line as well. Connections are as follows:
The GY521 library I used is available via git-hub. After downloading and extracting the library zip file you only need to copy the I2Cdev and MPU6050 folders within the Arduino directory to your IDE's libraries directory. This library was not available via manage libraries option within the Arduino IDE as of this time.
For project housing I folded a flat piece of cardboard into a rectangular prism. And mounted the boards on it with plastic hexagonal standoffs and bits of scrap 22 gauge wire. I used velcro tape that I had stocked on years ago to hold the cardboard folds in place. This cardboard housing also contains a battery compartment inside it with scrap wood to secure battery in place. The scrap wood at both ends of the box also allows the hourglass to stand vertical without falling.
Finally, a face plate from a black piece of cardboard with the hour glass shape cut out from it is velcro-stuck on the front of the housing.
One note here about the hourglass shape : the code shared would work with any physical shape, it does not need to be an hourglass, just change the bit array to define any kind of shape to mask where balls shd not go, the balls will still fall meaningfully obeying the gravity.
Overall this has been a fun project and I am happy with the result. Watch the final project video and if you like download the code from github.
You can run the pc simulation as well without arduino building.