Close

Gyro Sensor

A project log for Arduino gaming console

Connecting the virtual and physical worlds.

xtreme-techXtreme Tech 04/14/2022 at 17:000 Comments

One of the main components I have used in this project is the MPU6050 gyro sensor. The gyro sensor has brought in a physical aspect to my game which now requires the player to rotate the console sideways in order to move their character horizontally. The player can control the vertical movement using 2 buttons. 

The gyro sensor has 8 GPIO pins but I have only connected 4 to the arduino nano for this project. The ones I have used are :

 VCC and GND Pins - To provide power to the gyro sensor (gyro sensor requires 3.3V)

 SCL and SDA Pins - For communication

One of the challenges I faced was figuring out how to measure the angle of rotation using the gyro sensor. Eventually I understood how to measure the angle of rotation and then programmed my game to change the player's x position based on the angle measure by the gyro sensor along the x axis. I have used the MPU6050_light library to measure the angle along the x axis. 

                     Changing the player's position based on the measurements from the gyro sensor


Discussions