{"id":619,"date":"2020-07-01T14:38:54","date_gmt":"2020-07-01T14:38:54","guid":{"rendered":"http:\/\/techministry.blog\/?p=619"},"modified":"2020-07-01T14:38:54","modified_gmt":"2020-07-01T14:38:54","slug":"using-node-js-python-multiple-raspberry-pis-and-usb-lights-to-create-an-inexpensive-wireless-camera-tally-system-that-can-arbitrate-multiple-sources-simultaneously","status":"publish","type":"post","link":"https:\/\/techministry.blog\/?p=619","title":{"rendered":"Using node.js, python, multiple raspberry pi&#8217;s and usb lights to create an inexpensive wireless camera tally system that can arbitrate multiple  sources simultaneously"},"content":{"rendered":"\n<p><strong>Update: Version 1.2 is available now; read about it <a href=\"https:\/\/techministry.blog\/2020\/07\/20\/tally-arbiter-1-2-support-for-newtek-tricaster-gpo-output-and-tsl-3-1-protocol-conversion\/\">here<\/a>: <\/strong><\/p>\n\n\n\n<p>At my church, we have two auditoriums, each with their own video switcher and cameras. All of the inputs and outputs of each switcher are on a common video router, so all of these sources can easily be shared across both rooms. However, even with all this, we have no camera tally system. Commercial tally systems can be expensive, and it&#8217;s just something we&#8217;ve never been able to afford.<\/p>\n\n\n\n<p>It&#8217;s not normally an issue, but sometimes we want to pull up a shot of a camera in Auditorium 1 and show it in Auditorium 2. Because we have no tally system, the camera operator would not know their shot was being used. And, even if we did have a tally system, those systems generally only interface with one tally source\/switcher, not multiple sources at the same time.<\/p>\n\n\n\n<p>A few weeks ago, I was quarantined from work due to a co-worker testing positive for COVID-19. I set out to use this time to write a tally system for our church to use. Now that we&#8217;ve re-opened for church services, we will really need this, because we will have cameras capturing the service to stream online, but won&#8217;t necessarily have those cameras visible on the projector screens in the auditoriums during that time, where the operators would at least have a visual reference if their shot was in use.<\/p>\n\n\n\n<p>And, because we have two video switchers, I needed to come up with a solution that would allow either video switcher to pull up a camera in either auditorium in Preview or Program, and make sure the operator still knew their shot was in use.<\/p>\n\n\n\n<p>So here is <strong>Tally Arbiter<\/strong>. I called it this because the software aggregates tally data from multiple sources and &#8220;arbitrates&#8221; whether that device is in Preview, Program, or both across all sources and buses.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/logo.png?w=600\" alt=\"\" class=\"wp-image-621\" \/><figcaption>I played Halo a lot back in the day. A LOT.<\/figcaption><\/figure><\/div>\n\n\n\n<p>The server software is written in Node.js and can run on a Raspberry Pi. It supports the TSL 3.1 network protocol like what our Ross Carbonite switchers use, but I&#8217;ve also written support for Blackmagic ATEM switchers, OBS Studio, StudioCoast VMix, and Roland SmartTally. I plan to one day add support for incoming webhooks, and GPIO inputs for switchers that don&#8217;t have network-based protocols.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/screen-shot-2020-06-15-at-10.55.49-am.png?w=1024\" alt=\"\" class=\"wp-image-633\" \/><figcaption>The settings page of the Tally Arbiter server.<\/figcaption><\/figure>\n\n\n\n<p>The software supports tally data coming from multiple sources, and each source can vary in protocol type. This could be useful, for example, if you had shared cameras for your production on-screen using an ATEM and also through your live stream using OBS or VMix, and you need the cameras to reflect the tally data of either system.<\/p>\n\n\n\n<p>You can configure multiple devices in the software. These would be what generally receives tally data, whether it be cameras, CG stations, monitors, etc. Each device can support addressing from multiple sources. This is the &#8220;arbitration&#8221; portion of the software.<\/p>\n\n\n\n<p>Once a device is determined to be in preview and\/or program, device action(s) can be run. This can be sending out a TSL 3.1 protocol message (to a monitor\/scope\/multiviewer), an outgoing webhook (to tell another device to start playing a video (&#8220;roll clip&#8221;), for example), triggering a relay if you have CCUs that need contact closures to turn on the tally lights, or even local console output for logging and testing.<\/p>\n\n\n\n<p>Some of our cameras have built-in tally lights, like the two Hitachi Z-HD5000 cameras we have. For those, I implemented a separate relay controller client that listens to the data on the Tally Arbiter server. It uses simple USB relays with <a href=\"https:\/\/techministry.blog\/2018\/10\/03\/network-control-of-window-shades-using-relays-a-raspberry-pi-zero-and-node-js\/\">the Node.js library I created a couple years ago that controls our auditorium window shade<\/a>.<\/p>\n\n\n\n<p>I bought a project box, put the relay in, ran some CAT5e cable I had laying around and connected it to the relay and the CCU&#8217;s with custom DB25 connectors. I had to modify the project box some because I wanted the relay to sit flat in the box, so I used a dremel to remove the bottom of the middle screwposts, which weren&#8217;t really needed anyway. Never be afraid to modify something to make it work!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/relay-inside.jpg?w=768\" alt=\"\" class=\"wp-image-648\" \/><figcaption>The relay fits snugly inside this box. This particular unit has 8 relays, so I could add 2 more cameras with preview\/program tally control to this unit.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/relay-box.jpg?w=768\" alt=\"\" class=\"wp-image-649\" width=\"768\" height=\"1024\" \/><figcaption>The box and the Pi running the server fit nicely on top of one of the CCUs.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/ccu2.jpg?w=1024\" alt=\"\" class=\"wp-image-650\" \/><figcaption>A clean rack is a happy rack!<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/photo-jun-17-3-46-39-pm.jpg?w=1024\" alt=\"\" class=\"wp-image-642\" \/><figcaption>Preview and Program lights!<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/photo-jun-17-3-46-50-pm.jpg?w=768\" alt=\"\" class=\"wp-image-643\" \/><figcaption>This will make our camera operators happy.<\/figcaption><\/figure>\n\n\n\n<p>But what about the cameras we use that don&#8217;t have tally lights? For these, I decided to use <a href=\"https:\/\/www.raspberrypi.org\/products\/raspberry-pi-zero-w\/\">Raspberry Pi Zero W<\/a>&#8216;s that would run software listening over websockets to the Tally Arbiter server. These particular Pi models are inexpensive and simple to use. I knew that I could get the least expensive cost for physical tally lights out of these Pi&#8217;s if I went the GPIO route with some LED lights and custom circuitry, but I wanted to design something that people who may not be comfortable with these concepts could easily implement. And honestly, the thought of soldering something just sounded like something I&#8217;d have to possibly maintain down the road. So, I used the <a href=\"https:\/\/blink1.thingm.com\/\">blink(1) USB lights by ThingM<\/a>.<\/p>\n\n\n\n<p>I first started experimenting with these USB lights about a year ago when I created a <a href=\"https:\/\/techministry.blog\/2019\/04\/19\/using-a-raspberry-pi-zero-w-and-a-blink1-light-for-silent-notifications\/\">silent notification system<\/a> for our band to use in case we had a tech issue during a service. The company that makes these has published very easy to use APIs, which makes it a great tool to use with custom software.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/photo-jun-01-10-04-22-pm.jpg?w=768\" alt=\"\" class=\"wp-image-634\" \/><figcaption>I like this simple black case from Vilros. You can get the whole kit minus the SD card for about $30 on Amazon.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/photo-jun-02-10-00-20-am.jpg?w=768\" alt=\"\" class=\"wp-image-635\" \/><figcaption>Here&#8217;s a blink(1). A pretty versatile device!<\/figcaption><\/figure>\n\n\n\n<p>The listener client script is written in Python since that programming language runs so easily on the Raspberry Pi OS no matter what model Pi you have. And, since we are using the socket.io websocket libary, bi-directional real-time communication between the server and clients even though the programming languages vary is not an issue.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/tallylight1.jpg?w=1024\" alt=\"\" class=\"wp-image-639\" \/><figcaption>I used a USB extension cable to bring the light up by the camera, but the Pi is down on the floor of the platform.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/photo-jun-17-11-21-51-am.jpg?w=1024\" alt=\"\" class=\"wp-image-640\" \/><figcaption>Another view.<\/figcaption><\/figure>\n\n\n\n<p>All together, each wireless tally light should cost between $55 and $60 depending on what Pi case you use, SD cards, etc. Tally Arbiter has no built-in limitation of the number of wireless clients that can be connected, so this makes it a very versatile and flexible system no matter what the size is of your production.<\/p>\n\n\n\n<p>Lastly, I also created an option to view live Tally data in a browser, like on a tablet or phone. You can select the device from the list and the background of the page will be red, green, or black depending on that device&#8217;s tally state.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<figure class=\"wp-block-jetpack-image-compare\"><div class=\"juxtapose\" data-mode=\"horizontal\"><img loading=\"lazy\" decoding=\"async\" id=\"652\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/tablet1.jpg\" alt=\"\" width=\"3024\" height=\"4032\" class=\"image-compare__image-before\" \/><img loading=\"lazy\" decoding=\"async\" id=\"653\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/06\/tablet2.jpg\" alt=\"\" width=\"3024\" height=\"4032\" class=\"image-compare__image-after\" \/><\/div><figcaption>The web based tally option is nice if you need a quick portable tally option.<\/figcaption><\/figure>\n\n\n\n<p>The web tally is controllable through the Settings page just like any other listening client, so you can reassign the tally remotely and even send a flash to that client to get their attention.<\/p>\n<\/div><\/div>\n\n\n\n<p>Here&#8217;s a walkthrough video of the whole system in action:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-rich wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"embed-youtube\"><iframe loading=\"lazy\" title=\"Wireless Camera Tally using Raspberry Pi Zeros, python, node.js and Tally Arbiter\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/msfAL631ARw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>As usual with my projects, I&#8217;ve made this open-source and available for your use on Github: <a href=\"http:\/\/github.com\/josephdadams\/TallyArbiter\">http:\/\/github.com\/josephdadams\/TallyArbiter<\/a>. It is fully documented with a REST API if you want to automate use of it outside of the GUI that I have created. There are also step-by-step instructions on how to set up a Raspberry Pi Zero, with OS imaging and all of of the libraries and script installing needed to get it going.<\/p>\n\n\n\n<p>My hope and passion is to see resources like this to be used to further the Gospel. I believe and have seen that God can use technology for His good, and when we can use it to further ministry, that is how we can see the Gospel spread.<\/p>\n\n\n\n<p>If these projects are helpful to you and your church, let <a href=\"https:\/\/techministry.blog\/about\/\">me<\/a> know! I love hearing how you use technology to serve the church.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Version 1.2 is available now; read about it here: At my church, we have two auditoriums, each with their own video switcher and cameras. All of the inputs and outputs of each switcher are on a common video router, so all of these sources can easily be shared across both rooms. However, even with &hellip; <a href=\"https:\/\/techministry.blog\/?p=619\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using node.js, python, multiple raspberry pi&#8217;s and usb lights to create an inexpensive wireless camera tally system that can arbitrate multiple  sources simultaneously&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[29,40,50,51,67],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript","tag-nodejs","tag-production","tag-programming","tag-tally"],"_links":{"self":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=619"}],"version-history":[{"count":0,"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions"}],"wp:attachment":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}