Hand tools and fabrication machines Soldering iron (generic)
Story
The following elements are needed to make this project:
Arduino Nano
GY-521 module with the MPU-6050 sensor
0.96" OLED SPI display module 128x64 with SSD1306 chip
Buzzer
3mm LED diode
220 Ohm resistor
The rules of the game are simple: Tilt the sensor to move the ball around and try to catch as many squares as possible within 1 minute, without touch the borders.
Sketch below includes 2 functions: the game, if D7 is connected to GND; and a basic gyro test program that shows the pitch and roll values, shows them in an XY grid, and changes the buzzer pitch according to distance from origin.
For the OLED is used the excellent U8G library which allows many fonts and fast graphics. You will need to include 2 files in your sketch folder I2C and Kalman.h, they come with the MPU-6050 example.
The scheme is presented in the picture below. Detailed instructions can be found on the author's website cassiopeia.hk.
Finally, the whole assembly is placed in a box made of 3mm PVC material.