Arduino a compass, serialproxy and Unity3d

I have been trying to connect my arduino to Unity3d 2.6 on both OSX and Windows.
Unfortunately the implementation of the SerialPort in the version of mono that Unity is using is broken on OSX.
I did have succes on windows, once I found out that the mono-serialport doesn’t support events and therefore is synchronous!!
The best way would be to use a native plugin, but that would mean you would have to use the Non-Free Pro version of Unity.
So.. In comes Tinkerproxy and  Sockets. Using a socket to relay the serial-data also means that you don’t need Unity to be on the same machine as the arduino.
I even managed to read the sensor data directly from an arduino with an ethernet shield!

So what happens if take a compass module and tie it to the y-rotation of a camera..
well here is a video of me sitting on a desk chair with my laptop and the compass on an seeeduino.
[ sometimes macbook interferes with the compass! especially when I placed the compass over the HD ]



2 Responses to “Arduino a compass, serialproxy and Unity3d”

  1. Looks great, can’t wait to try this using a nunchuck :)

    I once used a script Daniel van Gils wrote to set the weather inside Unity to correspond with the weather outside. It retrieved analog sensor informatie from pachube.com

  2. starlino says:

    This project looks very promising !
    You might want to consider a gyro in combination with your magnetometer (compass). Then combine the readings from both devices with a Kalman or similar filter. This way you’ll get smoother readings.
    Also the interface could be USB , emulating a mouse/keyboard/gamepad. Have a look at this project it might be of interest:
    http://starlino.com/usb_gamepad_gyro.html

Leave a Reply

Spam Protection by WP-SpamFree