Network control of window shades using relays, a Raspberry Pi Zero, and Node JS

At my church, we have a smaller auditorium that has a giant window to let in natural light. We don’t use it much during services because the light can wash out our projection screens, but it’s wonderful to have during the week to let in light. We also like to have it open before services begin and close it right as we get started. It helps to create a nice environment.

Photo Oct 03, 5 08 02 PM.jpg
These are the two big windows. Each one has a motorized shade attached.

These shades came with a very easy to use RF remote. Actually, it came with two remotes. Since we never need or use two, I thought, wouldn’t it be cool to hack one of them and turn it into a network-controlled remote? This would allow us to control the shades from anywhere, not just within the RF range! Plus, I like automation and making things more accessible and efficient and I wanted to try to create something inexpensive rather than just purchasing something already made.

somfy remote
This is the remote we have. We have two shades that we usually open simultaneously, so we have two remotes but don’t need both.

I purchased this USB relay off Amazon:

usbrelay
These relays are pretty cheap and available on a lot of sites. I paid about $12 for one off Amazon. They can work with both low and high voltages.

I figured I could use the relays to electrically “click” the buttons on the remote. So I took the remote apart to see how it looked on the inside. Here is a picture of the remote outside of its shell.

Photo Sep 20, 11 35 45 AM
The first and third buttons are the “up” and “down” controls. The middle button is the “preset level” where the shade can open or close to a preset level, but we don’t use this feature. The very bottom button determines which shade(s) to control.

I knew there was probably a way to use the GPIO pins of a Raspberry Pi and transistors to trigger the button presses, but that’s not my forte. I don’t know a lot about circuity and electronics at that level, but I know how to solder (well, sort of. Don’t look too closely at my work.) So I soldered some wires onto the remote buttons.

Photo Sep 24, 3 52 18 PM

When I touched the wires together, the remote activated! The concept worked, so I hooked it up to the relay to begin the development and testing.

Photo Oct 02, 1 00 27 PM.jpg
Here is the remote, connected to the relay via the NO (normally open) pins.  I bought a small electronics project box to fit all the parts in.

I knew I wanted to control the remote using Node JS. It’s a great lightweight platform that runs on multiple operating systems, including Raspberry Pi’s with Linux. I found control software written in C, C++, Python, shell scripts, etc. for the USB Relay that I had bought, but nothing in Node JS. At least, nothing native without using DLLs and that sort of thing.

It’s been a long time since I wrote in C++ and I’ve never used Python, but I can read both languages enough to learn about the control protocol. I wanted to keep mine running with the least amount of dependencies so it could work on multiple operating systems (not just on the Raspberry Pi, for example).

In about an hour, using the Node-HID library, I had a working script in Node JS to turn my 2-relay device on and off. I decided to make the control code for the relay into a separate Node JS module so that it can be used in other projects. If you want to use it, I’ve made it available on Github as well as published it in the NPM registry.

Once I had the control of the relay that I needed, I whipped up a quick Node JS project running express to host a simple web server that would accept a “shades up” and a “shades down” HTTP request and then trigger the appropriate relay.

const USBRelay = require("./USBRelay.js");
const relay = new USBRelay();

//express API variables
const express = require('express');
const app = express();

//http server variables
const http = require('http').Server(app);
const listenPort = 4400;

//routes

app.get("/shades_up", function (req, res) {
   ShadesUp();
   res.send({returnStatus: "shades-up"});
});

app.get("/shades_down", function (req, res) {
   ShadesDown();
   res.send({returnStatus: "shades-down"});
});

http.listen(listenPort, function () {
    console.log("listening on *:" + listenPort);
});

function ShadesUp()
{
    relay.setState(1, true);

    setTimeout(function () {
        relay.setState(1, false);
    }, 1000);
}

function ShadesDown()
{
    relay.setState(2, true);

    setTimeout(function () {
        relay.setState(2, false);
    }, 1000);
}

And by making an HTTP request like:

http://ipaddress:4400/shades_up

 

I can trigger Relay 1 on my device to turn on for one second, and then turn off, simulating the button press.

Because we use Ross Dashboard as our go-to production interface, I added Up/Down buttons to our FOH custom panels to send those commands to the relay server.

Screen Shot 2018-10-03 at 6.48.16 PM
Even though the remote is easy to use, this works from anywhere on our network!

I then deployed the ShadeController Node JS project to a Raspberry Pi Zero, and put all the parts into my project box. I had our IT department make a DHCP reservation for the Pi so that it would always have the same IP address, making it easier to program around.

