Switch between scenes in OBS with a USB-powered Arduino
- Materials:
- DFRobot Beetle CM-32U4 (Arduino Leonardo guts) – https://wiki.dfrobot.com/Beetle_CM_32U4_SKU_DFR0816
- 4×4 Membrane Keypad – something like this: https://www.amazon.com/DIYables-Membrane-Arduino-ESP8266-Raspberry/dp/B0B376LM5T
- Male-to-Female Dupont wires – https://www.amazon.com/California-JOS-Breadboard-Optional-Multicolored/dp/B0BRTHR2RL/
- 3D printed enclosure
- USB C cable
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);
}
}
![](https://djpfeif.com/wp-content/uploads/2024/05/20240501_101319.jpg)
![](https://djpfeif.com/wp-content/uploads/2024/05/20240501_101421.jpg)
![](https://djpfeif.com/wp-content/uploads/2024/05/20240501_101601.jpg)
![](https://djpfeif.com/wp-content/uploads/2024/05/20240501_101519.jpg)
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.
![](https://djpfeif.com/wp-content/uploads/2024/05/screenshot-2024-05-01-110814.png?w=983)