<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dhruti Chandarana on Medium]]></title>
        <description><![CDATA[Stories by Dhruti Chandarana on Medium]]></description>
        <link>https://medium.com/@dhrutichandarana97?source=rss-da684ad3d00d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F8EONOM1akU9ta1ZqKu5vw.jpeg</url>
            <title>Stories by Dhruti Chandarana on Medium</title>
            <link>https://medium.com/@dhrutichandarana97?source=rss-da684ad3d00d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:51:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dhrutichandarana97/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Game Controller using Unity3D and Arduino]]></title>
            <link>https://medium.com/@dhrutichandarana97/game-controller-using-unity3d-and-arduino-f061c02fc344?source=rss-da684ad3d00d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f061c02fc344</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Dhruti Chandarana]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 17:57:06 GMT</pubDate>
            <atom:updated>2018-12-14T19:03:26.286Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many racing games available today and playing these games is too much fun! Generally in such games, we are controlling the car either by using keyboard or joystick. What if we are able to control it using our hand movements! This feature will make such games more interesting and allows developers to attract more players. With this idea in mind we have developed a device using Unity3D and Arduino which will control the player object (car) of the game using hand movements.</p><p>Unity is a game engine developed by Unity Technologies, in which we can make 2D as well as 3D games for various platforms. It provides support for two programming language: C# and JavaScript. Arduino is an open source hardware and software to interface with different sensors and actuators. Arduino provides an IDE in which we can write programs in C and C++ language and upload them to Arduino board.</p><p>How to use device:</p><ul><li>Move hand forward to move car in forward direction and move backward to move car in backward direction.</li><li>Turn hand left to turn car left and turn right to turn car right.</li><li>Press 1 from keypad for first person camera view, 2 for far camera view and 3 for normal camera view.</li></ul><p>Building Game scene and Interfacing sensors:</p><p>Game scene is made using Unity game engine. Car prefab provided Unity Standard Assets (vehicle category) is used as the player object of the game. The device consists of a simple controller made up of an embedded sensor MPU6050 (accelerometer) and a 4x4 keypad matrix. Arduino is used to interface with sensor and keypad. One reason to use Arduino as an interfacing device is that, Unity game engine provides supports to communicate serially with Arduino.</p><p>The sensor will provide reading along all three axes: X, Y and Z. To move car in forward and backward direction values along with X axis are used, and to turn it left and right values along with Y axis are used. Furthermore, we have attached a keypad which is useful to change the camera mode among three different modes which are first person, far and normal camera mode. We have scaled and formed these values to pass them serially to Unity game engine from Arduino Uno.</p><p>Setup for Device:</p><p>Software Requirements: Unity Game Engine and Arduino IDE</p><p>Hardware Requirements: Arduino Uno, MPU6050 Sensor, 4x4 Keypad Matrix, Connecting Wires and USB 2.0 cable</p><p>Download the <a href="https://www.i2cdevlib.com/docs/html/_i2_cdev_8h_source.html">I2Cdev.h</a> and <a href="https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050.h">MPU6050.h</a> libraries.</p><p>Connect Arduino with MPU6050 with Arduino and load “<a href="https://forum.arduino.cc/index.php?action=dlattach;topic=446713.0;attach=193816">MPU6050_calibration.ino</a>” and open serial monitor to set offset values for your MPU6050. Make sure MPU6050 is stable with no movement. You will get output as given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*T5BPD5ZZlKn00jlA" /><figcaption>Figure 1. Output of offset values</figcaption></figure><p>Once you obtain offsets value, input those values in “game_arduino.ino” as given in Figure 2. We need to set these offset values in the script as there is a requirement to stabilize these values in order to minimize fluctuation in the values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*KI_DddgzL1HDBgrw" /><figcaption>Figure 2. Placing offset values</figcaption></figure><p>“game_arduino.ino” script will scale accelerometer values according to speed of car in unity and pass these values serially to game engine along with value obtained using 4x4 keypad matrix. Upload that script in Arduino.</p><p>Once values are available on Arduino serial monitor open the game scene in Unity game engine, change the port number and set baud rate to 9600 in “CarUserControl.cs” script which is associated with the movement of car prefab provided by Unity Standard Assets. You can find the game scene in Assets folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/0*BH3r4tWWVqiqLyRQ" /><figcaption>Figure 3. Providing proper COM Port and Baud Rate</figcaption></figure><p>Build the scene again and open the .exe file from the Build folder or choose the option of Build and Run to play the game. Here is the demonstration of the device.</p><p><a href="https://drive.google.com/open?id=17tcbFrEKXeJIbSfUJW1_NpXealWuF3UT">IoT Game Video - Google Drive</a></p><p>Find the project here: <a href="https://github.com/Hstellar/Game_controller_arduino">github link</a></p><p><strong>Acknowledgement: Special thanks to Sumit Goyal for guidance and helping with project and to my teammates </strong><a href="https://medium.com/u/ac5287e2438e"><strong>Hena Ghonia</strong></a><strong> and Shanaya Mehta.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f061c02fc344" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>