i have tested a MPU6050 gyro sensor. And i decided to simulate some sand in a box.
I have used the following components:
MPU6050 gyro sensor
32x8 led matrix
Step 1: Hardware
Aboth you can see the schematic, done with fritzing.
The led matrix is controlled by MAX7219 controllers. They are controlled by spi from the arduino.
The MPU6050 is controlled by I2C from arduino.
Step 2: Software
To control the MAX7219 controllers i used the LEDControl library, which you can find here:
You can find there some examples to use this library, too.
Some example code to control the MPU6050 i found here:
The remaing stuff are cases for different angles of the MPU6050. You can find them at the end of the file gyro_sensor.ino. The util.ino includes a little framwork to draw pixels in the led matrix.
If you have questions, dont hesitate to ask me :).