Macropad with Keycaps (AutoHotKeys script)

Hotkeys for different functions and applications
28
136
0
1357
updated April 22, 2023

Description

PDF

For soldering instruction check out: https://www.printables.com/model/269757-stream-deck-marco-keyboard

Make a test print of the base to ensure that your pro micro fit is snug. I did not have a need to glue mine.

AutoHotKey Script

Read through the script and replace the paths. Copy the scipt into your startup folder. Run the script as administrator if you wish for programs to be launched as admin (mainly powershell)

; This is a script for AutoHotkey to be used with a Macro Keyboard assigned with keys F13-F24

; Next Track
f13::Media_Next
return

; Play/Pause
f14::Media_Play_Pause
return

; Previous track
f15::Media_Prev
return

; Open Spotify
f16::
     {
        IfWinNotExist ahk_exe Spotify.exe
        run, "C:\Users\Camilla\AppData\Roaming\Spotify\Spotify.exe"
        WinWait, ahk_exe Spotify.exe
        winactivate, ahk_exe Spotify.exe
    }
    return

; Open Notion
f17::
    {
        IfWinNotExist ahk_exe Notion.exe
        run, "C:\Users\Camilla\AppData\Local\Programs\Notion\Notion.exe"
        WinWait, ahk_exe Notion.exe
        winactivate, ahk_exe Notion.exe
    }
    return

; Open Google Chrome
f18::
    {
        IfWinNotExist ahk_exe chrome.exe
        run, "C:\Program Files\Google\Chrome\Application\chrome.exe"
        WinWait, ahk_exe chrome.exe
        winactivate, ahk_exe chrome.exe
    }
    return

; Open ChatGPT in a new tab
f19::run https://chat.openai.com/chat 

; Open Calculator
f20:: 
    {
        run calc
        return
    }

; f21:: Discord mute button (assigned in discord app)

; Open Discord
f22::
 {
        IfWinNotExist ahk_exe discord.exe
        run, "C:\Users\Camilla\AppData\Local\Discord\app-1.0.9012\Discord.exe"
        WinWait, ahk_exe discord.exe
        winactivate, ahk_exe discord.exe
    }
    return

; Open VS Code
f23:: 
     {
        IfWinNotExist ahk_exe Code.exe
        run, "C:\Users\Camilla\AppData\Local\Programs\Microsoft VS Code\Code.exe"
        WinWait, ahk_exe Code.exe
        winactivate, ahk_exe Code.exe
    }
    return

; Open Powershell IDE
f24::
 {
        IfWinNotExist ahk_exe powershell_ise.exe
        run, "%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe" 
        WinWait, ahk_exe powershell_ise.exe
        winactivate, ahk_exe powershell_ise.exe
    }
    return

 

Arduino Code

Credit: https://www.partsnotincluded.com/diy-stream-deck-mini-macro-keyboard/

/*
 *  Project     'Stream Cheap' Mini Macro Keyboard
 *  @author     David Madison
 *  @link       partsnotincluded.com/electronics/diy-stream-deck-mini-macro-keyboard
 *  @license    MIT - Copyright (c) 2018 David Madison
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */

// ---------------------------------
// Key definitions
#define BUTTON_KEY1 KEY_F13
#define BUTTON_KEY2 KEY_F14
#define BUTTON_KEY3 KEY_F15
#define BUTTON_KEY4 KEY_F16
#define BUTTON_KEY5 KEY_F17
#define BUTTON_KEY6 KEY_F18
#define BUTTON_KEY7 KEY_F19
#define BUTTON_KEY8 KEY_F20
#define BUTTON_KEY9 KEY_F21
#define BUTTON_KEY10 KEY_F22
#define BUTTON_KEY11 KEY_F23
#define BUTTON_KEY12 KEY_F24

// Pin definitions
#define BUTTON_PIN1 2
#define BUTTON_PIN2 3
#define BUTTON_PIN3 4
#define BUTTON_PIN4 5
#define BUTTON_PIN5 6
#define BUTTON_PIN6 7
#define BUTTON_PIN7 8
#define BUTTON_PIN8 9
#define BUTTON_PIN9 10
#define BUTTON_PIN10 16
#define BUTTON_PIN11 14
#define BUTTON_PIN12 15
// ---------------------------------

#include "Keyboard.h"

// Button helper class for handling press/release and debouncing
class button {
  public:
  const char key;
  const uint8_t pin;

  button(uint8_t k, uint8_t p) : key(k), pin(p){}

  void press(boolean state){
    if(state == pressed || (millis() - lastPressed  <= debounceTime)){
      return; // Nothing to see here, folks
    }

    lastPressed = millis();

    state ? Keyboard.press(key) : Keyboard.release(key);    
    pressed = state;
  }

  void update(){
    press(!digitalRead(pin));
  }

  private:
  const unsigned long debounceTime = 30;
  unsigned long lastPressed = 0;
  boolean pressed = 0;
} ;

// Button objects, organized in array
button buttons[] = {
  {BUTTON_KEY1, BUTTON_PIN1},
  {BUTTON_KEY2, BUTTON_PIN2},
  {BUTTON_KEY3, BUTTON_PIN3},
  {BUTTON_KEY4, BUTTON_PIN4},
  {BUTTON_KEY5, BUTTON_PIN5},
  {BUTTON_KEY6, BUTTON_PIN6},
  {BUTTON_KEY7, BUTTON_PIN7},
  {BUTTON_KEY8, BUTTON_PIN8},
  {BUTTON_KEY9, BUTTON_PIN9},
  {BUTTON_KEY10, BUTTON_PIN10},
  {BUTTON_KEY11, BUTTON_PIN11},
  {BUTTON_KEY12, BUTTON_PIN12},
};

const uint8_t NumButtons = sizeof(buttons) / sizeof(button);
const uint8_t ledPin = 17;

void setup() { 
  // Safety check. Ground pin #1 (RX) to cancel keyboard inputs.
  pinMode(1, INPUT_PULLUP);
  if(!digitalRead(1)){
    failsafe();
  }

  // Set LEDs Off. Active low.
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);
  TXLED0;

  for(int i = 0; i < NumButtons; i++){
    pinMode(buttons[i].pin, INPUT_PULLUP);
  }
}

void loop() {
  for(int i = 0; i < NumButtons; i++){
    buttons[i].update();
  }
}

void failsafe(){
  for(;;){} // Just going to hang out here for awhile :D
}

 

Recommended settings for keycaps

Layer height: 0.07 mm

Infill 20%

Enable ironing for all top surfaces

Support enabled (can print without if you printer is dialed in well)

Speed 50%

Heatbed 65° (default 60°)

Flow Factor 90-95

Scale to 98% if the keycap feels loose

Remember to add the color change in your slicer program

Tags



Model origin

The author remixed this model.

License