Controlling Games With Just Your Hand

by hridaybarot1 in Circuits > Raspberry Pi

253 Views, 3 Favorites, 0 Comments

Controlling Games With Just Your Hand

pico.png
mpu6050_pinout.png
asphalt_ctrl_pico_img.png

Introduction

Have you ever thought of smart wrist wearable , that detects your hand gestures and let's you control various things, most importantly Games.

All of this for less than 7USD ? Well it's possible.

Well how do I get started? Let's go the the parts needed first:

This project requires very little suplies. As the all powerful Raspberry Pi Pico is used, which despite beign cheap, can do a lot of amazing things as it can run Adafruit's Circuit Python.

Raspberry Pi pico is NOT a microprocessor, instead it is a Microcontroller like the arduino but much more cheap and much more powerful. Board Specs: https://www.raspberrypi.org/documentation/rp2040/g...

The next Suppy you need is a Gyroscope and Accelometer Module called Mpu6050.

and Ofcourse you need wires to connect all the parts.

The Software for Raspberry Pi Pico:

Secondly you need to get circuit python on the Pico. To do that you simply need to download the uf2 provided from the link below, then press the BOOTSEL button and connect your pico to the pc (while pressing it) and copy the uf2 file to the pico and disconnect your pico.
Download to the Uf2 file: https://circuitpython.org/board/raspberry_pi_pico...

Supplies

Raspberry Pi Pico (4 USD)

MPU6050 ( 2USD)

Jumper Wires (x4)

Connecting the Parts Aka Wiring.

mpu6050_pinout.png
picoPinout.png

Next you’ll need to connect the mpu6050 to the pico. To do that you will need 4 jumper wires.
Connect:

GP15 and GP14 are the last pins on the left side of the raspberry pi pico. After doing so, connect your pico to your pc (you must have thonny configured)

Coding.

I have attached the code. The code is written in Python - CircuitPython.

What is basically happening in the code is I am getting raw values from the module mentioned above and converting them using atan2() into inclination. I am used those converted values to get the tilt(foward, left, right or back) and then sending keyboard keys respectively.
Lastly I am using intertia on the Z axis to get the gravity. So if the gravity value increases “nitro” is activated.

Downloads

Conclution

What next? Theoretically, we can share the laptop screen to a vr like google cardboard or oculus rift and play asphlat 8 in vr which is controlled by hand. I’ll make an update on it.

FAQs

1) Well then the coding process might be tought, you must train a ML model and implement neural networks?

-> Well no the code is only a 100 lines long, which trust me is not that much as it's written in Python.

2) I've heard of gimbal locks with gyroscopes, especially in the gyroscope we are using in the project. Is it a problem?

->No, circuit python's mpu6050, handles it very easily.

3) I mus execute the code everytime I attach my pico right?

->No, the controller is basically plug and play.

for any further questions: email me at hridaybarot1@gmail.com

for more projects visit https://hridaybarot.home.blog/blog-feed/