AVS 8x8 VIDEO/AUDIO SWITCHER

Mark Johannessen/Daniel Petigrand

The AVS 8x8 is an eight channel audio-video switcher from Home Automation Control Systems (HACS - http://www.hacs.com/avs-8x8.html). The AVS8x8 (see picture) has two banks of channels: one for inputs and one for outputs. Each bank has 8 channels, and each channel has video (composite), and audio left/right. The AVS8x8 can be controlled by a direct serial connection to the computer, by X10 commands, or by IR commands.

 

 

The AVS8x8 is not a mixer. In other words, an output can only receive a signal from one input at a time. Thus, while is is possible to have a single video and/or audio signal routed to all outputs, multiple inputs cannot be routed to a single output. To do that you need what's called an "audio mixer" or "video mixer", both usually much more expensive than this device.

The AVS8x8 comes with a PC program that can be used to configure the AVS8x8 by connecting the AVS8x8 to the PC using a serial cable. The program is written in BASIC and not compatible with a Mac. So we set out to write something that can be used to configure the AVS8x8 via a Mac.

What we came up with was a web-based solution.

EQUIPMENT/SOFTWARE NEEDED

Here's what you'll need:

- An AVS 8x8 unit

- A standard serial cable (DIN 8 to DB9)

- An available Mac running OS 9 (NOT OSX) with an open modem port (right now - that is the only port the setup program can access)

- A web server running on the Mac (Personal Web Sharing or MacHHTP both work)

- A TW523 two-way power line interface(X10) and the RJ45 (4 wire telephone style) cable to connect the TW523 to the AVS8x8

- A video/audio source (X10 cams, TV tuner, FM tuner, etc.).

- A video/audio destination (a Mac video input, a VCR, etc.).

- The CGI's and web pages here.

- The Scripting Additions here.

- The serial applications here.

HARDWARE SETUP

1. With the AVS8x8 unplugged and the Mac turned off, connect the serial cable to the Mac's modem port and the AVS8x8.

2. Plug the TW523 into the wall and connect it to the AVS8x8 using the RJ45 cable.

3. Plug in the AVS8x8 (using the power adapter that comes with it).

4. Turn on the Mac.

5. Connect the video sources to the inputs.

6. Connect the video outputs to the devices to receive the video (or audio) signals. The example here will assume CHANNEL 1 VIDEO OUT goes to the Mac's video in (for example, a USB video capture device from EchoFX (http://www.echofx.com)).

SOFTWARE SETUP

The configuration of the AVS8x8 is done using two cgi's (actually, acgi's) running on the Mac connected to the AVS8x8. For this example, we are using Personal Web Sharing ("PWS"), but have tried it also using MacHTTP.

Personal Web Sharing Setup

Make sure PWS is installed on the Mac. This should give you a Web Sharing control panel, a Web Sharing Extension, and a control strip module. You should also have a "Web Pages" folder. From the download, you will put the following files into the Web Pages folder:

- avs_status.html (contains just a button to execute the acgi)
- avs_status.acgi (obtains the status of the AVS8x8 and reports back with an html status page)
- avs_set.html (where you configure the AVS8x8)
- avs_set.acgi (sets the configuration per the settings using avs_set.html)

Open the Web Sharing control panel. Make sure the "Web Pages" folder is selected as the web folder. You can leave the home page as "Using Personal NetFinder). The cgi's seem to work without any modifications to the preferences (that is, no actions defined under preferences). This seems to work for us.

Start up PWS and close the control panel.

Scripting Additions

You'll need the following scripting additions in System Folder/Scripting Additions:

- CTB.paul,
- Serial Tool, and
- Serial/Modem.

These show all be in the download for this software. You may have to restart the Mac for these to be ready for use by the cgi's.

USING THE SOFTWARE

You should now have the Mac and AVS8x8 fired up and running. Using the computer hooked up to the AVS8x8, open a web browser and type in "127.0.0.1/avs_status.html". There is a single button on this page called "Get Status". After a LONG wait (we do need a better way to communicate via serial with this thing), you should get a returned page that looks something like this:

This is the current status of the AVS8x8. It means Input 1 is routed to Output 1, Channel 7 "ON" is activated by X10 code G7, etc. Note also that X10 is enabled.

You can, of course, open this page with any computer on your network (or over the internet if the Mac connected to the AVS8x8 is exposed to the Internet) using the IP address of the Mac (such as "192.168.1.101/avs_status.html"). The pages also seem to fit nicely on an Audrey's screen.

