Toiletpaper Hoarding Motion Controlled Game

About the project

A simple implementation of an Arduino connection with the Unity3D game engine using motion controls to control you quest for toiletpaper!

Project info

Difficulty: Easy

Platforms: ArduinoUnity

Estimated time: 2 hours

License: MIT license (MIT)

Items used in this project

Hardware components

Arduino Uno - R3 Arduino Uno - R3 x 1
Triple Axis Accelerometer and Gyro Breakout - MPU-6050 Triple Axis Accelerometer and Gyro Breakout - MPU-6050 x 1
Sparkfun Bluetooth Modem - Bluesmirf Gold Sparkfun Bluetooth Modem - Bluesmirf Gold Any Bluetooth adaptor will do x 1

Software apps and online services

Unity3D Unity3D The game engine

Hand tools and fabrication machines

3D Printer 3D Printer x 1
Soldering iron Soldering iron x 1

Story

Toiletpaper Hoarding Game

I made a Little game about living your wildest fantasies of hoarding toilet paper with motion controls using an Arduino.

You can watch the video I made about the whole process if you want to know more:

Explainer video:

Further explanation

I went on this little adventure because I recently got an Arduino to play with. I am using the Accelerometer to measure the relative angle to the center of the earth (gravity) to calculate the rotation of the device. That rotation is then translated into a forwards and backwards motion and and a rotation amount.

I 3D printed a housing for the Arduino and the other components, so I could mount them to a bar. This way, I was able to hold the contraption like a real shopping cart, and control the tilt with greater precision. The Arduino code itself is pretty basic. I adapted some existing scripts (links in the script itself) to fit my specific need.

The Unity3D engine can read the serial data transmitted by the Arduino. That data arrives as a string which is converted to a series of float values corresponding to the data from the accelerometer. The script translates the offset from the downwards gravity vector into a translation and rotation of the player character. I used the pitch angle to move forwards and backwards and the roll to rotate. 

Source Files

https://github.com/Jellevermandere/ArduinoMotionControls

This small project includes the basic set-up for a motion controlled game with an Arduino powered Accelerometer. There is also a sound controller which listens to the microphone and does something when that value goes above a certain level. All the 3D printable parts and full Blender model are also included. Be sure to adapt the diameter of the parts so they can fit your own bar.

Play/download the full game here:

https://jellever.itch.io/toilet-paper-hoarder

references:

Arduino Connection : https://playground.arduino.cc/Main/MPU-6050/#measurements 

Bluetooth adaptor : https://create.arduino.cc/projecthub/mayooghgirish/arduino-bluetooth-basic-tutorial-d8b737 

Unity Microphone Tutorial : https://www.youtube.com/watch?v=GHc9RF258VA

This project is licensed under the terms of the MIT license.

Schematics, diagrams and documents

Schematic

CAD, enclosures and custom parts

3D printable Parts

Go to download

Code

All the files are on the GitHub repository

Credits

Photo of JelleVermandere

JelleVermandere

Gamedesigner, always looking for an exiting new project

   

Leave your feedback...