I guess I’ve been using Blender for so much for so long that I tend to look for ‘Blender-like’ controls in a/v projects. So inevitably when I started working with LED strips I immediately tried to weasel out of having to think through functions and loops in arduino code to create effects I could do intuitively in Blender.
So after a few bad UI attempts I thought – hey, wish I could just design a light sequence in Blender and run it with ALT-A. So that’s what I did.
On the arduino side it’s using the FastSPI and CmdMessenger libraries for LED and serial communications.
The Blender script just reads the diffuse color in r-g-b from each LED objects material and spits it out to the USB port. Getting the pyserial library hooked up in Blender wasn’t a breeze but the “sys.path.append” line should help anyone having the same issues I did.
Here’s the arduino code and Blender file
(Using Arduino Duemilanove 328 and LED strip with WS2801 chips)
EDIT:
Blendernation article (Thanks Bart!)
I forgot to mention I’m using Ubuntu so the sys.path.append thing wont work for windows, you’ll have to find the pyserial library solution elsewhere (there’s plenty of reference out there)
Also – the script runs on each frame change. Here’s how that works (WARNING: kinda hacky) http://funkboxing.com/wordpress/?p=236
QUESTION: For any API guru’s out there – currently this script opens and closes the serial port on each framechange. I know this is radically inefficient. Any ideas on how to keep the serial port open persistently but to close it when blender closes?

Is that RGB sequence too big to be stored in the Arduino itself?
This sequence is about 500 frames, each frame sends about 16 bytes per LED. So that could run up past the 30k on the Arduino pretty fast I’m guessing.
I could probably store short sequences on the board, or use a SD sheild for longer ones. For now my goal is to simplify designing the sequences.
Playing them back could be done a number of ways.
Also I guess I should do this in the BGE also to allow more live-interaction.
Perhaps you could bake the color changes into keyframes, and then optimize the keyframes and do the interpolation on the Arduino itself? Or would it still use up too much memory?
Keyframes would certainly make the memory requirements manageable, but I think that kind of interpolation might be beyond the capacity of the ATMega328. Might try it out just to see.
[...] For now it’s just USB/serial interface but over time I plan to integrate DMX/Artnet protocols (though this will probably involve creating an arduino sheild for the purpose. It’s just baby steps but I thought it might be cool enough for a post. Hope you enjoy! Get the Arduino code and blend files here. [...]
incredible, nice work!!
[...] Read all about it vie blendernation. [...]
[...] on funkboxing.com Like this:LikeBe the first to like [...]
I know absolutely nothing about Arduino or Blender but this project reminds me of something neat I came across a few days ago.
SpokePOV
Nice work.
I stumbled across the BlenderNation article which refers to here.
As for your question at the bottom: for a project of mine (non-Blender related) I am working on controlling Arduino with the pyFirmata software (www.firmata.org). It’s a standard Sketch that can be found in the Arduino IDE. Basically, it sends all Arduino data to the host computer for processing. Serial communication is taken care of by Firmata, and you can program in Python…
There is the pyFirmata host-end (made by Tino de Bruijn, Tinodb) for python2. I am close to finished porting his module to Python3. You might want to take a look at https://github.com/appultaart/pyFirmata.git to grab the source (check the py3k branch). This might solve your issue, perhaps.
Cheers