Now, press the "RECONFIGURE" button. You should get a page that looks something like this:

 

Using this page, you can change any of the input assignments as well as the X10 assignments.

NOTE: This page does not necessarily reflect the current configuration of the AVS8x8, but a "default status" based on the underlying html code. Make sure all settings are the way you want the unit to be set before you press "MAKE CHANGES". Because of the size limitation for AppleScript, this page was done in plain html and not generated by a cgi, so it was not possible to pass the current AVS8x8 settings to this page. If you need to know the current settings, use the "Back" button on your browser to page back to the AVS8x8 Status page.

NOTE: INPUT ROUTING and ROUTING VIA X10 COMMANDS do the same thing. Once the AVS8x8 is configured, you will be using X10 commands to route the inputs/outputs of the AVS8x8. Once the X10 assignments are configured, the AVS8x8 doesn't need to be connected to the Mac any longer.

After making sure the configuration is the way you want the unit, press the "MAKE CHANGES" button. That will invoke the "avs_set.acgi" and return a confirmation page. Clicking the button on that page will take you back to the STATUS page (and report the changed configuration).

NOTE: Sometimes a time-out or other problem occurs that causes the avs_set.acgi to stop working. The problem is that all cgi's for some reason have to be run in the foreground. The script in both avs_status.acgi and avs_set.acgi try to compensate for this by making each run in the foreground, but not always reliably. If you don't get the page that says "Changes Accepted", try pressing the "MAKE CHANGES" button on avs-set.html again and see if that works. Also included in the download are two applications (Check Serial Port App and Force Close Serial PortApp) that can be used to fix messed up ports (for example, the modem port doesn't close properly). Try these if you get a "serial port busy" message.

USING THE AVS 8x8 VIA X10

The way you control AVS8x8 via X10 commands is by sending two X10 commands in rapid sequence: The first is an "ON" command to the housecode/unit code of the channel's output that says "Get ready for an input assignment", followed (within 1/2 second) by an "OFF" command to the housecode/unit code for the INPUT to route to that output.

Here's is one way to do this in XTension:.

In XTension, create units "AVS1, AVS2, AVS3, AVS4, AVS5, AVS6, AVS7, and AVS8". These represent the "channels" of the AVS (that is, sets of video and audio L/R). Assign the housecode and unit codes to these units per your configuration of the AVS8x8. In the example above, AVS1 would get a housecode/unit code of "G1".

You will then create another set of units to do the routing of the AVS8x8. For example, you can create a unit "J1" that responds to a remote controller on/off. Say you want that controller to have the AVS8x8 to route whatever is on input 2 (X10 cam receiver for example) into output 1 (that goes to the Mac video input). To make a "switch" to do that, using J1 as the example, edit that unit (in XTension) and add the following "ON" script:

turn on "AVS2" --- tells Channel 2 to wait for new input assignment
turn off "AVS1" -- the input assignment Channel 2 output is waiting for

That's it. Now, when you turn on "J1" with the remote, the above script will run and in our example, the video from the X10 cam receiver will route to output 1 (that is connected to the Mac with the USB video device).

TO DO

This software is a work in process and should be viewed as a starting point for your own AVS8x8 system.

The AVS8x8 is also capable to receiving commands via IR, but the cgi's here only deal with X10 configuration and control. Cgi's to control IR would be very similar to those involving X10. Still to do is writing the cgi's and set up page for IR control, and maybe more efficient AppleScript cgi's.

Any takers? If so - please share your work with us! :-)

FOR THOSE WHO LIKE TO TINKER ...

For those who would like to experiment with the cgi's and the interface, here is the serial protocol from the HACS site. Basically, you issue a serial command to the device and that command is either a "set" command (that sets a certain parameter of the unit) or a "read" command (that queries the device and returns a string that represents the status of certain settings). The command structure is:

!CCddddcc*

Where:

! - gets the device's attention
CC - the set or read command
dddd - the data
cc - the checksum
* - tells the device to execute the command.

If you look through the avs_status.acgi, one command it sends is "!8100007F*", that returns the status of inputs routed to outputs 1-4.

The cgi's basically do this:

- construct the commands (such as that for getting the status of units 1-4 - !8100007F*)
- open the modem port (here - as the cgi's are written ONLY THE MODEM PORT WILL WORK)
- sequentially send each of the characters of the command
- if the command is to obtain settings, read the serial port of the device and format the output for the returned html
- close the modem port

Have fun.

Mark & Daniel