Project: Hot Box

Project: Hot Box

This project came to life because of a basic need to have an easy (non-fumbling) way to change camera scenes in OBS (Open Broadcaster Software.) I did not want to have to look down to my keyboard and fumble around. I wanted a utility type keyboard that would allow quick and easy changes.

Part 1 of this project is the initial brainstorming on what we wanted it to do:

Once we knew where it was going (at least at first) we decided it was time to order some parts. Sometimes you can look at things on the internet a million times, but until it is in your hands, you don’t know if it will work. Part 2 is the unboxing and discussion of the parts we ordered:

This is where the series hit a little speed bump. It was working, but the video had an issue and I was not able to show the full assembly of the project. At this point in the project, it was still living in a temporary enclosure. (Cardboard box.)  This video covers Ver2 of the PCB:

The next installment covers Ver3 of the Hot Box. It is finally in an actual (3D Printed) enclosure. Some tweaks were made and additional functionality added. This version has a selector switch that will allow this to act as 4 different Hot Boxes. Each of the 4 selector locations allow the 10 buttons to be set for different functions.

Over all, it works REALLY well and I enjoy having it. My 1st and 2nd selector location is setup for camera controls for OBS. My 3rd position is setup for shortcuts in Rhino3d to save me from typing the same commands or digging deep into menus. It has already proven itself over and over.

The 3D printed enclosure is much nicer than the cardboard box. The PCB, Enclosure, and Arduino code are available for download HERE (ALL VERSION 3.) Also, here is the code:


#include 

// Next Two Lines Are For Debouncing Of Mute Button. Do Not Modify.
unsigned long interval=500; // the time we need to wait
unsigned long previousMillis=0; // millis() returns an unsigned long.

// Next Line Sets Up Which Pins You Will Be Using For Buttons. Add And Remove As Needed.
int keys[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 16};
// Set How Many Buttons You Are Using.
int keyCount = 10;
// Do Not Modify Next Two Lines.
int lastKey;
int keyDelay = 0;

// Rotary Selector Section
// You do not need to modify this.
int rotaryKeys[] = {A0, A1, A2, A3};

void setup() {
Keyboard.begin(); // setup keyboard
// Initialize Pins As Input
for (int thisKey = 0; thisKey < keyCount; thisKey++) {
pinMode(keys[thisKey], INPUT);
}
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
}

void loop() {
// This Will Listen For A Button Press
for (int thisKey = 0; thisKey < keyCount; thisKey++) { // Check Each Button if (readButton(keys[thisKey])) { if (lastKey != keys[thisKey]) { if (digitalRead(A0) == HIGH) { doAction1(keys[thisKey]); } else if (digitalRead(A1) == HIGH) { doAction2(keys[thisKey]); } else if (digitalRead(A2) == HIGH) { doAction3(keys[thisKey]); } else if (digitalRead(A3) == HIGH) { doAction4(keys[thisKey]); } lastKey = keys[thisKey]; } delay(20); } } } boolean readButton(int pin) { // Double Check The Button Press // And Make Sure It Is A Different Button Pressed //if ((digitalRead(pin) == HIGH) && (pin != lastKey)) { if (digitalRead(pin) == HIGH) { delay(10); if (digitalRead(pin) == HIGH) { unsigned long currentMillis = millis(); // grab current time // Once We Know The Button Has Been Physically Pressed // We Will Check If The Interval Has Passed, Reset lastKey // If Needed, Then Return. if ((unsigned long)(currentMillis - previousMillis) >= interval) {
lastKey = 50;
previousMillis = millis();
}
return true;
}
}
return false;
}

// This is the section where you tell the buttons what to do.
// There are more notes at the bottom. If you add or subtract
// buttons, you will need to add or subtract them here.
// NOTE: Case # matches Pin #

//Do Action 1 (Rotary Switch In Position 1)
void doAction1(int pin) {
// Do The Action
switch (pin) {
case 2:
// ALT + q (Start Recording, Stop Recording)
Keyboard.press(0x82);
Keyboard.press('q');
delay(100);
Keyboard.releaseAll();
break;
case 3:
// ALT + ` (Mute Mic, Unmute Mic)
Keyboard.press(0x82);
Keyboard.press('`');
delay(100);
Keyboard.releaseAll();
break;
case 4:
// ALT + 0 (Scene 1)
Keyboard.press(0x82);
Keyboard.press('1');
delay(100);
Keyboard.releaseAll();
break;
case 5:
// ALT + 0 (Scene 2)
Keyboard.press(0x82);
Keyboard.press('2');
delay(100);
Keyboard.releaseAll();
break;
case 6:
// ALT + 0 (Scene 3)
Keyboard.press(0x82);
Keyboard.press('3');
delay(100);
Keyboard.releaseAll();
break;
case 7:
// ALT + 0 (Scene 4)
Keyboard.press(0x82);
Keyboard.press('4');
delay(100);
Keyboard.releaseAll();
break;
case 8:
// ALT + 0 (Scene 5)
Keyboard.press(0x82);
Keyboard.press('5');
delay(100);
Keyboard.releaseAll();
break;
case 9:
// ALT + 0 (Scene 6)
Keyboard.press(0x82);
Keyboard.press('6');
delay(100);
Keyboard.releaseAll();
break;
case 10:
// ALT + 0 (Scene 7)
Keyboard.press(0x82);
Keyboard.press('7');
delay(100);
Keyboard.releaseAll();
break;
case 16:
// ALT + 0 (Scene 8)
Keyboard.press(0x82);
Keyboard.press('8');
delay(100);
Keyboard.releaseAll();
break;
}
// If you want the key to just type something, use
// Keyboard.println("www.funking3d.com");
// You can combine these together. ie add a Keyboard.press
// to type an enter/return afterward.
}

