[RDD] Serial Switch Code

Brad Beahm brad at kliqfm.com
Mon Jul 6 12:50:52 EDT 2015

This is very possible!  I'm using this every day to have Rivendell start
back up after playing from another source.

Here's how I'm doing it: (and I too got lots of help from this list to make
it happen)

First the software-
RDAdmin>SerialPorts> and make serial0 /dev/ttyS0
make sure the Enable is checked

In RDAdmin>Manage Hosts>(your hostname)>Switchers GPIO>
Select Serial 0 from the dropdown.
I added a new switcher with matrix 0 (probably irrelevant, choose any #)
The type is Serial Port Modem Control Lines
This gives you 4 GPI Lines (input contact closures) and 2 GPO (output

You can then assign macro carts for 'on' and 'off' states. Probably 'on' is
all you'd need.

You can make a macro cart that is called "Push first button of playlist"
and the macro code is PB 1!

Or another way to program it is to have RDAirplay accept the GPI instead of
the 'Configure GPI' option in the Edit Switcher window.
Go to the RDAirplay options in RDAdmin and click on Edit GPIOs next to Main
Log Output 1
Make the Start GPI (Switcher Matrix #) and (relay #).  So in my case I have
it 0 and 1... Relay 1 on switcher matrix 0 starts the main log 1

Now the wiring-
You'll need voltage to run across the pins from your input pins to ground.
I used a 9v battery in testing but I think 5 or 12v works fine too.  There
may already be voltage on your contact closure with the alarm. I'd check
with a mulitmeter

Your inputs...
CD (Carrier Detect / GPI ) - Pin 1
DSR (Data Set Ready / GPI) - Pin 6
CTS (Clear to Send / GPI) - Pin 8
RI (Ring Indicate / GPI) - Pin 9

Your outputs...
DTR (Data Terminal Ready / GPO) - Pin 4
RTS (Request to Send / GPO) - Pin 7

Ground - Pin 5

You'll also want to use the RDGpiMon to see that you're getting the relays.
It's a great visual to make sure you've got it set up right.

And I've realize that I used a great tutorial that may be easier to
understand..... that is below from Lorne Tyndale when I got help on this
same issue.


I'm running 2.10.3.  It took me a bit to figure out how to get it to
work under Ubuntu, but it does work for me now, so here's a quick run
down of the steps.

To enable it in Ubuntu / Debian, first add your user to the dialout
group (at least I think the Dialout group exists within Debian) with:

sudo adduser username dialout

Then log off and log back in.

Next, go to RDAdmin --> Manage Hosts --> Select your host

If you have not already done so, enable your serial port.  Click Serial
Ports, select the port ID (in my case I'm using Serial0), select the
Enable box, and then for the TTY Device, put in the TTY Devive of your
serial port - in my case I put:


Because I'm using the first serial port on my system (Com1 from the old
DOS / Windows days)

Next, click on Switchers GPIO, then click ADD.  Select a Matrix number
and at the bottom of the Switcher Type pull-down list, find "Serial Port
Modem Control Lines"

On the next screen, you can give it a description, and you can configure
the GPI's (you'll have 4 of them), and GPO's (you'll have 2 of them).
You can assign macros to the ON and the Off transitions for each control

The device then will be in the matrix under the device matrix ID you
assigned, you can control the GPO's with macros and such.  It'll also
show up in rdgpimon if you run that to monitor.

I can't recall if I had to restart the daemons or not, if it initially
doesn't show up try restarting the daemons.

For testing, the important parts of the pinout on the 9 pin serial port

CD (Carrier Detect / GPI ) - Pin 1
DSR (Data Set Ready / GPI) - Pin 6
CTS (Clear to Send / GPI) - Pin 8
RI (Ring Indicate / GPI) - Pin 9

DTR (Data Terminal Ready / GPO) - Pin 4
RTS (Request to Send / GPO) - Pin 7

Ground - Pin 5

The GPI's are just looking for a positive or negative voltage, if I
recall correctly the specification calls for 3 to 25 volts (+ or -).
When I tested I just built a little box that held 2 AA batteries (its
actually the remains of an old flashlight), with the negative to ground
and the positive alternating between pins 1, 6, 8, and 9, it was enough
to trigger the GPI and I could see it responding on rdgpimon, with
RDAirplay responding the way I'd built the macros that I'd assigned to
the GPI's to respond

The GPO's will trigger a voltage, for my testing I just wrote a couple
of macros to turn them on and off and put them on the panel, then just
watched the voltage on my multimeter.

At least for me in testing it all functioned as expected.  My next step
is to wire it into a production environment.

Considering that there are still lots of systems on the market that have
at least 1 (and often times 2) serial ports, if you don't need a lot of
GPIO's then it is a reasonable way to go (and you can't beat the price)

Lorne Tyndale

On Sun, Jul 5, 2015 at 4:55 PM, Robert Jeffares <jeffares.robert at gmail.com>

> This is a bit off topic but likely someone in the group has already done
> this:
> We have an audio fail alarm which monitors outgoing audio and as well as
> sounding a local hooter, has a series of contact closures for 'no audio'
> 'someone has hit alarm reset' 'standby programme playing'  ' normal audio
> restored'.
> I had thought that wiring the contacts to a serial port and finding a
> script that would monitor the contact closures would be easy.
> Over confidence 1 Success 0
> There must be some code somewhere which allows ttyS0 to be used as a
> contact close alert.
> I have googled and searched what code books I can find and I am stuck.
> Any help, humorous comments, pointers to code, will be appreciated.
> I would have thought the serial port would have been an obvious external
> control point, but mostly it's where I can plug expensive external boxes.
> regards
> Robert Jeffares
> Auckland
> new Zealand
> --
> Robert Jeffares
> Communication Consultants
> The Wireless Station
> Big Valley Radio
> Radio Spice
> _______________________________________________
> Rivendell-dev mailing list
> Rivendell-dev at lists.rivendellaudio.org
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://caspian.paravelsystems.com/pipermail/rivendell-dev/attachments/20150706/26c041ab/attachment.html>

More information about the Rivendell-dev mailing list