Photo Oct 02, 3 24 42 PM
Here is the remote, the USB relay (hot glued to the bottom of the box), and the Pi Zero all in the project box.

So, what does this really gain us, if the remote was already pretty easy to use?

  1. We are no longer limited to RF range of the remote to control the shades. We can control it from anywhere on the network, including our control rooms which are located far away from the receiving end of the RF controller for the shades.
  2. We can use the URLs in the ShadeController program as hooks in other projects to control the shades through automation. Time for the service to start? Just run the appropriate light cue on the light board and it fires a network midi command to a server that then relays the HTTP request needed.

Overall, this was a fairly inexpensive project.

I ended up spending a little bit more because I bought a Raspberry Pi Zero W kit with a case and some other adapters that I didn’t already have, like a mini HDMI to HDMI connector, but if I end up buying another Zero, I’ll take the Pi case out of this project box and use it. I also bought a pack of project boxes for about $8 that were way too small and didn’t fit my parts, but I plan to use them for some other projects down the road.

I hope this gives you some ideas on ways you could automate or more efficiently control your non-networked equipment through the use of relays! I certainly learned a lot during this process and am looking forward to implementing it in other areas.

ProTally 1.3.0 available with support for OBS Studio

If you’ve been looking for ProTally support for OBS Studio, here it is!

On your computer running OBS, you’ll need to download and configure the OBS Websockets to be able to connect.

Screen Shot 2018-09-19 at 4.07.51 PM

Tally address fields are based on sources available in your OBS scenes.

Download the latest release here: https://github.com/josephdadams/ProTally/releases/tag/v1.3.0

I hope this is helpful to you!

ProTally 1.2.0 with Blackmagic ATEM support available

I spent some time this past week writing and testing support for ProTally with Blackmagic ATEM switchers. I didn’t have one to develop with, and after posting on a discussion group about the software, a new friend sent me a unit to work on. Thanks again, Kyle!

Version 1.2.0 now supports:

  • Blackmagic ATEM switchers – it will auto discover any ATEM switchers on the network, or you can manually type in an IP Address as well
  • Ross Carbonite Black, Carbonite Black Solo, and Graphite switchers

And I now have a Windows release build in addition to a MacOS release build!

Screen Shot 2018-09-15 at 12.12.47 AM

Screen Shot 2018-09-15 at 12.13.51 AMScreen Shot 2018-09-15 at 12.13.11 AM

Screen Shot 2018-09-15 at 12.14.08 AM
It now supports more device types!

You can download the binaries for free here: https://github.com/josephdadams/ProTally/releases/tag/v1.2.0

If the software is beneficial to you, drop me a line and let me know!

ProTally Release Build is here!

Awhile back, I wrote about the on-screen tally software I recently developed. We needed a way for our CG operators to know when their source was on-air or about to be on-air. I won’t rehash the definitions or inner-workings again, so if you didn’t read that first post, I recommend you read that before this.

I had hoped to give a release build much sooner but lost time waiting on some other people to test it in their environments. We’ve been running it in our environments for almost 2 months now with no issues, so I finally gave it some final polishing and bug squashing to get it ready for release. The interface has changed some, and for now, you can choose between a generic TSL 3.1 device or, specifically, a Ross Carbonite. (Not a Carbonite Black, Solo, or any of the other models.) Why specifically that model? Because I have two of them, and that’s what I know and use!

Screen Shot 2018-08-30 at 4.12.01 PM
Here is an example of it being used with ProPresenter as a border box.
Screen Shot 2018-08-30 at 4.13.11 PM
Here is an example of the filled-in box version, as some people may prefer that instead.
Screen Shot 2018-08-30 at 9.37.21 PM
Here is what it could look like in ProVideoServer.

I hope to add support for the Blackmagic ATEM protocol soon. I need to connect with someone who has one, so if that’s you and you’re interested in testing with me, drop me a line!

If you’d like to download either the source code or a release build for the Mac platform, I’ve made both available on my Github repository here:https://github.com/josephdadams/ProTally/

And this should go without saying, but even though I’ve made software to augment your use of software like Renewed Vision’s ProPresenter and other products, it is in no way associated with any company or product. This is distributed under the MIT license and is available for anyone to use without cost.

Tally ho!

Adding Footswitch Control to Clearcom

As I said in a previous post, we rely heavily on our Clearcom intercom system to have good lines of communication between all of the tech team and the band as well.

In each control room, we have a “director’s station” which has a 4-channel intercom where he/she can talk to all four channels of the intercom system: the tech team in Auditorium 1, the band in Auditorium 1, the band in Auditorium 2, and the tech team in Auditorium 2. All other intercom stations are single channel and that person can only talk on the particular channel they are wired for.

For the most part, this works great and does well to keep intercom chatter down and keeps the director as the funnel of communication. However, I have found that quite often, when we are doing smaller events in our smaller auditorium, that I am sitting at the video switcher with no way to talk to the band without having to get up and go sit at the director’s station behind me.

When our integrators built out the AVL for our new auditorium, they installed a Clearcom RM-702 2-channel rack mounted intercom into the rack room for Auditorium 2. I found that after a year and a half, we never use it there, so I decided to move it to Control Room 2, which is the video control room that drives operation for Auditorium 2.

Photo Jul 17, 2 52 42 PM
This is the RM-702, installed now into the control room.

As I operate the video switcher, I like to keep my hands on the switcher (and my streamdeck!). Reaching over to press an intercom talk button is an interruption to my workflow. The nice thing about the RM-702 is that it has an accessory port, which allows you to connect a footswitch to activate the talk channels!

photo-jul-17-2-50-21-pm.jpg
Here is a view of the accessory port with the cable connected that I purchased.

The accessory port is a DB-15 connector, so I bought an extension cable, along with a DB-15 plug. I bought these from Amazon:

I also bought two Yamama FC5 foot pedals.

photo-jul-17-2-52-59-pm.jpgTo wire everything up, I had to cut off the plug at the end of the pedals to expose the wires. The wiring is pretty simple. Clearcom has it well documented what the pinout is.

  • Pin 1: Ground
  • Pin 2: Talk Channel A
  • Pin 9: Talk Channel B

 

photo-jul-17-4-24-10-pm.jpg
Here is everything wired up.

The Yamaha pedal is a contact/no-contact switch, so it doesn’t matter which color wire goes to which pin.

 

Once I connected everything up, I realized that the Yamaha pedal works the opposite of what I needed: it was making contact when the pedal wasn’t pressed down (shorting the connection in the Clearcom, keeping the talk channel turned on) and then when I would press the pedal down, it would break the connection, turning the talk channel off.

I opened up the pedal and modified the two leads so that it would make a connection when pressed down. I basically just swapped the position of the two copper bands.

Photo Jul 19, 8 29 25 AM

 

Photo Jul 19, 8 29 46 AM
This is how the pedal looks like by default. It is connecting the two wires until you press down, which breaks the connection. The opposite of what I needed.
Photo Jul 19, 8 50 31 AM
By swapping the two leads, now I have a pedal that only makes connection when pressed down. I had to bend them a little bit to sit properly.

Voila! Now I have two footpedals that I can use to talk on either channel, hands-free! The next step will be labeling them and then taping them down to the floor.

 

Photo Jul 19, 9 20 06 AM

All in all, this was a very inexpensive improvement. The pedals were about $15 each and the cable/adapter was about $10, and the project was simple.

 

On-Screen Tally Light for ProPresenter using software

I wrote a new piece of software recently that I’m really excited about. It’s called ProTally and it is designed to display video tally markers directly on the screen.

icon_512x512@2x

What’s tally? In broadcast setups, it is often helpful to be able to tell camera operators, computer graphics workers, etc. when their shot is being used on-air or visible on screens. Most broadcast equipment comes with some sort of tally light that, when connected to the right system, lights up to let the operator know.

With today’s broadcast equipment, a lot of this tally information can be communicated directly over the network, in real time using a variety of protocols. One particular protocol is TSL UMD, from Television Systems Limited for Under Monitor Displays. It is supported by a wide variety of broadcast industry equipment and allows the devices to know the tally state of one another.

In church environments where we use computer software like ProPresenter to send CG content to a video switcher, it can be very helpful to have a tally light that the user can see so they don’t accidentally change a graphic while it is live or on the screen. While there are a variety of external tally lights available for this purpose, I wanted to design something that would allow for a green (in preview) or red (in program/on-air) box directly on the screen that the user can easily see while operating the software, without having to purchase additional hardware.

For this project, I used Node JS and the Electron libraries, along with an existing Node JS module that acts as a TSL 3.1 Protocol server. I was able to whip up a demo in just a few short hours. Then it was just a matter of finessing and adding features.

Using ProTally, you can monitor up to 4 Tally Addresses using TSL UMD 3.1 and keep track of their Preview, Program, and Preview+Program states. You can even customize the colors as needed! The boxes can be resized and moved around on the screen and those positions will be saved and recalled the next time the software launches.

