Close
0%
0%

WiFi Motionbuilder control

A WiFi remote control targeted for Motionbuilder, but flexible enough for other uses.

Similar projects worth following
We wanted a way to control Autodesk Motionbuilder wirelessly while on a mocap stage. We wanted a device you could use without looking at it, so a smartphone or tablet wouldn’t work. To accomplish this I used an Arduino Micro and a CC3000 WiFi breakout board for communication and a Trellis for user feedback and input. I used potentiometers to allow finer and faster control of things like focus distance, field of view and ISO speed. It uses a simple telnet protocol to send button presses and potentiometer values.

I wanted to create a wireless remote control allowing a user to be anywhere in the mocap stage and be able to play, pause, start and stop recording, switch cameras, and control camera settings.

I used an Arduino Micro without headers for my control board. I used the “Adafruit CC3000 Wifi breakout board with uFL connector” and “2.4GHz Dipole Swivel Antenna with RP-SMA - 2dBi” and “RP-SMA to uFL” for the antenna, but I probably could have gotten away with the built in ceramic antenna on the breakout board.

I modified the ChatServer example provided by Adafruit to use for my arduino code. Pressing the trellis buttons sends “dn##” and releasing the button sends “up##” where ## is the number padded index of the trellis button. In my case a value of 00-15. In the future I will probably drop the number padding because I can easily parse the string in python..

Adjusting the pot sends “pA#”, “pB#”, or “pC#”, where # is the current value of the pot without number padding.

To pass the button presses to Motionbuilder I wrote a python script that uses telnetlib. telnetlib blocked the Motionbuilder user interface and my attempts to use a QThread kept causing Motionbuilder to crash. I ended up creating a standalone python script executed by subprocess.Popen. It connects to the arduino telnet server, listens for input. When it receives a button press or pot value change it sends the command to Motionbuilder by Motionbuilder’s telnet interface.

The MoBoReceiver class in Motionbuilder receives the input passed to it by the external script, parses it using regex and calls the appropriate function calls to make Motionbuilder switch cameras, adjust FOV, etc.

The Arduino Micro doesn’t have enough flash memory to store the WiFi lib, trellis lib and the mdns library I found https://learn.adafruit.com/wifi-candy-bowl/multicast-dns, so to make sure I could connect to the arduino if I didn’t have access to the wireless dns server, I used the trellis’s leds to display the ip address in binary. The first led represents 1, second is 2, third is 4, … 8th is 128. To display each octet I used the last 4 buttons. I didn’t take the time to reverse the button order, so the first button on the last row is octet 4, the second is octet 3, etc. To make it easier to translate the binary display data into a usable ip address, I created a PySide dialog. We ended up getting a wireless router dedicated to this project, so I ended up registering the arduino so it always got the same ip address.

iphelper.gif

Kevin modified the 3d printable case provided by Adafruit. He extended one side to to hold the pots, create a place to hold the arduino, which doesn’t have much room for mounts and place to attach the antenna. We left room for a 9 volt battery. The 9 volt battery didn’t last long(just like the entire internet told me it would), so I ended up duct taping a usb battery pack to the back of the case. I was able to pick up a 1500mvh one at Ross Dress for less for $10.


If I do another version of this project, I would like to get a Spark to replace the Arduino and CC3000. I also would consider using two Arduino micros with xbee’s using one of the micros as a human interface device so the python script wouldn't be necessary and you wouldn't need a WiFi network.. I got the external antenna to make sure I didn’t run into signal issues on the stage, but after testing the on chip ceramic antenna available with the CC3300 would have sufficed.

  • 1 × Arduino Micro without Headers
  • 1 × Adafruit Trellis Monochrome Driver PCB
  • 1 × Adafruit Silicone Elastomer 4x4 Button Keypad
  • 1 × Adafruit CC3000 WiFi Breakout
  • 3 × 10K-Ohm Audio Control Potentiometer

View all 10 components

  • Mapping limited potentiometer value to a number line

    Mike Hendricks08/21/2014 at 05:28 0 comments

    Arduino reads potentiometer values from 0 to 1023. If you want to use the potentiometer value to drive a number input in Motionbuilder, you have to choose the range you want control over. This means you have a limited range of values to work with.

    What if you wanted to use the same potentiometer to drive multiple values? For example you have two cameras, and the pot value controls the fov. You rotate the pot to 512 setting the fov on the first camera. You then switch to modifying the second camera. If the second camera was set to 100, as soon as you rotate the pot the camera will jump from 100 to 511.

    Additionally what if you want finer control? Say if you want the full range of the pot to be half of the current range.

    The best solution I can think of is using some sort of rotary encoder like the scroll wheel of a mouse. This would be the simplest and easiest way to handle this, however I came up with using a sliding offset when mapping your pot value to the object value.

    For this to work you need a pot, and two buttons(Offset, and High Res). When you rotate the pot it adjusts the value mapped between offset and offset + resolution. While holding "offset" when you rotate the pot it adjusts the offset but the value remains the same. While holding "High Res" when you rotate the pot it will adjust the value but the resolution will be half the size it currently is, allowing you to adjust the value with more control. Given your offset = 5, resolution = 10, value= 10, and your pot is at 50% rotating the pot to 0% with "High Res" pressed(multiplying resolution by 0.5) will result in your value being set to 7.5. The same rotation without "High Res" pressed would result in the value being set to 5.

    To calculate this you need 4 pieces of information.

    • The current value
    • The offset. This is the value when your pot value is 0
    • The resolution. This added to the offset will be the value when your pot value is 1023
    • The Multiplier: This value is used to shrink the resolution

    Here is a python example of how to map the values.

    Read more »

  • Everything connected

    Mike Hendricks08/20/2014 at 06:06 0 comments

    This video shows the control after I got all of the components connected and testing with telnet. It shows how I can turn on the Record LED from the computer. Unfortunately I ran into problems trying to open a second connection to the Arduino from inside motion builder to send the control character. So far I haven't been able to figure out how to connect to a event in Motionbuilder that will notify me when Motionbuilder is recording.

  • Early Prototype

    Mike Hendricks08/20/2014 at 05:19 0 comments

    For the first version of this project, I bought an Arduino shield version of the CC3000 and attached it to a Arduino Uno I had laying around. I soldered a couple of buttons to the breakout board and a LED that turned on while the device was booting, and turned off once the device received its IP address.

    This version gave me a proof of concept and allowed me to plan out the next version of the WiFi control.

  • Basic Design

    Mike Hendricks08/20/2014 at 04:56 0 comments

    There are only a few components. Arduino Micro, a Wifi Module connected over a spi bus, a trellis 4x4 button and led display matrix connected over i2c, and 3 potentiometers connected directly to 3 of the Arduino analog inputs. Currently I am using a USB battery pack connected to the Arduino usb for power.

View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates