Arduino <3 Unity

I’ve recently bought myself an Arduino Uno R3 kit and I’ve built myself some simple projects to get a feeling of what is possible with this stuff! Having little to none experience with microcontrollers I must say the Arduino is quite simple to get into, and the community is awesome with ALOT of tutorials and questions answered online! Much like the Unity community! One of my first projects was to try to get the arduino to communicate with Unity! My plan was to make a gyro-accelerometer for use with my computer! 

For this I paired the Arduino with a  Wifi-Shield(ESP8266) and a GY-521(MPU6050) 6DOF gyro/accelerometer. I set the esp8266 to be a client, hooked up to my computer as the server. I used a free library for handeling the gyroscope which converts the gyro/accel raw data to quaternion rotation and sends it as a string on the serial line. The ESP8266 transmits the string over TCP to the server. 

In Unity i set up a TCPListener on a seperate Thread that continuesly reads the strings from the Arduino and converts string back to quaternion rotation.

In operation it looks like this:  

 The setup is not very accurate so not very useful, but fun project to get working! 

Now I’ve started working on something else! Bigger, better and more beautiful! 

9 thoughts on “Arduino <3 Unity”

    1. Hey, Jennyboss! How do you want to communicate with the arduino? My example uses wifi with a ESP8266 shield on the arduino. It only works with that kind of setup or similar I guess. Serial communication is easier and you should find some examples if you google. I’m not sure if I’m still able to find this project if you still want it, but I can see if I can find it!

  1. Heya Ronnie,
    I Have an Arduino uno,mpu6050 and ESP8266 -01 .
    I tried using nodemcu firmware on esp-01 and loading some lua scripts.But it didnt work as expected.
    So i started writing custom firmware to esp-01 .But the values i get by this approach are not faster.Values are unstable and slow

    1. I’ll have a look and see if I can find the project files! I’ll send you the files if I can find them! Send me an email so I have your address!

  2. Thank you.
    But sorry,I couldn’t find your mail in this website.Also i am not able to post my mail over here.Some protocol is considering it as a spam.
    Hope you have my mail address attached to this comment.

  3. hello, would you please post the way you did to send data from Arduino to Unity through wireless communications?

  4. Hello, Ronnie
    This is Jay. Recently I’m working similar project with you by connecting unity and arduino through wifi. Is it able to connect multiple wifi to unity? Like showing two or three cube on unity. Thankyou

Leave a Reply

Your email address will not be published. Required fields are marked *