Screen Shot 2018-07-11 at 10.31.00 PM

Screen Shot 2018-07-11 at 10.32.26 PM

I decided to add options to allow the user to choose whether they wanted a filled-in box or a transparent box with a color border. It also reads the label data and stores that as it comes in, to give names to the tally addresses. And, because we use two Carbonite switchers at my church, I also wrote in an object array that uses the TSL UMD protocol implementation described by Ross here: http://help.rossvideo.com/carbonite-device/Topics/Devices/UMD/TSL.html

Screen Shot 2018-07-11 at 10.31.31 PM
The software stores the label names of the devices as they are read in the tally data over time, so as the software runs longer, this drop down list becomes mnemonicly helpful.

Due to some limitations of the Electron framework, I had to make the windows appear “always on top” of other windows, to ensure they would be visible while clicking around in ProPresenter (or ProVideoServer or whatever software being used). This can be a little annoying if you’re using the computer for another task and don’t want to see the tally boxes, so to help with that, I added a “Hide All Boxes” option that can be used rather than quitting the software.

Screen Shot 2018-07-11 at 10.30.45 PM

Here is ProTally in action:

 

Screen Shot 2018-07-11 at 10.35.13 PM
This is a transparent window with a border sitting on the output window of ProPresenter.

 

 

Screen Shot 2018-07-11 at 10.33.51 PM
This is a filled-in box.

 

This solves a problem for a lot of people who want on-screen tally for ProPresenter, ProVideoServer, or whatever software they may be using. You can even use it to monitor general inputs like cameras, etc. Just assign the tally address, position the box, and you’re set!

I will have this available in my GitHub repository soon. Feel free to check it out and if you use it, let me know how you like it! I plan to add more features to it as I have time.

Customizable Clock and Countdowns for Production, in a Web Browser

Accurate clocks and countdowns can be a huge help when it comes to keeping services and productions on time. In our control rooms, we use these clocks:

943

They’re made by a company called ESE and they are basically network-based POE-powered NTP clocks. Because they are synced to NTP (Network Time Protocol), they are all in sync to the exact same time down to the second. We like them because they are big and grab your attention. We have them mounted above the multiviewers in each control room along with a couple of others in the actual tech booths out in the auditoriums.

But what about everyone else, like the band or people on stage? We don’t have clocks like this where they can easily see. And, the ESE clocks just tell the time, they don’t count down to a specific time.

I decided to do something about that. We have a server in the video rack room that has a video out connection into the video systems. It’s just a simple output of the secondary monitor. So, I figured it would be pretty easy to display a clock in a browser, and run it full screen on that secondary monitor, that feeds into the video router where I can then easily send it to any screen in the system that needs it.

I found some examples online and eventually came across this article where someone had created a full screen clock: https://www.nayuki.io/page/full-screen-clock-javascript

clockThis computer’s time is synced to NTP, so it stays in sync with the clocks in the control rooms, too.

I quickly decided to take this a step further and incorporate some countdowns. I had a couple of self-imposed restrictions though:

  1. I wanted the countdowns to be customizable as our needs change, not just always count down to the same date/time.
  2. I didn’t want to run a web server just to accomplish this, in order to pass new data to the locally running page/JavaScript.

I decided an easy method would be to have a separate JavaScript file that defines some countdown data, and include that in my main clock page, and just refresh the page to get the new data. I set the page to reload every 30 seconds by putting this in the <head> of the HTML:

<meta http-equiv="refresh" content="30">

I want my volunteers to be able to easily change this countdown data, without having to know JavaScript. Time for Dashboard! My directors have a Dashboard Custom Panel that I created for them which they use every week. It has a myriad of control options for them, so it was simple to just add another tab for the new countdowns.

countdowns_

Dashboard has a built in date picker and time picker, which makes it super easy.

I added two options in addition to the date and time, publish time, and expire time.

countdowns_publishtime
I limited it to these few options, between 2 minutes and 7 days. This determines when the countdown will appear on the screen.
countdowns_expiretime
When a countdown expires, it turns red so it grabs your attention.

When the user clicks, “Update”, it runs a simple function that grabs all of this data, writes the JavaScript into a string, and then saves that into a file using the ogscript.saveToFile function. The file is saved to a common Dropbox folder that the server running the web page clock has access to.

countdowndata

clock-and-countdowns.png
Here it is in action. The countdowns automatically update when the page reloads every 30 seconds.

 

I’ve made the files available on my Github, if you can benefit from them! We will be giving this a trial run on Sunday.