Server-based countdown clocks with multiple client viewers using Node.js and a Raspberry Pi

A few months back, I shared about the client-side countdown clock script that I created for our team to use. It worked pretty well for its purposes, using Dropbox as the platform to share and update data between the computer creating the clocks and the computer viewing the clocks. The initial goal was to create something that required no backend server and would be easy to run on any computer.

It served us well but we quickly outgrew it with the desire to be able to publish clocks in realtime, not simply relying on the viewer client to refresh itself every 15 seconds to look for new data. So, I created a server based solution using Node.js.

I decided I wanted to run this project on a Raspberry Pi 3 B+, so I picked up this kit on Amazon. I wanted an easy way to spin up a web server that wasn’t tied to any production machine, and this does a great job.

img_7113
Here is the Raspberry Pi 3 B+, neatly installed in one of the video racks. I’m using the HDMI output and converting it to SDI to go into our video system.

Dubbed TimeKeeper, this project runs an Express web server within Node and has a REST API, which allows the user to poll for existing data as well as create new entries. As new entries are added, they are sent out to all connected clients in real time using the socket.io library.

Screen Shot 2018-11-29 at 2.08.23 PM
Here is a screenshot of a web browser client. This is actually running on the same Raspberry Pi that is hosting the Node.js server, with Chromium in kiosk mode.

Rooms:
Rooms allow you to control and specify which timers appear. This is helpful if you are running clocks in multiple venues or instances, and only want certain timers to appear on certain viewer screens.

Timers:
Timers are the objects that TimeKeeper will count down to, based on the viewer’s current local system time.

Messages:
Messages can be sent and displayed on viewer clients.

After implementing the API, I created a Dashboard custom panel to interact with the server. This serves as the primary interface for our volunteers. Because the panel fetches new data from the server on a recurring schedule, multiple computers can have the panel open and all stay in sync about what timer and message objects are currently being displayed.

Screen Shot 2018-11-29 at 2.09.55 PM
Screenshot of the custom panel in Dashboard.

We’ve been using this software for a few months now and it’s working great! I intended to write about it sooner, but with a busy work and family life, finding time to write for this blog can be a challenge!

The next version will support trigger actions when clocks hit a specified time or run out. I also plan to integrate with other clock systems to show time left on video playbacks, Planning Center Online, etc., when I have the time!

If this is useful or helpful to you, I’ve made it available on my Github repository.

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.