Simple Tally Light for OBS Studio

A FULLY Plug-and-Play Tally Light

My church (like many others) recently began streaming sunday services.  The staff had quite a job on their hands adjusting from a live audience with a small online presence to an online-only presence.  Subtle communication between the ‘techies’ and ‘actors’ was difficult, but a simple tally light made it simple to send a queue to the staff on camera automatically.  A tally light is simply a light that turns on when the camera is recording.

This tally light is a simple Raspberry Pi-based system which connects with OBS Studio over the network and illuminates a lamp when the camera is live.  The system does not need any external input – it will find OBS studio and save its address for future sessions.  If OBS studio moves to another PC, it will still find it.  The camera illumination is configured in OBS studio, so no need to change anything on the tally light.  Finally, if OBS Studio gets disconnected for whatever reason, the tally light will turn off and the Pi will immediately begin searching for OBS Studio again.

An optional status LED on the circuit also indicates if the tally light has booted and whether it’s connected to OBS studio.

Hardware

  • Raspberry Pi – I used a Pi 3 B as the facility only uses 5GHz wifi, but a Pi Zero W will also work if the network has 2.4GHz wifi.
  • 4GB or larger MicroSD card
  • 5V USB supply or XL4015 Buck Converter
  • IRF540N MOSFET
  • 220-ohm, 47K-ohm, and 100K-ohm Resistors
  • 5mm indicator LED
  • LED Strip and Power Supply

OBS Studio Setup

  1. Go to https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/, click Go To Download, scroll to the bottom, and download the appropriate package (depending on your OS)
  2. With OBS studio closed, install the package
  3. Open OBS Studio, go to Tools, then to Websockets Server Settings
    1. Change the password to 123456 (Or a unique password, then copy the password in the Python script below)
    2. Make sure the port is 4444
  4. In your scenes, rename all the scenes that you want to illuminate the tally light so that it includes a ‘+’.  That character is the tally light’s signal to turn on.
    • If you want to use a different character, or use multiple tally lights with unique characters, then that’s totally fine.  Just be sure to edit the python code accordingly.
My test scenes – the tally light illuminates when the ASUS scene is active

Raspberry Pi Setup

I’m going to give you this part recipe-style:

  1. Burn the latest version of Raspbian Buster Lite to a microSD card.  I use Banana Etcher to do this.
  2. Go to the Boot drive on the card and create a file called ssh.  Don’t edit it.
  3. Now create another file in the Boot drive called wpa_supplicant.conf and open it with a text editor.  Save the following text (Note that country=ca is for Canada, use country=us for USA, etc.):
    • country=ca
      update_config=1
      ctrl_interface=/var/run/wpa_supplicant

      network={
      scan_ssid=1
      ssid=”NETWORK_NAME”
      psk=”PASSWORD”
      }

  4. Insert the microSD card into the Raspberry Pi and power it up.  Connect to it via SSH using Putty.
  5. Change your password!
  6. Update the system: sudo apt-get update and sudo apt-get upgrade
  7. Install Python 3 and pip: sudo apt-get install python3 python3-pip
  8. Install the following Python 3 modules: sudo pip3 install websocket-client obs-websocket-py RPi.GPIO 
  9. Create an empty text file to store the last OBS Websocket address:  sudo nano /home/py/OBS_address.conf
    • You may enter the OBS Studio PC’s IP address into the text file.  It will speed up the search, but isn’t necessary.
  10. Set ownership and permissions on that text file: sudo chown -pi /home/py/OBS_address.conf and sudo chmod 777 /home/py/OBS_address.conf
  11. Create the Python script: sudo nano /home/py/tallylight.py
  12. Copy the code from my repository.  Save with Ctl-X Y.
    • Edit the trigger_char variable if you don’t want to use the ‘+’ character as a trigger
    • Make sure the password matches what was set in OBS Studio
  13. Set the code to execute on boot: sudo raspi-config , Boot Options, Desktop/CLI, Console Autologin, Finish (don’t reboot yet)
  14. Edit the boot script: sudo nano /etc/profile, and add this line at the very end: sudo python3 /home/pi/tallylight.py

Hardware Setup

I used a surplus LED from my high-speed flash testing.  It’s moderately bright (~4,000 lumens) and has a 28-volt forward voltage.  It’s switched by an IRF540N MOSFET transistor which I have previous experience with.  This MOSFET is great for 3.3V logic: it’s a sturdy power MOSFET but its gate-source threshold voltage is fairly low.  You can probably carry an amp or so with it (and switch up to 100 volts!).

You can run the Pi with a 5V supply and your LED with another supply (as shown above), but I chose to run both from a 32V supply.  A XL4015 buck converter takes the 32V power and supplies a nice clean 5V to the Pi.  Those buck converters are surprisingly reliable – I have the exact same one powering my ethernet switch at home since the original power supply died!

Raspberry Pi OBS Tally Light Schematic

The LED indicator circuit attached to GPIO16 is optional.  I would recommend it, otherwise the only way to know that the system is booted and connected is to test the tally light, which might not be convenient when other activities are happening.  Two options for supplying the Raspberry Pi are also shown.  The ‘wall wart’ is simpler but requires more than one plug.  The XL4015 (or similar) buck converter needs to be mounted, set to 5V, and soldered onto the Pi.  However, the second option looks cleaner with only one plug required.

The LED supply needs to match your LED’s.  If you use a 12V LED strip, then connect them to a 12V supply (surprising right?).  I opted for a powerful Bridgelux LED which required a 32V supply and series resistors.  If you’re not familiar with designing LED power supplies then I would suggest using the 12V strip.

Here is my mechanical build (to be updated!).

Shoutouts

Thanks to Elektordi with his OBS Studio websockets Python module!  His module is licensed under the MIT License.

Also thanks to jbrendel for his multiping Python module.  Apparently you can ping hundreds of IP addresses simultaneously – awesome!

6 thoughts on “Simple Tally Light for OBS Studio”

  1. I was reviewing and tweaking your code for a potential upcoming multi-camera tally light system with both Program (Red) and Preview (Green) lights at each camera. I noticed in your Python code you used GPIO 13 for the Tally LED control, but your hardware schematic shows connection to GPIO 26. Was this a mistake, or does toggling GPIO 13 in software actually control hardware output 26?

    Reply
      • Thanks! After I get the code working on hardware, I’ll throw it up on Github. Great job on providing a great foundation upon which others can build!!! (This is my first RasPi and Python project!)

        Reply
        • Sounds great! It would be nice to have another example code for multiple lights on one Raspberry Pi.

          FYI – I just ran into some trouble this week as we began streaming NDI out from OBS. An updated Python script is coming.

          Reply
          • Great, thanks. One more question. In step 3 of the RasPi setup above, you talk about creating a WPA Supplicant file, but it seems like sentence might be missing the text that should be included in that file. Did I misread the step?

          • You did not misread, I forgot to actually add the wpa_supplicant text. Updated – thanks for pointing it out!

Leave a Reply

%d bloggers like this: