Monday, January 19, 2015

QLab serial projector control with AppleScript

If you are using QLab for video cues, I suggest having it triggered by the light board as most projections need to be synchronized with lighting. That way projected scenery will fade in and out with area lighting during scene changes. It is fairly easy to connect a USB MIDI interface between the Mac and the "MIDI OUT" of your light board.

Most projectors have a RS-232 serial port which will allow you to do things like turn the projector on and off, switch video inputs, and close the shutter or "AV Mute" to save lamp life when there are no projections. The syntax of these serial commands is sometimes in the user manual, or available as a separate downloadable PDF from the manufacturer.

Tripp Lite makes an excellent VGA + Serial extender that works over CAT5 cable.

Power On - send this command when the light board operator runs the cue to warm up the lights - usually called a prewarm cue. You can auto-follow this into additional script cues to unmute and switch inputs to "reset" the projector for the top of the show and send a test image such as the classic indian head test pattern. Just make sure to put in a cue for preshow that fades out and stops this image and mutes the projector for the top of the show.

AV Mute - send this command after completing a fade to black that will stay up for a long time. This will preserve lamp life and prevent overheating.

AV Unmute - send this command to come out of AV Mute, wait 1 second then begin an image fade-in. Some projectors can come out of mute even faster.

Power Off - send this command at the end of the show - usually tied to the "house lights up" cue on the light board.

I use a StarTech USB Serial interface with OS X Mavericks. It makes both /dev/cu and /dev/tty "usbserial-FTXX7Z75" devices (A/B/C/D depending on how many ports your interface has) available to the operating system. The "cu" versions don't wait for flow control so you want to use these with the AppleScripts you put into QLab. To list the interfaces available on your Mac go to Terminal and type
ls /dev/cu*
There are two ways serial commands will be defined in your projector's user manual. They will either be ASCII or Hexadecimal. The ASCII commands are easier to script, but here are examples of both:

ASCII example:
-- Optoma W306ST Power On
set sCmd to "~0000 1" & (ASCII character 13)
do shell script "echo " & quoted form of sCmd & "> /dev/cu.usbserial-FTXX7Z75A"
Hexadecimal example:
-- Mitsubishi HC3 Power On
set sCmd to (ASCII character 92) & "x30"
set sCmd to sCmd & (ASCII character 92) & "x30"
set sCmd to sCmd & (ASCII character 92) & "x21"
set sCmd to sCmd & (ASCII character 13)
do shell script "echo -e " & quoted form of sCmd & "> /dev/cu.usbserial-FTXX7Z75A"
Notice in the Hexadecimal example above the echo command needs the -e switch so that it knows to parse \x30 as hexadecimal 30. Since AppleScript considers \ a special character, you need to build the sCmd string using (ASCII character 92) rather than just typing "\" into the character string.

A note on using VGA + Serial extenders: Some projectors' serial interfaces are finicky about the extender interfaces being turned off. I suggest putting these units on a separate power circuit from any power conditioner your QLab Mac is on. Keep them on all the time and the projector's serial port will always be responsive.

No comments:

Post a Comment