PDA

View Full Version : Is a Module to Output to Arduino via Firmata or Bitlash possible?



cobright
12-06-2013, 05:46 PM
There seems to be an inordinate level of confusion (I swear it is not just me) over a lot of aspects of hooking Vixen up to an arduino. People report downgrading back to Vixen 2. There are at least a half dozen different sketches floating around meant to receive the serial data from Vixen. There is uncertainty over what is the best serial data configuration. Reports of this or that bit length causing sequences to go out of step. And ... well enough chaffe that it's really hard for someone starting to sort it out.

I was just wondering if there has been an attempt to set up Vixen use existing protocols like Firmata or Bitlash when output is meant for an arduino board? This would take so much of the uncertainty away. For each protocol there is a single host sketch that you load onto the board.

I normally hate to be the guy who drops a question like this, like I expect everyone else to solve this for me. I don't. I'm not capable enough to code a new module like this, but it seems like a worthy effort. Just putting it out there.

jchuchla
12-06-2013, 06:30 PM
Well first let me start by saying of course it's possible. Anything's possible.

I'm also going to say, that I make a living making X talk to Y. And I've never heard of these two protocols you mentioned. I had to google both to figure it out. And after a cursory googling, I'm not thinking either is particularly well suited for the Vixen to Arduino lighting application. Though they could be made to work for small implementations. Lighting protocols for show lighting are almost always continuous streams of data, containing full channel information for each device in each frame regardless of whether or not it has changed from the previous frame. They are also, almost always strictly unidirectional communications. These protocols you mention seem to be more of an on demand type of thing where you'd only have it send when and if the data has changed.
I've seen several questions lately about making vixen compatible to Arduino. And every time I answer, I have to remind people that Arduino is nothing more than a development platform. It doesn't do anything until you program it to do so. The vixen team can't make an "arduino controller" module because such a thing isn't defined. one guy may have 8 relays hooked up. Another may have a dimmable RGB strip light circuit. We have several protocols available that you can listen for and react to. It'd probably actually be best to use a protocol that is designed for lighting control. DMX and Renard come to mind, and sACN is an even better one too if you want go as far as adding an Ethernet shield. The Generic Serial protocol works as well, though it's not standardized and would require some tinkering to get it to work right for you. There are a few readily available DMX libraries out there for the arduino. It would be pretty much the same complexity to use that library as any of these others you mentioned. Actually it'd probably be less complicated because the rules are already built into the protocol to work well for lighting control.
I really don't mean to shoot you down, but this really isn't a Vixen 3 (or any vixen version) topic. Yes Vixen can be made to support more protocols than it currently does. The protocols you mentioned are not really protocols, but rather frameworks. In order for Vixen to support a protocol, that protocol needs to actually exist. And it needs to exist in some standardized, or pseudo-standardized way. There's nothing in Firmata or Bitlash that tell me how to control a lighting device. Or what the attached devices are expected to do. I wouldn't know where to begin writing a output module to control an "unknown"

cobright
12-07-2013, 02:32 AM
Thank you jchuchla, that's a fair and helpful response.

I guess what I was thinking was more a matter of settling the physical layer (so to speak).

As you say 'Arduino' isn't a device, it's a platform. But that's exactly the point. It's a unified development platform. If Vixen sends a code to light up channel #1 to a module that corresponds channels to digital pins and activates them on the arduino hardware using the Firmata protocol, then that's ALL Vixen has to worry about. The handshaking between computer and arduino device is done through Firmata. From Vixen's point of view it doesn't matter whether I have an Arduino UNO on the end of my USB cable or a Mega or a DUE or (when they get Firmata ported over) Stellaris Launchpad.

For that matter, there is nothing in the ASCII Serial protocol Vixen uses to communicate with the arduino UNOs and MEGAs with relay boards and such that tells it what kind of device is plugged into pin-1.

Here are some specifics on Firmata (http://firmata.org/wiki/Protocol). Firmata is a developed protocol based on MIDI and SysEx. By having Vixen output to Firmata instead of serial you bypass all of the work done getting a particular board to listen properly for the serial commands. Somebody upgrades their board, all they have to do is flash it with Firmata and it will work with all their old sequences. Firmata allows direct control of 128 arduino pins per connection so a pretty large number of SSRs or MOSFets can be triggered using a single $60 arduino dev board as a controller (There are Arduinos like DigiX with that many pins on board).

Admittedly, this is mostly a problem for folks like me who want to use Vixen to control a half dozen to maybe sixteen or twenty strings of lights. Out of the box I can set up an arduino board and 16 relays for about $40. Using Firmata and Processing 2 (runs programs on the PC and outputs to Arduino board), I can output music audio and blink the 20 strings of lights but it requires me to set each change in pin state manually in the Processing program. It's tedious work and exactly the kind of thing Vixen is meant to do.

Maybe I can just parse a Vixen file or the serial output to get the timing for each event.