Arduino OBS Scene Switcher

Switch between scenes in OBS with a USB-powered Arduino

The goal of the project was to create a lightweight, mini stream-deck for OBS that could change scenes, or send hotkeys easily. The keypad buttons send function buttons that aren’t already allocated in OBS, specifically F13 – F24.

The code uses two Arduino libraries: Keypad.h by Mark Stanley and Alexander Brevig; and Keyboard.h by Arduino. The Arduino code is below. Replace any of the “KEY_F13” or similar entries to match your own shortcut keys. I used this reference for the names of keys combinations or special characters that Arduino uses in their libraries: https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/

*nOtE: We didn’t use “KEY_F11” for a shortcut key because OBS uses it to maximize the window.

#include <Keypad.h>
#include <Keyboard.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns

// replace these sixteen values with your own key codes
// https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/
char keys[ROWS][COLS] = {
    {KEY_F13, KEY_F14, KEY_F15, KEY_F8},
    {KEY_F16, KEY_F17, KEY_F18, KEY_F9},
    {KEY_F19, KEY_F20, KEY_F21, KEY_F10},
    {KEY_F22, KEY_F23, KEY_F24, KEY_F12}
};

// there are 8 pinouts from the membrane pad. 
// They represent the four rows and four columns that need to be connected to the Beetle
byte rowPins[ROWS] = {A0, A1, 15, 16};  // Row pins
byte colPins[COLS] = {14, 11, 3, 9};    // Column pins

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
    Keyboard.begin();
}

void loop(){
    char key = keypad.getKey();
    if (key){
        Keyboard.print(key);
    }
}

We 3D printed the case with some filament that fades between black and red (totally fun). The 3D files for the case can be found here: https://www.printables.com/model/864369-membrane-keypad-with-beetle-cm-32u4-arduino-leonar

In OBS, we assigned hotkeys in Settings–>Hotkeys. We used the keypad to input the function keys as Hotkeys for each “Switch to scene” setting. It’s kind of wonky to get the F13 – F24 keys from a traditional keyboard, so the keypad was super helpful in putting these in.

Leave a comment