Notifications
Clear all

[Closed] Arduino to 3D Studio Max

I’m new here, so first of all, hello everybody ^^

Don’t know if you saw that, but I managed to have an Arduino board talking with 3D Studio Max 2008.
You can see the video and more infos on how I did this here :
http://play-collective.net/blog/archives/61

The problem is that it’s a real problem sources, as there is 4 different softwares just to transfer the data from the Arduino to 3DS.

So what I want is to be able to read the serial port on which the arduino sends the data (COM5 in my case) directly from 3DS, either using a maxscript with a dotnet dll (or else), or directly by using the 3DS SDK.

The problem is that I never worked with dotNet or the SDK before. I just have basic knowledge of maxscript (my best one parsed the jpegs files in a folder and created a plane with the jpeg as a texture). I can slightly understand C++ syntax, but I’m willing to learn.

I can install the 3DS SDK and Microsoft Visual VB, C++ and C# express. I’m running Windows XP SP2 with all the windows updates

Is anyone kind enough to help me through the steps of this project ?

What I see as a final goal is a Plugin or Maxscript that would allow to read datas from sensors plugged to an Arduino board (or other serial port friendly hardware) to use it directly in 3DS, in realtime like with the Motion Capture Controller, without having to parse log files.

Cheers ^^

melka

7 Replies

You can easily use python to read the serial port and communicate with Max via COM I dont no if dotnet has sockets to use for communication… But it should not be a problem with python… See the python + mxs thread for lots of COM examples.

Cheers
Dave

Hi Dave
In fact, .net is not as hard as I thought ^^

I have the arduino sending values to my maxscript, no pb with that.
I just have to figure out how to update the viewport in “realtime”. I’d like to do approximately the same thing as the Motion Capture Controller : realtime viewport update + writing keyframes. I won’t have pb writing the keyframes.

Here’s the little code I have to read the serial port

port = dotNetObject "System.IO.Ports.SerialPort" "COM5" 115200
 port.Open()
 for i = 0 to 100 do (
 	rotX = port.ReadLine() as Float
 	rot_obj = eulerangles rotX 0 0 
 	rotate $Box01 rot_obj
 )
 port.Close()

I was just trying with the rotate thing, but as expected, my viewport won’t be updated until the for loop is finished.

Cheers ^^

melka

Damn, it’s really too easy… This is starting to look good (except that my while loop avoid me from quitting the script), I need to figure out some stuffs (like having the “read port & move objects” sequence in a background thread, so that I can continue to click on buttons). I’m starting to love this wiichuck under max… ^^

port = dotNetObject "System.IO.Ports.SerialPort" "COM5" 115200
port.Open()
x = 1
while x > 0 do (
	rotX = port.ReadLine() as Integer
	rotY = port.ReadLine() as Integer
	rot_obj = eulerangles rotX rotY 0
	$Box01.rotation = rot_obj
	completeRedraw()
)
port.Close()

Hi melka,

The dotnet sockets looks REALLY easy nice work… I just ordered an Arduino so I am looking forward to having play myself.

Cheers
Dave

Hi Dave
I don’t know if this socket is by default under windows xp or whatever, so just for your information, I installed the Visual C++, C# & VB from http://www.microsoft.com/express/
Not sure you’ll need this, just in case ^^
Looking forward to what you’ll come up with the Arduino under 3DS

Hi
Melka
I realy like the interfacing that you are doing and would like to try. I have som avr experience so i can supply serial data easily enough , but what has to be installed on my windows pc in order to get that code examole to run. I’m still stuck in the old days of vb6.0 and vc6.0.
thanks
dazza111

Hey guys, keep this thread active! I’m very interested in the possibilities of the Arduino for the scripting community and want to order one myself!

Keep us updated on your findings! Fascinating stuff.