Toiletpaper Hoarding Motion Controlled Game

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

Items used in this project

Hardware components

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

Software apps and online services

 Unity3D The game engine

Hand tools and fabrication machines

 3D Printer x 1 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:

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.

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.

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

references:

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

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