$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS Arduino

Arduino Gyroscope Game with MPU-6050

DFRobot Aug 09 2019 335

An addictive Arduino game on a 128x64 OLED display.

Things used in this project

Hardware components

Arduino Nano R3 ×1 
DFRobot 6 DOF Sensor - MPU6050 ×1 
Graphic OLED, 128 x 64 ×1 
LED (generic) ×1 
Resistor 221 ohm ×1 
Slide Switch ×2


Software apps and online services

Arduino IDE

 

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.

 

 

Schematics                  


 


 

This article copied from hackster.io, Author: Mirko Pavleski


REVIEW