Close
0%
0%

Twitch Relay Monitor

Take Channel Events from the Twitch API Webhooks and translate them into states for an 8 channel electrical relay

Similar projects worth following
Basically this doohickey takes events that are able to be retrieved via Webhooks from the Twitch Helix API and then sets an electrical relay to show what is happening. The electrical relays can be used to control lights, motors, inflatable wackyman air pumps, nerf guns, whatever.

The device is powered by a Raspberry Pi Zero W with a 3.3v 8 channel relay. The side and rear panels are cut out with a laser cutter in 3mm thick acrylic with the top and bottom ends being 3D printed then secured with 12mm M5 screws (I believe.... from memory). For this one I added a logo to the clear side which is from the channel it is for (back_pocket)

The top base near the switch could probably do with some reinforcement for my push button Twitch spring being a bit strong. The connecting up the headers is mostly in the code on Github including a link to setup the momentary button and some code that lets you safe shutdown + wake the Pi (when you plug it in the first time it will turn on though).

The thing is intended to be a set and forget type device you just turn on before a stream so the python code is set to run at start. I have just set it to be part of the bash.rc so it happens with the autologin and after anything else dependant has run but there are other ways to do it (including the way the power button is implemented)

I also added an NFC tag to the inside cover that can be scanned with the basic details of how to connect and configure to the Pi. Given this is a set and forget it seemed like a good idea to put a 'note' with it in case you forget later.

test-relay.py

Completely optional script I used to test my 8 channel relay when it was hooked up. It just turns them all on one at a time then all off one at a time

plain - 2.54 kB - 03/18/2021 at 05:00

Download

run.py

Main File to run the Twitch checking while loop

plain - 3.92 kB - 03/18/2021 at 04:42

Download

config.py

Config file

plain - 1.63 kB - 03/18/2021 at 04:42

Download

helper.py

Extra functions including Twitch APIs and Relay controls

plain - 11.87 kB - 03/18/2021 at 04:42

Download

Bottom Base.stl

Bottom Base Cap for 3D Printing

Standard Tesselated Geometry - 98.32 kB - 03/18/2021 at 04:39

Download

View all 10 files

  • 1 × Raspberry Pi Zero W
  • 1 × 8 channel 3.3v Relay
  • 1 × Momentary Button
  • 4 × M5 14mm Screws
  • 8 × Nylon screws + nuts for mounting electronics then being able to clip with side cutters to shorten. Nuts can be used on the underside of the boards to lift them up slightly so the pins dont scratch the acrylic and it sits evenly)

View all 9 components

  • 1
    Cut the Acrylic Inner Shelf

    Probably the first step as you need a spot to work

  • 2
    Mount the Raspberry Pi and Relay Board

    To do this use Nylon screws and nuts and attach them to the boards first (so there is a nut between the board and the screwhead before you put it on the inner shelf. Once you have both boards on the shelf you can use another nut to hold the board in place. So one nut props up the board off the acrylic and keeps it even and the second holds it in place.

    Then cut off the excess thread of the nylon screw with some side cutters

  • 3
    Crimp wires into headers

    I did this differently so I have a bit of excess wire but with the boards mounted you should be able to make a nice clean fit so there isn't too much excess cabling. The GPIO pinouts I used are in the code under the helper function

View all 16 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates