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.

Update 2020-07-13 – Greg Cotton made some modifications to the Python script so that one Raspberry Pi can control multiple tally lightsHis code and circuit diagram is available at https://github.com/SiliconKnight42/OBS_TallyLight.

OBS Studio Tally Light

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_supplicantnetwork={
      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 pythonping multiping
  9. Create an empty text file to store the last OBS Websocket address:  sudo nano /home/pi/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/pi/OBS_address.conf and sudo chmod 777 /home/pi/OBS_address.conf
  11. Create the Python script: sudo nano /home/pi/tallylight.py
  12. Copy the code from my repository (if you want to use multiple tally lights, then go to Greg Cotton’s 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!

Below is a hand-drawn schematic for my system.  If you are using Greg Cotton’s script, then please see his schematic.

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’s a picture of my tally light.  That is a ketchup bottle on top!  Turns out that the ketchup bottle has a metric thread which was very easy to 3D print.  The LED current is controlled by an LM317 with a current-sense resistor.  The resistance is controlled with the switch on the side.

Raspberry Pi Tally Light

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!

As mentioned, thanks to Greg for expanding the code to allow multiple tally lights.

Troubleshooting Tips

I came across an interesting problem.  If you are using Windows and the network profile is ‘Public’ then Windows will not reply to any pings from the network (the Tally Light relies on a ping response to find OBS Studio).  Below is an example where the network profile is ‘Public’ – I had to change it to ‘Private’ in order to make Windows reply to pings.

Next, I had to turn on ping replies (under Advanced Settings in the dialog above).  Below is a screenshot of the Windows firewall before I turned on ping replies.  The selected items need to be Enabled.

Last updated 2020-09-08

21 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!

  2. I finally finished our multi-light, multi-camera version. I forked your project on Github since I wasn’t able to keep up with your code changes (sorry). I tried to give you full credit for allowing me to stand on your shoulders!

    Reply
    • Awesome, I added some links to your script and documentation. Your schematic is admittedly more pleasant to view than mine 🙂

      Reply
    • So much bugs and errors in the how tos!
      Your script killed by itself. If a pc with OBS doesn’t found… crash… if a scene change… crash… with like this error:

      Attempting to connect 192.168.178.20
      INFO:obswebsocket.core:Connecting…
      INFO:obswebsocket.core:Connected!
      Connected! Current Scene in Program: name’: ‘RecordingLocal2’
      WARNING:obswebsocket.core:Invalid message: {– Program LED 0
      “duration”: 300,
      “from-scene”: “RecordingLocal2”,
      “name”: “Slide”,
      “to-scene”: “RecordingLocal2+”,
      “type”: “slide_transition”,
      “update-type”: “TransitionVideoEnd”
      } (Invalid event TransitionVideoEnd)

      Reply
      • That looks to be an error caused by the obswebsocket module. Strange that it says that it’s connected when you say it can’t find the OBS PC – it even thinks that it’s found the current scene name.

        By the way, that looks like SiliconKnight42’s code, which is forked from mine but I have not used. You could investigate the issue and open an issue or (even better) a pull request on Github.

        Reply
  3. In looking at your schematic, it looks like the MOSFET you picked needs 4v to fully turn on. The pi can’t deliver more than 3.3v, and in practice it is even lower.

    A logic MOSFET looks like it might be a better choice.

    Reply
    • Hey there, this application doesn’t need it ‘fully turned on’. The MOSFET is rated for a few dozen amps and I’m drawing about 1! If you read my post, you’ll note that I have some experience with it and haven’t had any problems.

      Reply
  4. At that point, the only issue is heat dissipated by the mosfet.. which, as you mention isn’t significant..

    I’m looking at doing a version that is battery powered, for a portable camera option.. So I’m going to try to keep losses at a minimum.

    Thanks for the reply.

    Reply
  5. Doesn’t work!
    The folder “/py/” doesn’t exist.
    The Python scripts don’t run… pythonping and multiping now not found/installated.

    Reply
  6. the folder “py” doesn’t exist (sudo nano /home/py/OBS_address.conf)
    “-Pi” in sudo chown -pi /home/py/OBS_address.conf not working

    Reply
  7. GPIOs OUT: Connected- 16 Tally Prev- 13 Tally Prog- 6
    GPIOs IN: Cam Num Sel1 17 Cam Num Sel2 27 Cam Num Sel3 22
    Traceback (most recent call last):
    File “/home/py/tallylight.py”, line 46, in
    ipAddressHistory = open(“obsAddr.log”,”r”) # “obsAddr.log” is a text file with one line -> the last IP address to which the program connected
    FileNotFoundError: [Errno 2] No such file or directory: ‘obsAddr.log’

    Reply
    • Try adding the obsAddr.log file to /home/pi. It looks like you’re using SiliconKnight42’s code. I haven’t used it myself, sorry I can’t be of more help. He might be able to help you out.

      Reply

Leave a Comment