//Do Action 2 (Rotary Switch In Position 2)
void doAction2(int pin) {
// Do The Action
switch (pin) {
case 2:
Keyboard.println("www.funking3d.com");
Keyboard.write(176);
break;
case 3:
Keyboard.println("www.amazon.com");
break;
case 4:
Keyboard.println("www.google.com");
break;
case 5:
Keyboard.println("www.youtube.com");
break;
case 6:
Keyboard.println("www.twitter.com");
break;
case 7:
Keyboard.println("www.facebook.com");
break;
case 8:
Keyboard.println("www.foxnews.com");
break;
case 9:
Keyboard.println("www.thingiverse.com");
break;
case 10:
Keyboard.println("www.youtube.com/funking3d");
break;
case 16:
Keyboard.println("www.lego.com");
break;
}
// If you want the key to just type something, use
// Keyboard.println("www.funking3d.com");
// You can combine these together. ie add a Keyboard.press
// to type an enter/return afterward.
}

//Do Action 3 (Rotary Switch In Position 3)
void doAction3(int pin) {
// Do The Action
switch (pin) {
case 2:
Keyboard.println("Position 3 Button 1");
break;
case 3:
Keyboard.println("Position 3 Button 2");
break;
case 4:
Keyboard.println("Position 3 Button 3");
break;
case 5:
Keyboard.println("Position 3 Button 4");
break;
case 6:
Keyboard.println("Position 3 Button 5");
break;
case 7:
Keyboard.println("Position 3 Button 6");
break;
case 8:
Keyboard.println("Position 3 Button 7");
break;
case 9:
Keyboard.println("Position 3 Button 8");
break;
case 10:
Keyboard.println("Position 3 Button 9");
break;
case 16:
Keyboard.println("Position 3 Button 10");
break;
}
// If you want the key to just type something, use
// Keyboard.println("www.funking3d.com");
// You can combine these together. ie add a Keyboard.press
// to type an enter/return afterward.
}

//Do Action 4 (Rotary Switch In Position 4)
void doAction4(int pin) {
// Do The Action
switch (pin) {
case 2:
Keyboard.println("Position 4 Button 1");
break;
case 3:
Keyboard.println("Position 4 Button 2");
break;
case 4:
Keyboard.println("Position 4 Button 3");
break;
case 5:
Keyboard.println("Position 4 Button 4");
break;
case 6:
Keyboard.println("Position 4 Button 5");
break;
case 7:
Keyboard.println("Position 4 Button 6");
break;
case 8:
Keyboard.println("Position 4 Button 7");
break;
case 9:
Keyboard.println("Position 4 Button 8");
break;
case 10:
Keyboard.println("Position 4 Button 9");
break;
case 16:
Keyboard.println("Position 4 Button 10");
break;
}
// If you want the key to just type something, use
// Keyboard.println("www.funking3d.com");
// You can combine these together. ie add a Keyboard.press
// to type an enter/return afterward.
}

Here are links to the products we bought for this project:

OSOYOO Pro Micro ATmega32U4

KOOKYE 3PCS Pro Micro ATmega32U4

EG Starts 10x Arcade 30mm Push Buttons Switch
*These buttons are a bit loud. They are also convex, not concave like a typical arcade console. But they work and are cheap.

uxcell 40Pcs 1P 2.54mm to 2P 2.0mm Female Jumper Cables Wire

Electronics-Salon Thick Film Network Resistor Assortment Kit

uxcell 3P4T 3 Pole 4 Position Single Wafer Band Selector Rotary Switch w Knob

Uxcell Pcb Right Angle 2 Pin Push Button Tactile Switch with Cap

Haobase 10 Pcs 40 Pin 2.54mm Pitch Straight Single Row PCB Female Pin Headers

DO NOT BUY THESE:
Male & Female Headers: DAOKI 10 Pair 40 Way 2.54mm MALE & FEMALE HEADER
(These were awful for soldering!)

 

If we missed anything, reach out to us and we can get it fixed and let you know what part we used, but I think this is everything.

1 Comment

  1. Hello Glenn,

    I have watched your channel grow from its beginnings to now. Well done to the whole family of Fun King 3D.

    I have tried to compile your Hot Box V3 and can get no further than this. can you point me in the right direction ? Must tell you I run Ubuntu Mate 16.04.

    HotBoxV3.ino: In function ‘void setup()’:
    HotBoxV3.ino:20:3: error: ‘Keyboard’ was not declared in this scope
    HotBoxV3.ino: In function ‘void doAction1(int)’:
    HotBoxV3.ino:88:7: error: ‘Keyboard’ was not declared in this scope
    HotBoxV3.ino: In function ‘void doAction2(int)’:
    HotBoxV3.ino:168:7: error: ‘Keyboard’ was not declared in this scope
    HotBoxV3.ino: In function ‘void doAction3(int)’:
    HotBoxV3.ino:210:7: error: ‘Keyboard’ was not declared in this scope
    HotBoxV3.ino: In function ‘void doAction4(int)’:
    HotBoxV3.ino:251:7: error: ‘Keyboard’ was not declared in this scope

    Kindest Regards,
    Clive Rogers

Leave a Reply

Your email address will not be published. Required fields are marked *