+1 500 000 products in offer

7000 packages per day

+300 000 clients from 150 countries

Quick Buy Favourites
Cart

DIY gaming controller with next- generation motion sensor technology

Date of publication: 14-08-2026 🕒 5 min read

Hardware you need:

1. Introduction

GyroRacer is a fun racing game designed for Arduino. You control a motorcycle by tilting your Arduino board left or right. The game uses a gyroscope sensor to detect movement and is displayed on a small OLED screen.

This project is perfect for learning about motion sensors and making games with Arduino. You will create a real gaming controller that responds to dynamic movement. It's just like the motion controls in modern video game consoles, but you can build it yourself!

2. Understanding motion sensors

MPU6050 is a motion sensor that can detect movement and rotation. It's made of two separate sensors embedded in one tiny chip.

The accelerometer measures acceleration forces. It can tell if the sensor is moving up, down, left, or right. Think of it as feeling the push when a car speeds up or slows down.

The gyroscope measures rotation speed. It knows when you're turning or tilting the sensor. This is what we are going to use to steer the motorcycle in our game.

The sensor is very small – only 4mm square. It uses I2C communication to send signals to the main component. This means it only needs two wires for data, making it easy to connect.

MPU6050 gyroscope and accelerometer module with labeled pins for VCC, GND, SCL, SDA, AD0, and INT.

Inside the sensor there are tiny mechanical parts that move when you tilt it. These movements create electrical signals. The sensor turns these signals into strings of bits compliant with the I2C protocol that are sent directly to Arduino.

In our project, we will mainly use the gyroscope part. When you tilt left, the sensor sends negative numbers. When you tilt right, it sends positive numbers. Arduino reads these numbers and moves the motorcycle on screen.

3. Circuitry

Breadboard setup with Arduino, MPU6050 module, and OLED display showing the game start screen.

The circuit is simple because we use I2C communication. This means multiple devices share the same two wires.

For the MPU6050, connect VCC to Arduino 5V, GND to Arduino GND, SCL to Arduino A5, and SDA to Arduino A4.

For the OLED Display, connect VCC to Arduino 3.3V or 5V, GND to Arduino GND, SCL to Arduino A5 (same as gyro), and SDA to Arduino A4 (same as gyro).

Notice how both devices connect to the same A4 and A5 pins. This is the magic of I2C – multiple devices can share these pins.

4. Setting up the code

Before uploading the code, you need to connect your Arduino to a PC. You also need to install some libraries: Adafruit GFX Library version 1.11.11, Adafruit SSD1306 version 2.5.13, and I2Cdev Library.

To install the libraries, open Arduino IDE and go to Tools, then Manage Libraries. Search for each library name and click Install.

There's an important step to save memory. You need to edit one file. Find the Adafruit_SSD1306.h file in your libraries folder. Open it in a text editor. Find the line //#define

SSD1306_NO_SPLASH.

Arduino board connected to a computer with USB cable next to breadboard and jumper wires.

Remove the two slashes at the beginning and save the file. This removes the Adafruit logo and saves memory for the game.

Assembled breadboard with MPU6050 and OLED display powered on during testing.

Download the code here: LINK

5. First calibration and playing the game

Proper calibration is very important. When you first turn on the game, it needs to register and pinpoint the starting position.

To calibrate, place your Arduino on a flat, stable surface. Turn it on. Don't touch it for about 10 to 40 seconds. The sensor is measuring its starting position during this time. Wait until you see the game start.

To play the game, hold the Arduino board in your hands. Tilt left to steer the motorcycle left. Tilt right to steer the motorcycle right.

OLED screen showing Lap 1 and current speed during gameplay on the breadboard setup.

Breadboard game controller held in hands while the OLED displays lap and speed information.

Try to avoid obstacles and stay on the road. The game gets faster as you progress.

If the motorcycle drifts by itself, you need to recalibrate. If controls feel jerky, check your wire connections. If the display isn't working, check your power connections. If the game feels too sensitive to your movement, you can adjust the steering sensitivity in the code.

You can also add sound effects with a buzzer, make the game easier or harder, or add new obstacles and features.

6. What you will learn

This project teaches many useful skills. You will understand how motion sensors work and how to use I2C to connect multiple devices. You will learn to create graphics on OLED displays and make interactive games with Arduino components.

These are the same technologies used in smartphones, game controllers, and drones. Once you understand this project, you can create your own motion-controlled devices.

The GyroRacer is a great starting point for learning about modern electronics and programming.

Have fun playing!

Close-up of the OLED game screen showing the road, vehicle, lap number, and speed.

Transfer Multisort Elektronik (TME) is one of the world’s largest global distributors of electronic components, electrotechnical parts, workshop equipment, and industrial automation. The catalog includes over 1,500,000 products from 1,300 leading manufacturers. TME’s modern logistics centers in Łódź and Rzgów (Poland), with a combined area of over 40,000 m², ship nearly 6,000 packages daily to customers in more than 150 countries.

TME also invests in the development of knowledge and skills of young engineers and electronics enthusiasts through the TME Education project, and supports the tech community by organizing the TechMasterEvent series, promoting innovation and experience exchange.

READ ALSO