Blender 30/30 Day 11: Arduino to Blender

What I Did and Why

Using the AddOSC plugin for Blender and the oscP5 library for Processing, today I was able to get a proof of concept for an Arduino device chatting to Blender.

I’m not 100% sure how useful it is in its current state, but with Blender’s real-time capabilities getting a good kick in the upcoming 2.8 release, perhaps I’ll find something both interesting and practical to do with it soon.

My ultimate goal with here is to somehow aid in camera tracking with a physical device that saves the camera movement, but I’m very far away from that with this proof of concept.

Do It Yourself

The code for the project is here. The general workflow is:

  1. Get your Arduino talking to Processing via Serial communication. The data I’m sending is Pitch/Roll/Heading read from the LSM9DS1 from Sparkfun.
    [The examples for Arduino and Processing Serial are great templates to start with when tackling Serial Communication]
  2. Get Processing talking to Blender via OSC. There’s a good writeup of how to do that on Blender’s side here.
    [The oscp5 library has a clear example of how to get started sending messages via OSC]
  3. Profit

Complications

Right now I’ve locked the rotation to the X and Y axis. For some reason that’s far beyond my currently meagre understanding of rotation (involving quaternions and orders of rotation and a lot of maths), when all three axis are used the Blender camera goes a bit bonkers.

I’m looking into ways to fix this problem, but for now this setup works as a proof of concept, and maybe as the beginnings of a 2-axis pan/tilt tracker.

 

Leave a Reply

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